vr-migrations 1.0.18 → 1.0.19
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.
|
@@ -10,20 +10,10 @@ module.exports = {
|
|
|
10
10
|
primaryKey: true,
|
|
11
11
|
allowNull: false,
|
|
12
12
|
},
|
|
13
|
-
|
|
14
13
|
firstName: {
|
|
15
14
|
type: Sequelize.STRING(100),
|
|
16
15
|
allowNull: false,
|
|
17
16
|
},
|
|
18
|
-
securityClearanceId: {
|
|
19
|
-
type: Sequelize.UUID,
|
|
20
|
-
allowNull: false,
|
|
21
|
-
references: {
|
|
22
|
-
model: "security_clearances",
|
|
23
|
-
key: "id",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
|
|
27
17
|
lastName: {
|
|
28
18
|
type: Sequelize.STRING(100),
|
|
29
19
|
allowNull: false,
|
|
@@ -55,6 +45,10 @@ module.exports = {
|
|
|
55
45
|
securityClearanceId: {
|
|
56
46
|
type: Sequelize.UUID,
|
|
57
47
|
allowNull: false,
|
|
48
|
+
references: {
|
|
49
|
+
model: "security_clearances",
|
|
50
|
+
key: "id",
|
|
51
|
+
},
|
|
58
52
|
},
|
|
59
53
|
plateNumber: {
|
|
60
54
|
type: Sequelize.STRING(100),
|
|
@@ -128,8 +122,5 @@ module.exports = {
|
|
|
128
122
|
|
|
129
123
|
async down(queryInterface) {
|
|
130
124
|
await queryInterface.dropTable("users");
|
|
131
|
-
await queryInterface.sequelize.query(
|
|
132
|
-
'DROP TYPE IF EXISTS "enum_users_role";'
|
|
133
|
-
);
|
|
134
125
|
},
|
|
135
126
|
};
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
// Create ENUM type first (if not exists)
|
|
6
|
+
await queryInterface.sequelize
|
|
7
|
+
.query(
|
|
8
|
+
`CREATE TYPE "enum_bans_appealStatus" AS ENUM ('pending', 'approved', 'rejected');`
|
|
9
|
+
)
|
|
10
|
+
.catch(() => {}); // Ignore if already exists
|
|
11
|
+
|
|
5
12
|
await queryInterface.createTable("bans", {
|
|
6
13
|
id: {
|
|
7
14
|
type: Sequelize.UUID,
|
|
@@ -11,7 +18,7 @@ module.exports = {
|
|
|
11
18
|
},
|
|
12
19
|
userId: {
|
|
13
20
|
type: Sequelize.UUID,
|
|
14
|
-
allowNull:
|
|
21
|
+
allowNull: false,
|
|
15
22
|
references: {
|
|
16
23
|
model: "users",
|
|
17
24
|
key: "id",
|
|
@@ -26,6 +33,8 @@ module.exports = {
|
|
|
26
33
|
model: "users",
|
|
27
34
|
key: "id",
|
|
28
35
|
},
|
|
36
|
+
onUpdate: "CASCADE",
|
|
37
|
+
onDelete: "CASCADE",
|
|
29
38
|
},
|
|
30
39
|
reason: {
|
|
31
40
|
type: Sequelize.TEXT,
|
|
@@ -41,11 +50,7 @@ module.exports = {
|
|
|
41
50
|
allowNull: false,
|
|
42
51
|
defaultValue: false,
|
|
43
52
|
},
|
|
44
|
-
|
|
45
|
-
type: Sequelize.BOOLEAN,
|
|
46
|
-
allowNull: false,
|
|
47
|
-
defaultValue: true,
|
|
48
|
-
},
|
|
53
|
+
// REMOVED: isActive - not in model, use revokedAt instead
|
|
49
54
|
appealedAt: {
|
|
50
55
|
type: Sequelize.DATE,
|
|
51
56
|
allowNull: true,
|
|
@@ -69,6 +74,8 @@ module.exports = {
|
|
|
69
74
|
model: "users",
|
|
70
75
|
key: "id",
|
|
71
76
|
},
|
|
77
|
+
onUpdate: "CASCADE",
|
|
78
|
+
onDelete: "SET NULL",
|
|
72
79
|
},
|
|
73
80
|
revocationReason: {
|
|
74
81
|
type: Sequelize.TEXT,
|
|
@@ -77,19 +84,25 @@ module.exports = {
|
|
|
77
84
|
createdAt: {
|
|
78
85
|
allowNull: false,
|
|
79
86
|
type: Sequelize.DATE,
|
|
87
|
+
defaultValue: Sequelize.NOW,
|
|
80
88
|
},
|
|
81
89
|
updatedAt: {
|
|
82
90
|
allowNull: false,
|
|
83
91
|
type: Sequelize.DATE,
|
|
92
|
+
defaultValue: Sequelize.NOW,
|
|
84
93
|
},
|
|
85
94
|
});
|
|
86
95
|
|
|
87
96
|
await queryInterface.addIndex("bans", ["userId"]);
|
|
88
|
-
await queryInterface.addIndex("bans", ["isActive"]);
|
|
89
97
|
await queryInterface.addIndex("bans", ["isPermanent"]);
|
|
98
|
+
await queryInterface.addIndex("bans", ["revokedAt"]);
|
|
99
|
+
await queryInterface.addIndex("bans", ["appealStatus"]);
|
|
90
100
|
},
|
|
91
101
|
|
|
92
102
|
down: async (queryInterface) => {
|
|
93
103
|
await queryInterface.dropTable("bans");
|
|
104
|
+
await queryInterface.sequelize
|
|
105
|
+
.query('DROP TYPE IF EXISTS "enum_bans_appealStatus";')
|
|
106
|
+
.catch(() => {});
|
|
94
107
|
},
|
|
95
108
|
};
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
// Create ENUM types first (if not exists)
|
|
6
|
+
await queryInterface.sequelize
|
|
7
|
+
.query(
|
|
8
|
+
`CREATE TYPE "enum_suspensions_appealStatus" AS ENUM ('pending', 'approved', 'rejected');`
|
|
9
|
+
)
|
|
10
|
+
.catch(() => {}); // Ignore if already exists
|
|
11
|
+
|
|
5
12
|
await queryInterface.createTable("suspensions", {
|
|
6
13
|
id: {
|
|
7
14
|
type: Sequelize.UUID,
|
|
@@ -11,7 +18,7 @@ module.exports = {
|
|
|
11
18
|
},
|
|
12
19
|
userId: {
|
|
13
20
|
type: Sequelize.UUID,
|
|
14
|
-
allowNull:
|
|
21
|
+
allowNull: false,
|
|
15
22
|
references: {
|
|
16
23
|
model: "users",
|
|
17
24
|
key: "id",
|
|
@@ -26,6 +33,8 @@ module.exports = {
|
|
|
26
33
|
model: "users",
|
|
27
34
|
key: "id",
|
|
28
35
|
},
|
|
36
|
+
onUpdate: "CASCADE",
|
|
37
|
+
onDelete: "CASCADE",
|
|
29
38
|
},
|
|
30
39
|
reason: {
|
|
31
40
|
type: Sequelize.TEXT,
|
|
@@ -68,6 +77,8 @@ module.exports = {
|
|
|
68
77
|
model: "users",
|
|
69
78
|
key: "id",
|
|
70
79
|
},
|
|
80
|
+
onUpdate: "CASCADE",
|
|
81
|
+
onDelete: "SET NULL",
|
|
71
82
|
},
|
|
72
83
|
revocationReason: {
|
|
73
84
|
type: Sequelize.TEXT,
|
|
@@ -76,19 +87,26 @@ module.exports = {
|
|
|
76
87
|
createdAt: {
|
|
77
88
|
allowNull: false,
|
|
78
89
|
type: Sequelize.DATE,
|
|
90
|
+
defaultValue: Sequelize.NOW,
|
|
79
91
|
},
|
|
80
92
|
updatedAt: {
|
|
81
93
|
allowNull: false,
|
|
82
94
|
type: Sequelize.DATE,
|
|
95
|
+
defaultValue: Sequelize.NOW,
|
|
83
96
|
},
|
|
84
97
|
});
|
|
85
98
|
|
|
86
99
|
await queryInterface.addIndex("suspensions", ["userId"]);
|
|
87
100
|
await queryInterface.addIndex("suspensions", ["isActive"]);
|
|
88
101
|
await queryInterface.addIndex("suspensions", ["endsAt"]);
|
|
102
|
+
await queryInterface.addIndex("suspensions", ["revokedAt"]);
|
|
103
|
+
await queryInterface.addIndex("suspensions", ["appealStatus"]);
|
|
89
104
|
},
|
|
90
105
|
|
|
91
106
|
down: async (queryInterface) => {
|
|
92
107
|
await queryInterface.dropTable("suspensions");
|
|
108
|
+
await queryInterface.sequelize
|
|
109
|
+
.query('DROP TYPE IF EXISTS "enum_suspensions_appealStatus";')
|
|
110
|
+
.catch(() => {});
|
|
93
111
|
},
|
|
94
112
|
};
|