-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:island-is/island.is into j-s/civil-…
…claimant-data-structure
- Loading branch information
Showing
15 changed files
with
230 additions
and
78 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
apps/services/endorsements/api/migrations/20240904000001-endorsement-count.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,30 @@ | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
// Add the 'endorsement_count' column to 'endorsement_list' table | ||
await queryInterface.addColumn('endorsement_list', 'endorsement_count', { | ||
type: Sequelize.INTEGER, | ||
allowNull: false, | ||
defaultValue: 0, | ||
}) | ||
|
||
// Add composite index on 'endorsement_count' and 'counter' | ||
await queryInterface.addIndex( | ||
'endorsement_list', | ||
['endorsement_count', 'counter'], | ||
{ | ||
name: 'idx_endorsement_count_counter', | ||
}, | ||
) | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
// Remove the composite index on 'endorsement_count' and 'counter' | ||
await queryInterface.removeIndex( | ||
'endorsement_list', | ||
'idx_endorsement_count_counter', | ||
) | ||
|
||
// Remove the 'endorsement_count' column from 'endorsement_list' table | ||
await queryInterface.removeColumn('endorsement_list', 'endorsement_count') | ||
}, | ||
} |
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
45 changes: 45 additions & 0 deletions
45
libs/auth-api-lib/migrations/20240915135625-delegation-allow-null-domain_name.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,45 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
async up(queryInterface) { | ||
return queryInterface.sequelize.query(` | ||
BEGIN; | ||
-- 1. Drop the existing unique constraint on (domain_name, from_national_id, to_national_id) | ||
ALTER TABLE delegation | ||
DROP CONSTRAINT IF EXISTS unique_domain_from_to; | ||
-- 2. Alter the domain_name column to allow NULL and remove the default value | ||
ALTER TABLE delegation | ||
ALTER COLUMN domain_name DROP DEFAULT, | ||
ALTER COLUMN domain_name DROP NOT NULL; | ||
-- 3. Create a new unique index to enforce uniqueness where NULL is treated as a value | ||
CREATE UNIQUE INDEX unique_domain_from_to_index | ||
ON delegation (COALESCE(domain_name, 'NULL'), from_national_id, to_national_id); | ||
COMMIT; | ||
`) | ||
}, | ||
|
||
async down(queryInterface) { | ||
return queryInterface.sequelize.query(` | ||
BEGIN; | ||
-- 1. Drop the unique index created with COALESCE | ||
DROP INDEX IF EXISTS unique_domain_from_to_index; | ||
-- 2. Alter the domain_name column to make it NOT NULL again and add the default value | ||
ALTER TABLE delegation | ||
ALTER COLUMN domain_name SET DEFAULT '@island.is', | ||
ALTER COLUMN domain_name SET NOT NULL; | ||
-- 3. Recreate the original unique constraint on (domain_name, from_national_id, to_national_id) | ||
ALTER TABLE delegation ADD CONSTRAINT unique_domain_from_to | ||
UNIQUE (domain_name, from_national_id, to_national_id); | ||
COMMIT; | ||
`) | ||
}, | ||
} |
23 changes: 23 additions & 0 deletions
23
libs/auth-api-lib/seeders/20240917153226-set-also-for-delegated-user-false.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,23 @@ | ||
module.exports = { | ||
up(queryInterface) { | ||
return queryInterface.sequelize.query(` | ||
BEGIN; | ||
UPDATE api_scope | ||
SET also_for_delegated_user = false | ||
WHERE name = '@island.is/signature-collection' | ||
COMMIT; | ||
`) | ||
}, | ||
|
||
down(queryInterface) { | ||
return queryInterface.sequelize.query(` | ||
BEGIN; | ||
UPDATE api_scope | ||
SET also_for_delegated_user = true | ||
WHERE name = '@island.is/signature-collection' | ||
COMMIT; | ||
`) | ||
}, | ||
} |
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.