Skip to content

Commit

Permalink
add if not exists check before adding a new column
Browse files Browse the repository at this point in the history
  • Loading branch information
shriramshankar committed Aug 14, 2017
1 parent 9600e32 commit d0ca62b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions migrations/20170811194929-add-profile-imc-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = {
*/
return qi.sequelize.transaction(() =>
qi.sequelize.query('ALTER TABLE ONLY "Profiles" ' +
'ADD COLUMN "botAccess" "enum_Profiles_botAccess", ' +
'ADD COLUMN "eventAccess" "enum_Profiles_eventAccess", ' +
'ADD COLUMN "roomAccess" "enum_Profiles_roomAccess", ' +
'ADD COLUMN "roomTypeAccess" "enum_Profiles_roomTypeAccess"', {
'ADD COLUMN IF NOT EXISTS "botAccess" "enum_Profiles_botAccess", ' +
'ADD COLUMN IF NOT EXISTS "eventAccess" "enum_Profiles_eventAccess", ' +
'ADD COLUMN IF NOT EXISTS "roomAccess" "enum_Profiles_roomAccess", ' +
'ADD COLUMN IF NOT EXISTS "roomTypeAccess" "enum_Profiles_roomTypeAccess"', {
type: qi.sequelize.QueryTypes.ALTER,
})
);
Expand Down

0 comments on commit d0ca62b

Please sign in to comment.