1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: don't use hardcoded timestamps as default values (#745)

fixes: #741
This commit is contained in:
Christopher Kolstad 2021-03-04 13:43:52 +01:00 committed by GitHub
parent 8e0bae7352
commit 31082e5227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,30 @@
'use strict';
exports.up = function(db, cb) {
db.runSql(
`
ALTER TABLE client_applications ALTER COLUMN created_at SET DEFAULT now();
ALTER TABLE client_applications ALTER COLUMN updated_at SET DEFAULT now();
ALTER TABLE context_fields ALTER COLUMN created_at SET DEFAULT now();
ALTER TABLE context_fields ALTER COLUMN updated_at SET DEFAULT now();
ALTER TABLE projects ALTER COLUMN created_at SET DEFAULT now();
ALTER TABLE users ALTER COLUMN created_at SET DEFAULT now();
`,
cb,
);
};
exports.down = function(db, cb) {
db.runSql(
`
ALTER TABLE client_applications ALTER COLUMN created_at SET DEFAULT 'now()';
ALTER TABLE client_applications ALTER COLUMN updated_at SET DEFAULT 'now()';
ALTER TABLE context_fields ALTER COLUMN created_at SET DEFAULT 'now()';
ALTER TABLE context_fields ALTER COLUMN updated_at SET DEFAULT 'now()';
ALTER TABLE projects ALTER COLUMN created_at SET DEFAULT 'now()';
ALTER TABLE users ALTER COLUMN created_at SET DEFAULT 'now()';
`,
cb,
);
};