1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-08 01:15:49 +02:00

Remove manually added migrations and fix the scripts (#2324)

* Fix migrations

* Fix migrations
This commit is contained in:
sjaanus 2022-11-03 13:05:47 +01:00 committed by GitHub
parent d8db33ac7f
commit 0de0da8f97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 40 deletions

View File

@ -0,0 +1,14 @@
'use strict';
exports.up = function (db, callback) {
db.runSql(
`
delete from migrations where name in ('/20221901130645-add-change-requests-table', '/20221810114644-add-suggest-changes-table');
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(``, callback);
};

View File

@ -3,8 +3,6 @@
exports.up = function (db, callback) {
db.runSql(
`
DROP TABLE IF EXISTS suggest_change;
DROP TABLE IF EXISTS suggest_change_set;
CREATE TABLE IF NOT EXISTS change_requests (
id serial primary key,
environment varchar(100) REFERENCES environments(name) ON DELETE CASCADE,

View File

@ -1,38 +0,0 @@
'use strict';
exports.up = function (db, callback) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS suggest_change_set (
id serial primary key,
environment varchar(100) REFERENCES environments(name) ON DELETE CASCADE,
state varchar(255) NOT NULL,
project varchar(255) REFERENCES projects(id) ON DELETE CASCADE,
created_by integer not null references users (id) ON DELETE CASCADE,
created_at timestamp default now()
);
CREATE TABLE IF NOT EXISTS suggest_change (
id serial primary key,
feature varchar(255) NOT NULL references features(name) on delete cascade,
action varchar(255) NOT NULL,
payload jsonb not null default '[]'::jsonb,
created_by integer not null references users (id) ON DELETE CASCADE,
created_at timestamp default now(),
suggest_change_set_id integer NOT NULL REFERENCES suggest_change_set(id) ON DELETE CASCADE,
UNIQUE (feature, action, suggest_change_set_id)
);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
`
DROP TABLE IF EXISTS suggest_change;
DROP TABLE IF EXISTS suggest_change_set;
`,
callback,
);
};