Skip to content

Commit 6523525

Browse files
committed
feat: added migration to update archaeology permit types
Signed-off-by: Sanjay Babu <sanjaytkbabu@gmail.com>
1 parent 0b4ec47 commit 6523525

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import type { Knex } from 'knex';
2+
3+
const permitNames = [
4+
'Archaeology Alteration Permit',
5+
'Archaeology Heritage Inspection Permit',
6+
'Archaeology Heritage Investigation Permit'
7+
];
8+
9+
export async function up(knex: Knex): Promise<void> {
10+
return (
11+
Promise.resolve()
12+
// Update permit types
13+
.then(async () => {
14+
const partialPermit = {
15+
agency: 'Forests',
16+
division: 'Provincial Operations'
17+
};
18+
19+
await knex('permit_type').whereIn('name', permitNames).update({
20+
agency: partialPermit.agency,
21+
division: partialPermit.division
22+
});
23+
})
24+
);
25+
}
26+
27+
export async function down(knex: Knex): Promise<void> {
28+
return Promise.resolve().then(async () => {
29+
// Revert permit types
30+
const partialPermit = {
31+
agency: 'Water, Land and Resource Stewardship',
32+
division: 'Forest Resiliency and Archaeology',
33+
branch: 'Archaeology',
34+
businessDomain: 'Archaeology'
35+
};
36+
37+
await knex('permit_type').whereIn('name', permitNames).update({
38+
agency: partialPermit.agency,
39+
division: partialPermit.division
40+
});
41+
});
42+
}

0 commit comments

Comments
 (0)