@hedhog/admin 0.0.25 → 0.0.26
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.
- package/package.json +1 -1
- package/src/migrations/migrate-01.ts +63 -2
package/package.json
CHANGED
@@ -12,8 +12,26 @@ export class Migrate implements MigrationInterface {
|
|
12
12
|
await queryRunner.createTable(
|
13
13
|
new Table({
|
14
14
|
name: 'multifactors',
|
15
|
+
columns: [idColumn(), timestampColumn(), timestampColumn('updated_at')],
|
16
|
+
}),
|
17
|
+
true,
|
18
|
+
);
|
19
|
+
|
20
|
+
await queryRunner.createTable(
|
21
|
+
new Table({
|
22
|
+
name: 'multifactor_translations',
|
15
23
|
columns: [
|
16
24
|
idColumn(),
|
25
|
+
{
|
26
|
+
name: 'multifactor_id',
|
27
|
+
type: 'int',
|
28
|
+
unsigned: true,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: 'locale_id',
|
32
|
+
type: 'int',
|
33
|
+
unsigned: true,
|
34
|
+
},
|
17
35
|
{
|
18
36
|
name: 'name',
|
19
37
|
type: 'varchar',
|
@@ -21,19 +39,62 @@ export class Migrate implements MigrationInterface {
|
|
21
39
|
timestampColumn(),
|
22
40
|
timestampColumn('updated_at'),
|
23
41
|
],
|
42
|
+
foreignKeys: [
|
43
|
+
new TableForeignKey({
|
44
|
+
columnNames: ['multifactor_id'],
|
45
|
+
referencedTableName: 'multifactors',
|
46
|
+
referencedColumnNames: ['id'],
|
47
|
+
onDelete: 'CASCADE',
|
48
|
+
}),
|
49
|
+
new TableForeignKey({
|
50
|
+
columnNames: ['locale_id'],
|
51
|
+
referencedTableName: 'locales',
|
52
|
+
referencedColumnNames: ['id'],
|
53
|
+
onDelete: 'CASCADE',
|
54
|
+
}),
|
55
|
+
],
|
24
56
|
}),
|
57
|
+
true,
|
25
58
|
);
|
26
59
|
|
27
60
|
await queryRunner.manager
|
28
61
|
.createQueryBuilder()
|
29
62
|
.insert()
|
30
|
-
.into('multifactors', ['
|
63
|
+
.into('multifactors', ['id'])
|
31
64
|
.values([
|
32
65
|
{
|
66
|
+
id: 1,
|
67
|
+
},
|
68
|
+
{
|
69
|
+
id: 2,
|
70
|
+
},
|
71
|
+
])
|
72
|
+
.execute();
|
73
|
+
|
74
|
+
await queryRunner.manager
|
75
|
+
.createQueryBuilder()
|
76
|
+
.insert()
|
77
|
+
.into('multifactor_translations', ['multifactor_id', 'locale_id', 'name'])
|
78
|
+
.values([
|
79
|
+
{
|
80
|
+
multifactor_id: 1,
|
81
|
+
locale_id: 1,
|
33
82
|
name: 'Email',
|
34
83
|
},
|
35
84
|
{
|
36
|
-
|
85
|
+
multifactor_id: 1,
|
86
|
+
locale_id: 2,
|
87
|
+
name: 'E-mail',
|
88
|
+
},
|
89
|
+
{
|
90
|
+
multifactor_id: 2,
|
91
|
+
locale_id: 1,
|
92
|
+
name: 'Application',
|
93
|
+
},
|
94
|
+
{
|
95
|
+
multifactor_id: 2,
|
96
|
+
locale_id: 1,
|
97
|
+
name: 'Aplicativo',
|
37
98
|
},
|
38
99
|
])
|
39
100
|
.execute();
|