-
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.
feat(j-s): Separate requested defender info from actual assigned defe…
…nder info
- Loading branch information
Showing
14 changed files
with
211 additions
and
46 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
73 changes: 73 additions & 0 deletions
73
apps/judicial-system/backend/migrations/20241011090000-update-defendant.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,73 @@ | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.addColumn( | ||
'defendant', | ||
'requested_defender_choice', | ||
{ | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}, | ||
{ transaction: t }, | ||
) | ||
await queryInterface.addColumn( | ||
'defendant', | ||
'requested_defender_national_id', | ||
{ | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}, | ||
{ transaction: t }, | ||
) | ||
await queryInterface.addColumn( | ||
'defendant', | ||
'requested_defender_name', | ||
{ | ||
type: Sequelize.STRING, | ||
allowNull: true, | ||
}, | ||
{ transaction: t }, | ||
) | ||
|
||
await queryInterface.sequelize.query( | ||
`UPDATE "defendant" SET requested_defender_choice = defender_choice`, | ||
{ transaction: t }, | ||
) | ||
|
||
await queryInterface.sequelize.query( | ||
`UPDATE "defendant" SET requested_defender_national_id = defender_national_id`, | ||
{ transaction: t }, | ||
) | ||
|
||
await queryInterface.sequelize.query( | ||
`UPDATE "defendant" SET requested_defender_name = defender_name`, | ||
{ transaction: t }, | ||
) | ||
}) | ||
}, | ||
down: (queryInterface) => { | ||
return queryInterface.sequelize.transaction(async (t) => { | ||
await queryInterface.removeColumn( | ||
'defendant', | ||
'requested_defender_choice', | ||
{ | ||
transaction: t, | ||
}, | ||
) | ||
await queryInterface.removeColumn( | ||
'defendant', | ||
'requested_defender_national_id', | ||
{ | ||
transaction: t, | ||
}, | ||
) | ||
await queryInterface.removeColumn( | ||
'defendant', | ||
'requested_defender_name', | ||
{ | ||
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
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
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.