-
-
Notifications
You must be signed in to change notification settings - Fork 736
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 renames new created_by columns (#5681)
## About the changes Replaces #5616 Renamed newly added `created_by` columns to `created_by_user_id` for these tables: features feature_tag feature_strategies feature_types role_permission role_user roles users api_tokens
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/migrations/20231219100343-rename-new-columns-to-created-by-user-id.js
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,35 @@ | ||
'use strict'; | ||
|
||
exports.up = function (db, callback) { | ||
db.runSql( | ||
` | ||
ALTER TABLE features RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE feature_types RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE feature_tag RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE feature_strategies RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE role_permission RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE role_user RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE roles RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE users RENAME COLUMN created_by TO created_by_user_id; | ||
ALTER TABLE api_tokens RENAME COLUMN created_by TO created_by_user_id; | ||
`, | ||
callback, | ||
); | ||
}; | ||
|
||
exports.down = function (db, callback) { | ||
db.runSql( | ||
` | ||
ALTER TABLE features RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE feature_types RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE feature_tag RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE feature_strategies RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE role_permission RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE role_user RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE roles RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE users RENAME COLUMN created_by_user_id TO created_by; | ||
ALTER TABLE api_tokens RENAME COLUMN created_by_user_id TO created_by; | ||
`, | ||
callback, | ||
); | ||
}; |