File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-console */
2
+ import { readFile } from 'node:fs/promises' ;
3
+ import { BaseMigration , Migration } from '~/core/database' ;
4
+
5
+ interface ExternalDepartmentId {
6
+ departmentId : string ;
7
+ name ?: string ;
8
+ }
9
+
10
+ @Migration ( '2025-09-17T09:00:00' )
11
+ export class CreateUsedDeptIdListMigration extends BaseMigration {
12
+ async up ( ) {
13
+ const filePath = new URL (
14
+ '../../../../../All-Department-Ids-From-Intaact.csv' ,
15
+ import . meta. url ,
16
+ ) ;
17
+ const fileContent = await readFile ( filePath , 'utf-8' ) ;
18
+ const rows = fileContent . trim ( ) . split ( / \r ? \n / ) . slice ( 1 ) ; // Skip header
19
+ const _idList : ExternalDepartmentId [ ] = rows . flatMap ( ( row ) => {
20
+ const [ departmentId , name ] = row . split ( ',' ) ;
21
+ if ( departmentId ) {
22
+ return { departmentId, name } ;
23
+ }
24
+ return [ ] ;
25
+ } ) ;
26
+ }
27
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { ProjectEngagementConnectionResolver } from './engagement-connection.res
14
14
import { FinancialApproverModule } from './financial-approver/financial-approver.module' ;
15
15
import * as handlers from './handlers' ;
16
16
import { InternshipProjectResolver } from './internship-project.resolver' ;
17
+ import { CreateUsedDeptIdListMigration } from './migrations/create-used-dept-id-list.migration' ;
17
18
import { FixDeptIdLabelMigration } from './migrations/fix-dept-id-label.migration' ;
18
19
import { RenameTranslationToMomentumMigration } from './migrations/rename-translation-to-momentum.migration' ;
19
20
import { ProjectEngagementIdResolvers } from './project-engagement-id.resolver' ;
@@ -55,6 +56,7 @@ import { ProjectWorkflowModule } from './workflow/project-workflow.module';
55
56
...Object . values ( ConcreteRepos ) ,
56
57
ProjectLoader ,
57
58
...Object . values ( handlers ) ,
59
+ CreateUsedDeptIdListMigration ,
58
60
RenameTranslationToMomentumMigration ,
59
61
FixDeptIdLabelMigration ,
60
62
] ,
You can’t perform that action at this time.
0 commit comments