vr-migrations 1.0.38 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,11 +18,6 @@ module.exports = {
|
|
|
18
18
|
type: Sequelize.STRING(100),
|
|
19
19
|
allowNull: false,
|
|
20
20
|
},
|
|
21
|
-
nationalId: {
|
|
22
|
-
type: Sequelize.STRING(100),
|
|
23
|
-
allowNull: true,
|
|
24
|
-
unique: true,
|
|
25
|
-
},
|
|
26
21
|
jacketId: {
|
|
27
22
|
type: Sequelize.STRING(100),
|
|
28
23
|
allowNull: true,
|
|
@@ -49,6 +44,35 @@ module.exports = {
|
|
|
49
44
|
type: Sequelize.STRING(100),
|
|
50
45
|
allowNull: true,
|
|
51
46
|
},
|
|
47
|
+
gender: {
|
|
48
|
+
type: Sequelize.ENUM("male", "female"),
|
|
49
|
+
allowNull: false,
|
|
50
|
+
defaultValue: "male",
|
|
51
|
+
},
|
|
52
|
+
birthDate: {
|
|
53
|
+
type: Sequelize.INTEGER,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
validate: {
|
|
56
|
+
min: 1,
|
|
57
|
+
max: 31,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
birthMonth: {
|
|
61
|
+
type: Sequelize.INTEGER,
|
|
62
|
+
allowNull: true,
|
|
63
|
+
validate: {
|
|
64
|
+
min: 1,
|
|
65
|
+
max: 12,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
birthYear: {
|
|
69
|
+
type: Sequelize.INTEGER,
|
|
70
|
+
allowNull: true,
|
|
71
|
+
validate: {
|
|
72
|
+
min: 1900,
|
|
73
|
+
max: new Date().getFullYear(),
|
|
74
|
+
},
|
|
75
|
+
},
|
|
52
76
|
primaryPhoneId: {
|
|
53
77
|
type: Sequelize.UUID,
|
|
54
78
|
allowNull: true,
|
|
@@ -67,7 +91,6 @@ module.exports = {
|
|
|
67
91
|
type: Sequelize.BOOLEAN,
|
|
68
92
|
defaultValue: false,
|
|
69
93
|
},
|
|
70
|
-
|
|
71
94
|
lastLoginAt: {
|
|
72
95
|
type: Sequelize.DATE,
|
|
73
96
|
allowNull: true,
|
|
@@ -99,12 +122,15 @@ module.exports = {
|
|
|
99
122
|
|
|
100
123
|
// Add indexes
|
|
101
124
|
await queryInterface.addIndex("users", ["jacketId"]);
|
|
102
|
-
await queryInterface.addIndex("users", ["nationalId"]);
|
|
103
125
|
await queryInterface.addIndex("users", ["primaryPhoneId"]);
|
|
104
126
|
await queryInterface.addIndex("users", ["securityClearanceId"]);
|
|
127
|
+
await queryInterface.addIndex("users", ["gender"]);
|
|
105
128
|
},
|
|
106
129
|
|
|
107
130
|
async down(queryInterface) {
|
|
108
131
|
await queryInterface.dropTable("users");
|
|
132
|
+
await queryInterface.sequelize.query(
|
|
133
|
+
'DROP TYPE IF EXISTS "enum_users_gender";'
|
|
134
|
+
);
|
|
109
135
|
},
|
|
110
136
|
};
|
|
@@ -6,10 +6,6 @@ module.exports = {
|
|
|
6
6
|
async up(queryInterface) {
|
|
7
7
|
const now = new Date();
|
|
8
8
|
const passwordHash = await bcrypt.hash("pass@123", 10);
|
|
9
|
-
const nid_1 = await bcrypt.hash("1199900000000001", 10);
|
|
10
|
-
const nid_2 = await bcrypt.hash("1199900000000002", 10);
|
|
11
|
-
const nid_3 = await bcrypt.hash("1199900000000003", 10);
|
|
12
|
-
const nid_4 = await bcrypt.hash("1199900000000004", 10);
|
|
13
9
|
|
|
14
10
|
// STEP 1: Create users FIRST (without primaryPhoneId initially)
|
|
15
11
|
await queryInterface.bulkInsert("users", [
|
|
@@ -17,11 +13,14 @@ module.exports = {
|
|
|
17
13
|
id: "aaaaaaa1-aaaa-aaaa-aaaa-aaaaaaaaaaa1",
|
|
18
14
|
firstName: "Jean",
|
|
19
15
|
lastName: "Rider",
|
|
20
|
-
nationalId: nid_1,
|
|
21
16
|
jacketId: "JACKET-R-001",
|
|
22
17
|
plateNumber: "RAD101A",
|
|
18
|
+
gender: "male",
|
|
19
|
+
birthDate: 15,
|
|
20
|
+
birthMonth: 6,
|
|
21
|
+
birthYear: 1990,
|
|
23
22
|
securityClearanceId: "11111111-1111-1111-1111-111111111111", // RIDER
|
|
24
|
-
primaryPhoneId: null,
|
|
23
|
+
primaryPhoneId: null,
|
|
25
24
|
isActive: true,
|
|
26
25
|
lastLoginAt: null,
|
|
27
26
|
createdAt: now,
|
|
@@ -32,6 +31,10 @@ module.exports = {
|
|
|
32
31
|
lastName: "Passenger",
|
|
33
32
|
email: "jane@passenger.com",
|
|
34
33
|
password: passwordHash,
|
|
34
|
+
gender: "female",
|
|
35
|
+
birthDate: 22,
|
|
36
|
+
birthMonth: 3,
|
|
37
|
+
birthYear: 1995,
|
|
35
38
|
securityClearanceId: "22222222-2222-2222-2222-222222222222", // PASSENGER
|
|
36
39
|
primaryPhoneId: null,
|
|
37
40
|
isActive: true,
|
|
@@ -42,9 +45,12 @@ module.exports = {
|
|
|
42
45
|
id: "aaaaaaa2-aaaa-aaaa-aaaa-aaaaaaaaaaa3",
|
|
43
46
|
firstName: "Alice",
|
|
44
47
|
lastName: "Agent",
|
|
45
|
-
nationalId: nid_2,
|
|
46
48
|
email: "alice@agent.com",
|
|
47
49
|
password: passwordHash,
|
|
50
|
+
gender: "female",
|
|
51
|
+
birthDate: 10,
|
|
52
|
+
birthMonth: 8,
|
|
53
|
+
birthYear: 1988,
|
|
48
54
|
securityClearanceId: "33333333-3333-3333-3333-333333333333", // AGENT
|
|
49
55
|
primaryPhoneId: null,
|
|
50
56
|
isActive: true,
|
|
@@ -55,9 +61,12 @@ module.exports = {
|
|
|
55
61
|
id: "aaaaaaa3-aaaa-aaaa-aaaa-aaaaaaaaaaa4",
|
|
56
62
|
firstName: "Eric",
|
|
57
63
|
lastName: "Admin",
|
|
58
|
-
nationalId: nid_3,
|
|
59
64
|
email: "eric@admin.com",
|
|
60
65
|
password: passwordHash,
|
|
66
|
+
gender: "male",
|
|
67
|
+
birthDate: 5,
|
|
68
|
+
birthMonth: 12,
|
|
69
|
+
birthYear: 1985,
|
|
61
70
|
securityClearanceId: "44444444-4444-4444-4444-444444444444", // ADMIN
|
|
62
71
|
primaryPhoneId: null,
|
|
63
72
|
isActive: true,
|
|
@@ -70,7 +79,10 @@ module.exports = {
|
|
|
70
79
|
lastName: "Admin",
|
|
71
80
|
email: "super@admin.com",
|
|
72
81
|
password: passwordHash,
|
|
73
|
-
|
|
82
|
+
gender: "male",
|
|
83
|
+
birthDate: 1,
|
|
84
|
+
birthMonth: 1,
|
|
85
|
+
birthYear: 1980,
|
|
74
86
|
securityClearanceId: "55555555-5555-5555-5555-555555555555", // SUPER_ADMIN
|
|
75
87
|
primaryPhoneId: null,
|
|
76
88
|
isActive: true,
|