-
Notifications
You must be signed in to change notification settings - Fork 44
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 #9966 from hicommonwealth/release/v1.7.4-x
Release/v1.7.4-1
- Loading branch information
Showing
7 changed files
with
93 additions
and
7 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
13 changes: 13 additions & 0 deletions
13
packages/commonwealth/server/migrations/20241119145300-recompute-profile-counts.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,13 @@ | ||
'use strict'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
await queryInterface.sequelize.query(` | ||
UPDATE "Communities" C | ||
SET profile_count = (SELECT COUNT(DISTINCT (user_id)) FROM "Addresses" WHERE community_id = C.id); | ||
`); | ||
}, | ||
|
||
async down(queryInterface, Sequelize) {}, | ||
}; |
62 changes: 62 additions & 0 deletions
62
packages/commonwealth/server/migrations/20241119175513-add-cascade-delete.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,62 @@ | ||
'use strict'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
await queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.sequelize.query( | ||
` | ||
ALTER TABLE "ContestActions" | ||
DROP CONSTRAINT "ContestActions_contests_fkey", | ||
ADD CONSTRAINT "ContestActions_contests_fkey" | ||
FOREIGN KEY (contest_address, contest_id) | ||
REFERENCES "Contests" (contest_address, contest_id) | ||
ON UPDATE NO ACTION | ||
ON DELETE CASCADE; | ||
`, | ||
{ transaction: t }, | ||
); | ||
|
||
await queryInterface.sequelize.query( | ||
` | ||
ALTER TABLE "Contests" | ||
DROP CONSTRAINT "Contests_contestmanagers_fkey", | ||
ADD CONSTRAINT "Contests_contestmanagers_fkey" | ||
FOREIGN KEY (contest_address) | ||
REFERENCES "ContestManagers" (contest_address) | ||
ON UPDATE NO ACTION | ||
ON DELETE CASCADE; | ||
`, | ||
{ transaction: t }, | ||
); | ||
}); | ||
}, | ||
|
||
async down(queryInterface, Sequelize) { | ||
await queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.sequelize.query( | ||
` | ||
ALTER TABLE "ContestActions" | ||
DROP CONSTRAINT "ContestActions_contests_fkey", | ||
ADD CONSTRAINT "ContestActions_contests_fkey" | ||
FOREIGN KEY (contest_address, contest_id) | ||
REFERENCES "Contests" (contest_address, contest_id) | ||
ON DELETE NO ACTION; | ||
`, | ||
{ transaction: t }, | ||
); | ||
|
||
await queryInterface.sequelize.query( | ||
` | ||
ALTER TABLE "Contests" | ||
DROP CONSTRAINT "Contests_contestmanagers_fkey", | ||
ADD CONSTRAINT "Contests_contestmanagers_fkey" | ||
FOREIGN KEY (contest_address) | ||
REFERENCES "ContestManagers" (contest_address) | ||
ON DELETE NO ACTION; | ||
`, | ||
{ transaction: t }, | ||
); | ||
}); | ||
}, | ||
}; |
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