mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: add cascade query inside create table for splash
This commit is contained in:
parent
0199d1f211
commit
16429fcf9a
@ -4,11 +4,12 @@ exports.up = function (db, cb) {
|
|||||||
db.runSql(
|
db.runSql(
|
||||||
`
|
`
|
||||||
CREATE TABLE IF NOT EXISTS user_splash
|
CREATE TABLE IF NOT EXISTS user_splash
|
||||||
(user_id INTEGER NOT NULL references users (id),
|
(user_id INTEGER NOT NULL references users (id) ON DELETE CASCADE,
|
||||||
splash_id TEXT,
|
splash_id TEXT,
|
||||||
seen BOOLEAN NOT NULL DEFAULT false,
|
seen BOOLEAN NOT NULL DEFAULT false,
|
||||||
PRIMARY KEY (user_id, splash_id));
|
PRIMARY KEY (user_id, splash_id));
|
||||||
CREATE INDEX user_splash_user_id_idx ON user_splash (user_id);`,
|
CREATE INDEX user_splash_user_id_idx ON user_splash (user_id);
|
||||||
|
`,
|
||||||
cb,
|
cb,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
exports.up = function (db, cb) {
|
|
||||||
db.runSql(
|
|
||||||
`
|
|
||||||
ALTER TABLE user_splash DROP CONSTRAINT user_splash_user_id_fkey;
|
|
||||||
ALTER TABLE user_splash
|
|
||||||
ADD CONSTRAINT user_splash_user_id_fkey
|
|
||||||
FOREIGN KEY (user_id)
|
|
||||||
REFERENCES users(id) ON DELETE CASCADE;
|
|
||||||
`,
|
|
||||||
cb,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.down = function (db, cb) {
|
|
||||||
db.runSql('', cb);
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user