mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-12 01:17:04 +02:00
Remove manually added migrations and fix the scripts (#2324)
* Fix migrations * Fix migrations
This commit is contained in:
parent
d8db33ac7f
commit
0de0da8f97
14
src/migrations/20221103111940-fix-migrations.js
Normal file
14
src/migrations/20221103111940-fix-migrations.js
Normal 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);
|
||||||
|
};
|
@ -3,8 +3,6 @@
|
|||||||
exports.up = function (db, callback) {
|
exports.up = function (db, callback) {
|
||||||
db.runSql(
|
db.runSql(
|
||||||
`
|
`
|
||||||
DROP TABLE IF EXISTS suggest_change;
|
|
||||||
DROP TABLE IF EXISTS suggest_change_set;
|
|
||||||
CREATE TABLE IF NOT EXISTS change_requests (
|
CREATE TABLE IF NOT EXISTS change_requests (
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
environment varchar(100) REFERENCES environments(name) ON DELETE CASCADE,
|
environment varchar(100) REFERENCES environments(name) ON DELETE CASCADE,
|
@ -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,
|
|
||||||
);
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user