mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-19 13:21:46 +00:00
chore: prepare database for nest + typeorm
This commit is contained in:
@@ -2141,6 +2141,12 @@ function runMigrations(db: Database.Database): void {
|
|||||||
> (SELECT day_number FROM days WHERE id = end_day_id)
|
> (SELECT day_number FROM days WHERE id = end_day_id)
|
||||||
`);
|
`);
|
||||||
},
|
},
|
||||||
|
// prepare migration to nest + typeorm
|
||||||
|
() => {
|
||||||
|
db.exec(`CREATE TABLE IF NOT EXISTS migrations (id integer PRIMARY KEY AUTOINCREMENT NOT NULL, timestamp bigint NOT NULL, name varchar NOT NULL);`);
|
||||||
|
db.exec(`INSERT INTO migrations (timestamp, name) VALUES (1777810195344, 'InitialSchema1777810195344');`);
|
||||||
|
db.exec(`INSERT INTO app_settings (key, value) VALUES ('app_version', '${process.env.APP_VERSION || '3.0.14'}')`);
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (currentVersion < migrations.length) {
|
if (currentVersion < migrations.length) {
|
||||||
|
|||||||
@@ -474,6 +474,8 @@ function createTables(db: Database.Database): void {
|
|||||||
PRIMARY KEY (user_id, event_type, channel)
|
PRIMARY KEY (user_id, event_type, channel)
|
||||||
);
|
);
|
||||||
CREATE INDEX IF NOT EXISTS idx_ncp_user ON notification_channel_preferences(user_id);
|
CREATE INDEX IF NOT EXISTS idx_ncp_user ON notification_channel_preferences(user_id);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS migrations (id integer PRIMARY KEY AUTOINCREMENT NOT NULL, timestamp bigint NOT NULL, name varchar NOT NULL);
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user