Skip to content

Commit

Permalink
migration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wulff007 committed Oct 26, 2024
1 parent aee8108 commit 0f69092
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions migrations/20241011063712-datasources.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ exports.setup = function(options, seedLink) {

exports.up = async function(db) {
await db.runSql(
"ALTER TABLE datasource_fields DROP CONSTRAINT ds_fields;" +
"DROP TABLE IF EXISTS datasource;" +
"DELETE FROM datasource_fields;"+
"CREATE TABLE datasource (" +
"id bigserial primary key," +
"account_id int NOT NULL REFERENCES accounts(id) ON DELETE NO ACTION ON UPDATE CASCADE,"+
Expand Down Expand Up @@ -204,7 +201,11 @@ const getFields = async(db) => {
}

exports.down = async function(db) {
await db.runSql("ALTER TABLE datasource_fields RENAME COLUMN nullable TO required;")
await db.runSql(
"ALTER TABLE datasource_fields RENAME COLUMN nullable TO required;" +
"ALTER TABLE datasource_fields DROP CONSTRAINT ds_fields;" +
"DROP TABLE IF EXISTS datasource;" +
"DELETE FROM datasource_fields;")
};

exports._meta = {
Expand Down

0 comments on commit 0f69092

Please sign in to comment.