Skip to content

Commit

Permalink
Fix owner_rels.cid foreign key reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo157 authored and Joshua Nelson committed Aug 1, 2020
1 parent 21e44ef commit 8c97d88
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/db/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,22 @@ pub fn migrate(version: Option<Version>, conn: &Connection) -> CratesfyiResult<(
"DROP TABLE compression_rels;
ALTER TABLE files DROP COLUMN compression;"
),
migration!(
context,
// version
15,
// description
"Fix owner_rels.cid foreign key reference",
// upgrade query
"
ALTER TABLE owner_rels DROP CONSTRAINT owner_rels_cid_fkey;
ALTER TABLE owner_rels ADD FOREIGN KEY (cid) REFERENCES crates(id);
",
// downgrade query
"
-- Nope, this is a pure database fix, no going back.
"
),
];

for migration in migrations {
Expand Down

0 comments on commit 8c97d88

Please sign in to comment.