1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00

1-1531: create db table for cr schedules (#5148)

This PR adds a db table for CR schedules. The table has two columns:
1. `change_request` :: This acts as both a foreign key and as the
primary key for this table.
2. `scheduled_at` :: When the change is scheduled to be applied.

We could use a separate ID column for these rows and put a `unique`
constraint on the `change_request` FK, but I don't think that adds any
more value. However, I'm happy to hear other thoughts around it.
This commit is contained in:
Thomas Heartman 2023-10-25 14:36:03 +02:00 committed by GitHub
parent d681e614ac
commit a5d304ca51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,22 @@
'use strict';
exports.up = function (db, callback) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS change_request_schedule (
change_request INTEGER PRIMARY KEY REFERENCES change_requests(id) ON DELETE CASCADE,
scheduled_at TIMESTAMP NOT NULL
);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
`
DROP TABLE IF EXISTS change_request_schedule;
`,
callback,
);
};