-
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.
chore(j-s): Add institution addresses to db (#15886)
* chore(j-s): Add institution addresses to db * chore(j-s): Use institution from db for subpoena --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
42fef4d
commit 2af2801
Showing
3 changed files
with
53 additions
and
23 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
apps/judicial-system/backend/migrations/20240904100012-update-institution.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' | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.addColumn('institution', 'address', { | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}) | ||
|
||
const institutionsToUpdate = [ | ||
{ | ||
name: 'Héraðsdómur Reykjavíkur', | ||
address: 'Dómhúsið við Lækjartorg, Reykjavík', | ||
}, | ||
{ name: 'Héraðsdómur Reykjaness', address: 'Fjarðargata 9, Hafnarfirði' }, | ||
{ | ||
name: 'Héraðsdómur Vesturlands', | ||
address: 'Bjarnarbraut 8, Borgarnesi', | ||
}, | ||
{ name: 'Héraðsdómur Vestfjarða', address: 'Hafnarstræti 9, Ísafirði' }, | ||
{ | ||
name: 'Héraðsdómur Norðurlands vestra', | ||
address: 'Skagfirðingabraut 21, Sauðárkróki', | ||
}, | ||
{ | ||
name: 'Héraðsdómur Norðurlands eystra', | ||
address: 'Hafnarstræti 107, 4. hæð, Akureyri', | ||
}, | ||
{ name: 'Héraðsdómur Austurlands', address: 'Lyngás 15, Egilsstöðum' }, | ||
{ name: 'Héraðsdómur Suðurlands', address: 'Austurvegur 4, Selfossi' }, | ||
] | ||
|
||
await queryInterface.sequelize.transaction(async (transaction) => { | ||
for (const institution of institutionsToUpdate) { | ||
await queryInterface.bulkUpdate( | ||
'institution', | ||
{ address: institution.address }, | ||
{ name: institution.name }, | ||
{ transaction }, | ||
) | ||
} | ||
}) | ||
}, | ||
|
||
down: async (queryInterface) => { | ||
await queryInterface.removeColumn('institution', 'address') | ||
}, | ||
} |
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