mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-09 11:14:29 +02:00
## About the changes Migrations for: - Adds column is_system to users - Inserts unleash_system_user id -1337 to users includes `is_system: false` in the activeUsers and activeAccounts where filter Tested by running: ` select * into users_pre_check from users where id > -1; delete from users where id > -1; ` before starting unleash, then inspecting users table after unleash has started and verifying that an 'admin' user has been created. --------- Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
25 lines
628 B
JavaScript
25 lines
628 B
JavaScript
'use strict';
|
|
|
|
exports.up = function (db, callback) {
|
|
db.runSql(
|
|
`
|
|
ALTER TABLE users ADD COLUMN IF NOT EXISTS is_system BOOLEAN NOT NULL DEFAULT FALSE;
|
|
INSERT INTO users
|
|
(id, name, username, email, created_by_user_id, is_system)
|
|
VALUES
|
|
(-1337, 'Unleash System', 'unleash_system_user', 'system@getunleash.io', -1337, true);
|
|
`,
|
|
callback,
|
|
);
|
|
};
|
|
|
|
exports.down = function (db, callback) {
|
|
db.runSql(
|
|
`
|
|
ALTER TABLE users DROP COLUMN IF EXISTS is_system;
|
|
DELETE FROM users WHERE id = -1337;
|
|
`,
|
|
callback,
|
|
);
|
|
};
|