-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add migration that adds is_system column and inserts system user
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
exports.up = function (db, callback) { | ||
db.runSql( | ||
` | ||
ALTER TABLE users ADD COLUMN IF NOT EXISTS is_system BOOLEAN NOT NULL DEFAULT FALSE; | ||
DELETE FROM users WHERE id = -1337; | ||
INSERT INTO users | ||
(id, name, username, email, created_by, is_system) | ||
VALUES | ||
(-1337, 'Used by unleash internally for performing system actions that have no user', 'unleash_system_user', '[email protected]', -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, | ||
); | ||
}; |