Skip to content

Commit 8c97d88

Browse files
Nemo157Joshua Nelson
authored and
Joshua Nelson
committed
Fix owner_rels.cid foreign key reference
1 parent 21e44ef commit 8c97d88

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/db/migrate.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,22 @@ pub fn migrate(version: Option<Version>, conn: &Connection) -> CratesfyiResult<(
364364
"DROP TABLE compression_rels;
365365
ALTER TABLE files DROP COLUMN compression;"
366366
),
367+
migration!(
368+
context,
369+
// version
370+
15,
371+
// description
372+
"Fix owner_rels.cid foreign key reference",
373+
// upgrade query
374+
"
375+
ALTER TABLE owner_rels DROP CONSTRAINT owner_rels_cid_fkey;
376+
ALTER TABLE owner_rels ADD FOREIGN KEY (cid) REFERENCES crates(id);
377+
",
378+
// downgrade query
379+
"
380+
-- Nope, this is a pure database fix, no going back.
381+
"
382+
),
367383
];
368384

369385
for migration in migrations {

0 commit comments

Comments
 (0)