-
Notifications
You must be signed in to change notification settings - Fork 46
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 #10899 from hicommonwealth/tim/event-migration-fixes
- Loading branch information
Showing
15 changed files
with
523 additions
and
43 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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
packages/commonwealth/server/migrations/20250207092628-migrated-evm-sources.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,48 @@ | ||
'use strict'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
return queryInterface.sequelize.transaction(async (transaction) => { | ||
await queryInterface.sequelize.query( | ||
` | ||
UPDATE "EvmEventSources" | ||
SET created_at_block = 1, | ||
events_migrated = true; | ||
`, | ||
{ transaction }, | ||
); | ||
await queryInterface.sequelize.query( | ||
` | ||
ALTER TABLE "EvmEventSources" | ||
ALTER COLUMN created_at_block SET NOT NULL, | ||
ALTER COLUMN events_migrated SET NOT NULL, | ||
ALTER COLUMN events_migrated SET DEFAULT FALSE; | ||
`, | ||
{ transaction }, | ||
); | ||
}); | ||
}, | ||
|
||
async down(queryInterface, Sequelize) { | ||
return queryInterface.sequelize.transaction(async (transaction) => { | ||
await queryInterface.sequelize.query( | ||
` | ||
ALTER TABLE "EvmEventSources" | ||
ALTER COLUMN created_at_block DROP NOT NULL, | ||
ALTER COLUMN events_migrated DROP NOT NULL, | ||
ALTER COLUMN events_migrated DROP DEFAULT; | ||
`, | ||
{ transaction }, | ||
); | ||
await queryInterface.sequelize.query( | ||
` | ||
UPDATE "EvmEventSources" | ||
SET created_at_block = NULL, | ||
events_migrated = NULL; | ||
`, | ||
{ transaction }, | ||
); | ||
}); | ||
}, | ||
}; |
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.