File tree Expand file tree Collapse file tree 2 files changed +181
-0
lines changed
backend/typescript/migrations Expand file tree Collapse file tree 2 files changed +181
-0
lines changed Original file line number Diff line number Diff line change 1+ import { DataType } from "sequelize-typescript" ;
2+
3+ import { Migration } from "../umzug" ;
4+
5+ const TABLE_NAME = "applicants" ;
6+
7+ const SEEDED_DATA = [
8+ {
9+ id : "123" ,
10+ academicOrCoop : "Academic" ,
11+ academicYear : "2024" ,
12+ email : "jj2huang@uwaterloo.ca" ,
13+ firstName : "Jesse" ,
14+ lastName : "Huang" ,
15+ heardFrom : "LinkedIn" ,
16+ locationPreference : "Waterloo" ,
17+ program : "Computer Science" ,
18+ pronouns : "he/him" ,
19+ resumeUrl :
20+ "https://www.youtube.com/watch?v=xvFZjo5PgG0&list=RDxvFZjo5PgG0&start_radio=1" ,
21+ timesApplied : 1 ,
22+ shortAnswerQuestions : [ "hi" , "bye" ] ,
23+ term : "S25" ,
24+ submittedAt : "2025-06-21T07:02:40.000Z" ,
25+ createdAt : new Date ( ) ,
26+ updatedAt : new Date ( ) ,
27+ } ,
28+ ] ;
29+
30+ export const up : Migration = async ( { context : sequelize } ) => {
31+ await sequelize . getQueryInterface ( ) . createTable ( TABLE_NAME , {
32+ id : {
33+ type : DataType . STRING ,
34+ allowNull : false ,
35+ primaryKey : true ,
36+ } ,
37+ academicOrCoop : {
38+ type : DataType . STRING ,
39+ allowNull : false ,
40+ } ,
41+ academicYear : {
42+ type : DataType . STRING ,
43+ allowNull : false ,
44+ } ,
45+ email : {
46+ type : DataType . STRING ,
47+ allowNull : false ,
48+ } ,
49+ firstName : {
50+ type : DataType . STRING ,
51+ allowNull : false ,
52+ } ,
53+ lastName : {
54+ type : DataType . STRING ,
55+ allowNull : false ,
56+ } ,
57+ heardFrom : {
58+ type : DataType . STRING ,
59+ allowNull : false ,
60+ } ,
61+ locationPreference : {
62+ type : DataType . STRING ,
63+ allowNull : false ,
64+ } ,
65+ program : {
66+ type : DataType . STRING ,
67+ allowNull : false ,
68+ } ,
69+ pronouns : {
70+ type : DataType . STRING ,
71+ allowNull : false ,
72+ } ,
73+ resumeUrl : {
74+ type : DataType . STRING ,
75+ allowNull : true ,
76+ } ,
77+ timesApplied : {
78+ type : DataType . INTEGER ,
79+ allowNull : false ,
80+ } ,
81+ shortAnswerQuestions : {
82+ type : DataType . ARRAY ( DataType . STRING ) ,
83+ allowNull : true ,
84+ } ,
85+ term : {
86+ type : DataType . STRING ,
87+ allowNull : false ,
88+ } ,
89+ submittedAt : {
90+ type : DataType . STRING ,
91+ allowNull : false ,
92+ } ,
93+ createdAt : {
94+ type : DataType . DATE ,
95+ allowNull : false ,
96+ } ,
97+ updatedAt : {
98+ type : DataType . DATE ,
99+ allowNull : false ,
100+ } ,
101+ } ) ;
102+ await sequelize . getQueryInterface ( ) . bulkInsert ( TABLE_NAME , SEEDED_DATA ) ;
103+ } ;
104+
105+ export const down : Migration = async ( { context : sequelize } ) => {
106+ await sequelize . getQueryInterface ( ) . dropTable ( TABLE_NAME ) ;
107+ } ;
Original file line number Diff line number Diff line change 1+ import { DataType } from "sequelize-typescript" ;
2+ import { Migration } from "../umzug" ;
3+
4+ const TABLE_NAME = "applicant_records" ; // Changed table name to differentiate from applicantresponse
5+
6+ const SEEDED_DATA = [
7+ {
8+ id : "1" ,
9+ applicationtId : "123" ,
10+ // role: "developer",
11+ roleSpecificQuestions : [ "i like monke" ] ,
12+ choice : 1 ,
13+ status : "Applied" ,
14+ skillCategory : "junior" ,
15+ createdAt : new Date ( ) ,
16+ updatedAt : new Date ( ) ,
17+ } ,
18+ ] ;
19+
20+ export const up : Migration = async ( { context : sequelize } ) => {
21+ await sequelize . getQueryInterface ( ) . createTable ( TABLE_NAME , {
22+ id : {
23+ type : DataType . STRING ,
24+ allowNull : false ,
25+ primaryKey : true ,
26+ } ,
27+ applicantId : {
28+ type : DataType . STRING ,
29+ allowNull : false ,
30+ references : {
31+ model : "applicants" ,
32+ key : "id" ,
33+ } ,
34+ } ,
35+ // ADD IN ONCE CAROLYNS THING IS ADDED
36+ // role: {
37+ // type: DataType.STRING,
38+ // allowNull: true,
39+ // references: {
40+ // model: "roles",
41+ // key: "id",
42+ // },
43+ // },
44+ roleSpecificQuestions : {
45+ type : DataType . ARRAY ( DataType . STRING ) ,
46+ allowNull : true ,
47+ } ,
48+ choice : {
49+ type : DataType . INTEGER ,
50+ allowNull : false ,
51+ } ,
52+ status : {
53+ type : DataType . STRING ,
54+ allowNull : false ,
55+ } ,
56+ skillCategory : {
57+ type : DataType . STRING ,
58+ allowNull : true ,
59+ } ,
60+ createdAt : {
61+ type : DataType . DATE ,
62+ allowNull : false ,
63+ } ,
64+ updatedAt : {
65+ type : DataType . DATE ,
66+ allowNull : false ,
67+ } ,
68+ } ) ;
69+ await sequelize . getQueryInterface ( ) . bulkInsert ( TABLE_NAME , SEEDED_DATA ) ;
70+ } ;
71+
72+ export const down : Migration = async ( { context : sequelize } ) => {
73+ await sequelize . getQueryInterface ( ) . dropTable ( TABLE_NAME ) ;
74+ } ;
You can’t perform that action at this time.
0 commit comments