-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1097 from Open-Earth-Foundation/nina/feat/ON-2797…
…/invitesCRUD feat: [ON-3245] [ON-3246] [ON-3296]
- Loading branch information
Showing
56 changed files
with
1,924 additions
and
1,586 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
app/migrations/20250128154456-cityInvite__alter_type_user_id.cjs
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,42 @@ | ||
"use strict"; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
// Add a temporary column with UUID type | ||
await queryInterface.addColumn("CityInvite", "user_id_temp", { | ||
type: Sequelize.UUID, | ||
allowNull: true, | ||
}); | ||
|
||
// Copy data from user_id to user_id_temp | ||
await queryInterface.sequelize.query( | ||
'UPDATE "CityInvite" SET "user_id_temp" = "user_id"::uuid', | ||
); | ||
|
||
// Remove the old user_id column | ||
await queryInterface.removeColumn("CityInvite", "user_id"); | ||
|
||
// Rename the temporary column to user_id | ||
await queryInterface.renameColumn("CityInvite", "user_id_temp", "user_id"); | ||
}, | ||
|
||
async down(queryInterface, Sequelize) { | ||
// Add a temporary column with STRING type | ||
await queryInterface.addColumn("CityInvite", "user_id_temp", { | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}); | ||
|
||
// Copy data from user_id to user_id_temp | ||
await queryInterface.sequelize.query( | ||
'UPDATE "CityInvite" SET "user_id_temp" = "user_id"::text', | ||
); | ||
|
||
// Remove the old user_id column | ||
await queryInterface.removeColumn("CityInvite", "user_id"); | ||
|
||
// Rename the temporary column to user_id | ||
await queryInterface.renameColumn("CityInvite", "user_id_temp", "user_id"); | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.