@hedhog/admin 0.0.81 → 0.0.83
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__migrations/migrate-01.d.ts +6 -0
- package/dist/__migrations/migrate-01.d.ts.map +1 -0
- package/dist/__migrations/migrate-01.js +80 -0
- package/dist/__migrations/migrate-01.js.map +1 -0
- package/dist/__migrations/migrate-02.d.ts +6 -0
- package/dist/__migrations/migrate-02.d.ts.map +1 -0
- package/dist/__migrations/migrate-02.js +68 -0
- package/dist/__migrations/migrate-02.js.map +1 -0
- package/dist/__migrations/migrate-03.d.ts +6 -0
- package/dist/__migrations/migrate-03.d.ts.map +1 -0
- package/dist/__migrations/migrate-03.js +90 -0
- package/dist/__migrations/migrate-03.js.map +1 -0
- package/dist/__migrations/migrate-04.d.ts +6 -0
- package/dist/__migrations/migrate-04.d.ts.map +1 -0
- package/dist/__migrations/migrate-04.js +63 -0
- package/dist/__migrations/migrate-04.js.map +1 -0
- package/dist/__migrations/migrate-05.d.ts +6 -0
- package/dist/__migrations/migrate-05.d.ts.map +1 -0
- package/dist/__migrations/migrate-05.js +100 -0
- package/dist/__migrations/migrate-05.js.map +1 -0
- package/dist/__migrations/migrate-06.d.ts +6 -0
- package/dist/__migrations/migrate-06.d.ts.map +1 -0
- package/dist/__migrations/migrate-06.js +37 -0
- package/dist/__migrations/migrate-06.js.map +1 -0
- package/dist/__migrations/migrate-07.d.ts +6 -0
- package/dist/__migrations/migrate-07.d.ts.map +1 -0
- package/dist/__migrations/migrate-07.js +59 -0
- package/dist/__migrations/migrate-07.js.map +1 -0
- package/dist/__migrations/migrate-08.d.ts +6 -0
- package/dist/__migrations/migrate-08.d.ts.map +1 -0
- package/dist/__migrations/migrate-08.js +39 -0
- package/dist/__migrations/migrate-08.js.map +1 -0
- package/dist/__migrations/migrate-09.d.ts +6 -0
- package/dist/__migrations/migrate-09.d.ts.map +1 -0
- package/dist/__migrations/migrate-09.js +39 -0
- package/dist/__migrations/migrate-09.js.map +1 -0
- package/dist/__migrations/migrate-10.d.ts +6 -0
- package/dist/__migrations/migrate-10.d.ts.map +1 -0
- package/dist/__migrations/migrate-10.js +39 -0
- package/dist/__migrations/migrate-10.js.map +1 -0
- package/dist/__migrations/migrate-11.d.ts +6 -0
- package/dist/__migrations/migrate-11.d.ts.map +1 -0
- package/dist/__migrations/migrate-11.js +39 -0
- package/dist/__migrations/migrate-11.js.map +1 -0
- package/dist/__migrations/migrate-12.d.ts +6 -0
- package/dist/__migrations/migrate-12.d.ts.map +1 -0
- package/dist/__migrations/migrate-12.js +39 -0
- package/dist/__migrations/migrate-12.js.map +1 -0
- package/dist/__migrations/migrate-13.d.ts +6 -0
- package/dist/__migrations/migrate-13.d.ts.map +1 -0
- package/dist/__migrations/migrate-13.js +30 -0
- package/dist/__migrations/migrate-13.js.map +1 -0
- package/dist/__migrations/migrate-14.d.ts +6 -0
- package/dist/__migrations/migrate-14.d.ts.map +1 -0
- package/dist/__migrations/migrate-14.js +83 -0
- package/dist/__migrations/migrate-14.js.map +1 -0
- package/dist/__migrations/migrate-15.d.ts +6 -0
- package/dist/__migrations/migrate-15.d.ts.map +1 -0
- package/dist/__migrations/migrate-15.js +25 -0
- package/dist/__migrations/migrate-15.js.map +1 -0
- package/dist/__migrations/migrate-16.d.ts +6 -0
- package/dist/__migrations/migrate-16.d.ts.map +1 -0
- package/dist/__migrations/migrate-16.js +61 -0
- package/dist/__migrations/migrate-16.js.map +1 -0
- package/dist/__migrations/migrate-17.d.ts +6 -0
- package/dist/__migrations/migrate-17.d.ts.map +1 -0
- package/dist/__migrations/migrate-17.js +31 -0
- package/dist/__migrations/migrate-17.js.map +1 -0
- package/dist/__migrations/migrate-18.d.ts +6 -0
- package/dist/__migrations/migrate-18.d.ts.map +1 -0
- package/dist/__migrations/migrate-18.js +41 -0
- package/dist/__migrations/migrate-18.js.map +1 -0
- package/dist/__migrations/migrate-19.d.ts +6 -0
- package/dist/__migrations/migrate-19.d.ts.map +1 -0
- package/dist/__migrations/migrate-19.js +175 -0
- package/dist/__migrations/migrate-19.js.map +1 -0
- package/dist/__migrations/migrate-20.d.ts +6 -0
- package/dist/__migrations/migrate-20.d.ts.map +1 -0
- package/dist/__migrations/migrate-20.js +310 -0
- package/dist/__migrations/migrate-20.js.map +1 -0
- package/hedhog.yaml +487 -0
- package/package.json +1 -1
- package/src/migrations/migrate-01.ts +0 -86
- package/src/migrations/migrate-02.ts +0 -77
- package/src/migrations/migrate-03.ts +0 -102
- package/src/migrations/migrate-04.ts +0 -71
- package/src/migrations/migrate-05.ts +0 -119
- package/src/migrations/migrate-06.ts +0 -37
- package/src/migrations/migrate-07.ts +0 -66
- package/src/migrations/migrate-08.ts +0 -44
- package/src/migrations/migrate-09.ts +0 -44
- package/src/migrations/migrate-10.ts +0 -44
- package/src/migrations/migrate-11.ts +0 -45
- package/src/migrations/migrate-12.ts +0 -44
- package/src/migrations/migrate-13.ts +0 -28
- package/src/migrations/migrate-14.ts +0 -81
- package/src/migrations/migrate-15.ts +0 -23
- package/src/migrations/migrate-16.ts +0 -59
- package/src/migrations/migrate-17.ts +0 -29
- package/src/migrations/migrate-18.ts +0 -39
- package/src/migrations/migrate-19.ts +0 -186
- package/src/migrations/migrate-20.ts +0 -308
@@ -1,102 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
MigrationInterface,
|
3
|
-
QueryRunner,
|
4
|
-
Table,
|
5
|
-
TableForeignKey,
|
6
|
-
} from 'typeorm';
|
7
|
-
import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'multifactors',
|
14
|
-
columns: [
|
15
|
-
idColumn(),
|
16
|
-
{
|
17
|
-
name: 'slug',
|
18
|
-
type: 'varchar',
|
19
|
-
isUnique: true,
|
20
|
-
},
|
21
|
-
timestampColumn(),
|
22
|
-
timestampColumn('updated_at'),
|
23
|
-
],
|
24
|
-
}),
|
25
|
-
true,
|
26
|
-
);
|
27
|
-
|
28
|
-
await queryRunner.createTable(
|
29
|
-
new Table({
|
30
|
-
name: 'multifactor_translations',
|
31
|
-
columns: [
|
32
|
-
foreignColumn({ name: 'multifactor_id', isPrimary: true }),
|
33
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
34
|
-
{
|
35
|
-
name: 'name',
|
36
|
-
type: 'varchar',
|
37
|
-
},
|
38
|
-
timestampColumn(),
|
39
|
-
timestampColumn('updated_at'),
|
40
|
-
],
|
41
|
-
foreignKeys: [
|
42
|
-
new TableForeignKey({
|
43
|
-
columnNames: ['multifactor_id'],
|
44
|
-
referencedTableName: 'multifactors',
|
45
|
-
referencedColumnNames: ['id'],
|
46
|
-
onDelete: 'CASCADE',
|
47
|
-
}),
|
48
|
-
new TableForeignKey({
|
49
|
-
columnNames: ['locale_id'],
|
50
|
-
referencedTableName: 'locales',
|
51
|
-
referencedColumnNames: ['id'],
|
52
|
-
onDelete: 'CASCADE',
|
53
|
-
}),
|
54
|
-
],
|
55
|
-
}),
|
56
|
-
true,
|
57
|
-
);
|
58
|
-
|
59
|
-
await queryRunner.createTable(
|
60
|
-
new Table({
|
61
|
-
name: 'users',
|
62
|
-
columns: [
|
63
|
-
idColumn(),
|
64
|
-
foreignColumn({ name: 'multifactor_id', isNullable: true }),
|
65
|
-
{
|
66
|
-
name: 'name',
|
67
|
-
type: 'varchar',
|
68
|
-
},
|
69
|
-
{
|
70
|
-
name: 'email',
|
71
|
-
type: 'varchar',
|
72
|
-
},
|
73
|
-
{
|
74
|
-
name: 'password',
|
75
|
-
type: 'varchar',
|
76
|
-
},
|
77
|
-
{
|
78
|
-
name: 'code',
|
79
|
-
type: 'varchar',
|
80
|
-
isNullable: true,
|
81
|
-
},
|
82
|
-
timestampColumn(),
|
83
|
-
timestampColumn('updated_at'),
|
84
|
-
],
|
85
|
-
}),
|
86
|
-
);
|
87
|
-
|
88
|
-
await queryRunner.createForeignKeys('users', [
|
89
|
-
new TableForeignKey({
|
90
|
-
columnNames: ['multifactor_id'],
|
91
|
-
referencedColumnNames: ['id'],
|
92
|
-
referencedTableName: 'multifactors',
|
93
|
-
name: 'fk_users_to_multifactors_on_multifactor_id',
|
94
|
-
onDelete: 'Cascade',
|
95
|
-
}),
|
96
|
-
]);
|
97
|
-
}
|
98
|
-
async down(queryRunner: QueryRunner) {
|
99
|
-
await queryRunner.dropTable('multifactors');
|
100
|
-
await queryRunner.dropTable('users');
|
101
|
-
}
|
102
|
-
}
|
@@ -1,71 +0,0 @@
|
|
1
|
-
import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
|
3
|
-
import {
|
4
|
-
MigrationInterface,
|
5
|
-
QueryRunner,
|
6
|
-
Table,
|
7
|
-
TableForeignKey,
|
8
|
-
} from 'typeorm';
|
9
|
-
|
10
|
-
export class Migrate implements MigrationInterface {
|
11
|
-
async up(queryRunner: QueryRunner) {
|
12
|
-
await queryRunner.createTable(
|
13
|
-
new Table({
|
14
|
-
name: 'screens',
|
15
|
-
columns: [
|
16
|
-
idColumn(),
|
17
|
-
{
|
18
|
-
name: 'slug',
|
19
|
-
type: 'varchar',
|
20
|
-
isUnique: true,
|
21
|
-
},
|
22
|
-
{
|
23
|
-
name: 'icon',
|
24
|
-
type: 'varchar',
|
25
|
-
isNullable: true,
|
26
|
-
},
|
27
|
-
timestampColumn(),
|
28
|
-
timestampColumn('updated_at'),
|
29
|
-
],
|
30
|
-
}),
|
31
|
-
);
|
32
|
-
|
33
|
-
await queryRunner.createTable(
|
34
|
-
new Table({
|
35
|
-
name: 'screen_translations',
|
36
|
-
columns: [
|
37
|
-
foreignColumn({ name: 'screen_id', isPrimary: true }),
|
38
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
39
|
-
{
|
40
|
-
name: 'name',
|
41
|
-
type: 'varchar',
|
42
|
-
},
|
43
|
-
{
|
44
|
-
name: 'description',
|
45
|
-
type: 'varchar',
|
46
|
-
},
|
47
|
-
timestampColumn(),
|
48
|
-
timestampColumn('updated_at'),
|
49
|
-
],
|
50
|
-
foreignKeys: [
|
51
|
-
new TableForeignKey({
|
52
|
-
columnNames: ['screen_id'],
|
53
|
-
referencedTableName: 'screens',
|
54
|
-
referencedColumnNames: ['id'],
|
55
|
-
onDelete: 'CASCADE',
|
56
|
-
}),
|
57
|
-
new TableForeignKey({
|
58
|
-
columnNames: ['locale_id'],
|
59
|
-
referencedTableName: 'locales',
|
60
|
-
referencedColumnNames: ['id'],
|
61
|
-
onDelete: 'CASCADE',
|
62
|
-
}),
|
63
|
-
],
|
64
|
-
}),
|
65
|
-
);
|
66
|
-
}
|
67
|
-
|
68
|
-
async down(queryRunner: QueryRunner) {
|
69
|
-
await queryRunner.dropTable('screens');
|
70
|
-
}
|
71
|
-
}
|
@@ -1,119 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
MigrationInterface,
|
3
|
-
QueryRunner,
|
4
|
-
Table,
|
5
|
-
TableForeignKey,
|
6
|
-
} from 'typeorm';
|
7
|
-
import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
|
8
|
-
import { Menu } from '../entities';
|
9
|
-
|
10
|
-
export class Migrate implements MigrationInterface {
|
11
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
12
|
-
await queryRunner.createTable(
|
13
|
-
new Table({
|
14
|
-
name: 'menus',
|
15
|
-
columns: [
|
16
|
-
idColumn(),
|
17
|
-
foreignColumn({ name: 'menu_id', isNullable: true }),
|
18
|
-
{
|
19
|
-
name: 'slug',
|
20
|
-
type: 'varchar',
|
21
|
-
isUnique: true,
|
22
|
-
},
|
23
|
-
{
|
24
|
-
name: 'url',
|
25
|
-
type: 'varchar',
|
26
|
-
isNullable: true,
|
27
|
-
},
|
28
|
-
{
|
29
|
-
name: 'order',
|
30
|
-
type: 'int',
|
31
|
-
default: 0,
|
32
|
-
unsigned: true,
|
33
|
-
},
|
34
|
-
{
|
35
|
-
name: 'icon',
|
36
|
-
type: 'varchar',
|
37
|
-
isNullable: true,
|
38
|
-
},
|
39
|
-
timestampColumn(),
|
40
|
-
timestampColumn('updated_at'),
|
41
|
-
],
|
42
|
-
indices: [{ columnNames: ['slug'], isUnique: true }],
|
43
|
-
foreignKeys: [
|
44
|
-
{
|
45
|
-
columnNames: ['menu_id'],
|
46
|
-
referencedColumnNames: ['id'],
|
47
|
-
referencedTableName: 'menus',
|
48
|
-
onDelete: 'CASCADE',
|
49
|
-
},
|
50
|
-
],
|
51
|
-
}),
|
52
|
-
);
|
53
|
-
|
54
|
-
await queryRunner.createTable(
|
55
|
-
new Table({
|
56
|
-
name: 'menu_translations',
|
57
|
-
columns: [
|
58
|
-
foreignColumn({ name: 'menu_id', isPrimary: true }),
|
59
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
60
|
-
{
|
61
|
-
name: 'name',
|
62
|
-
type: 'varchar',
|
63
|
-
},
|
64
|
-
timestampColumn(),
|
65
|
-
timestampColumn('updated_at'),
|
66
|
-
],
|
67
|
-
foreignKeys: [
|
68
|
-
new TableForeignKey({
|
69
|
-
columnNames: ['menu_id'],
|
70
|
-
referencedColumnNames: ['id'],
|
71
|
-
referencedTableName: 'menus',
|
72
|
-
onDelete: 'CASCADE',
|
73
|
-
}),
|
74
|
-
new TableForeignKey({
|
75
|
-
columnNames: ['locale_id'],
|
76
|
-
referencedColumnNames: ['id'],
|
77
|
-
referencedTableName: 'locales',
|
78
|
-
onDelete: 'CASCADE',
|
79
|
-
}),
|
80
|
-
],
|
81
|
-
}),
|
82
|
-
);
|
83
|
-
|
84
|
-
await queryRunner.createTable(
|
85
|
-
new Table({
|
86
|
-
name: 'menu_screens',
|
87
|
-
columns: [
|
88
|
-
foreignColumn({ name: 'menu_id', isPrimary: true }),
|
89
|
-
foreignColumn({ name: 'screen_id', isPrimary: true }),
|
90
|
-
],
|
91
|
-
}),
|
92
|
-
);
|
93
|
-
|
94
|
-
await queryRunner.createForeignKey(
|
95
|
-
'menu_screens',
|
96
|
-
new TableForeignKey({
|
97
|
-
columnNames: ['menu_id'],
|
98
|
-
referencedColumnNames: ['id'],
|
99
|
-
referencedTableName: 'menus',
|
100
|
-
onDelete: 'CASCADE',
|
101
|
-
}),
|
102
|
-
);
|
103
|
-
|
104
|
-
await queryRunner.createForeignKey(
|
105
|
-
'menu_screens',
|
106
|
-
new TableForeignKey({
|
107
|
-
columnNames: ['screen_id'],
|
108
|
-
referencedColumnNames: ['id'],
|
109
|
-
referencedTableName: 'screens',
|
110
|
-
onDelete: 'CASCADE',
|
111
|
-
}),
|
112
|
-
);
|
113
|
-
}
|
114
|
-
|
115
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
116
|
-
await queryRunner.dropTable('menu_screens');
|
117
|
-
await queryRunner.dropTable('menus');
|
118
|
-
}
|
119
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { idColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
|
3
|
-
import { MigrationInterface, QueryRunner, Table, TableUnique } from 'typeorm';
|
4
|
-
import { Menu } from '../entities';
|
5
|
-
|
6
|
-
export class Migrate implements MigrationInterface {
|
7
|
-
async up(queryRunner: QueryRunner) {
|
8
|
-
await queryRunner.createTable(
|
9
|
-
new Table({
|
10
|
-
name: 'routes',
|
11
|
-
columns: [
|
12
|
-
idColumn(),
|
13
|
-
{
|
14
|
-
name: 'url',
|
15
|
-
type: 'varchar',
|
16
|
-
},
|
17
|
-
{
|
18
|
-
name: 'method',
|
19
|
-
type: 'enum',
|
20
|
-
enum: ['GET', 'POST', 'PATCH', 'DELETE', 'PUT', 'OPTIONS', 'HEAD'],
|
21
|
-
},
|
22
|
-
timestampColumn(),
|
23
|
-
timestampColumn('updated_at'),
|
24
|
-
],
|
25
|
-
indices: [
|
26
|
-
{
|
27
|
-
columnNames: ['url', 'method'],
|
28
|
-
isUnique: true,
|
29
|
-
},
|
30
|
-
],
|
31
|
-
}),
|
32
|
-
);
|
33
|
-
}
|
34
|
-
async down(queryRunner: QueryRunner) {
|
35
|
-
await queryRunner.dropTable('routes');
|
36
|
-
}
|
37
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
3
|
-
MigrationInterface,
|
4
|
-
QueryRunner,
|
5
|
-
Table,
|
6
|
-
TableForeignKey,
|
7
|
-
} from 'typeorm';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'roles',
|
14
|
-
columns: [
|
15
|
-
idColumn(),
|
16
|
-
{
|
17
|
-
name: 'slug',
|
18
|
-
type: 'varchar',
|
19
|
-
isUnique: true,
|
20
|
-
},
|
21
|
-
timestampColumn(),
|
22
|
-
timestampColumn('updated_at'),
|
23
|
-
],
|
24
|
-
}),
|
25
|
-
);
|
26
|
-
|
27
|
-
await queryRunner.createTable(
|
28
|
-
new Table({
|
29
|
-
name: 'role_translations',
|
30
|
-
columns: [
|
31
|
-
foreignColumn({ name: 'role_id', isPrimary: true }),
|
32
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
33
|
-
{
|
34
|
-
name: 'name',
|
35
|
-
type: 'varchar',
|
36
|
-
isNullable: false,
|
37
|
-
},
|
38
|
-
{
|
39
|
-
name: 'description',
|
40
|
-
type: 'varchar',
|
41
|
-
},
|
42
|
-
timestampColumn(),
|
43
|
-
timestampColumn('updated_at'),
|
44
|
-
],
|
45
|
-
foreignKeys: [
|
46
|
-
new TableForeignKey({
|
47
|
-
columnNames: ['role_id'],
|
48
|
-
referencedTableName: 'roles',
|
49
|
-
referencedColumnNames: ['id'],
|
50
|
-
onDelete: 'CASCADE',
|
51
|
-
}),
|
52
|
-
new TableForeignKey({
|
53
|
-
columnNames: ['locale_id'],
|
54
|
-
referencedTableName: 'locales',
|
55
|
-
referencedColumnNames: ['id'],
|
56
|
-
onDelete: 'CASCADE',
|
57
|
-
}),
|
58
|
-
],
|
59
|
-
}),
|
60
|
-
);
|
61
|
-
}
|
62
|
-
|
63
|
-
async down(queryRunner: QueryRunner) {
|
64
|
-
await queryRunner.dropTable('roles');
|
65
|
-
}
|
66
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { foreignColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
3
|
-
MigrationInterface,
|
4
|
-
QueryRunner,
|
5
|
-
Table,
|
6
|
-
TableForeignKey,
|
7
|
-
} from 'typeorm';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'role_menus',
|
14
|
-
columns: [
|
15
|
-
foreignColumn({ name: 'role_id', isPrimary: true }),
|
16
|
-
foreignColumn({ name: 'menu_id', isPrimary: true }),
|
17
|
-
timestampColumn(),
|
18
|
-
timestampColumn('updated_at'),
|
19
|
-
],
|
20
|
-
}),
|
21
|
-
);
|
22
|
-
|
23
|
-
await queryRunner.createForeignKeys('role_menus', [
|
24
|
-
new TableForeignKey({
|
25
|
-
columnNames: ['role_id'],
|
26
|
-
referencedColumnNames: ['id'],
|
27
|
-
referencedTableName: 'roles',
|
28
|
-
onDelete: 'CASCADE',
|
29
|
-
name: 'fk_role_menus_roles',
|
30
|
-
}),
|
31
|
-
new TableForeignKey({
|
32
|
-
columnNames: ['menu_id'],
|
33
|
-
referencedColumnNames: ['id'],
|
34
|
-
referencedTableName: 'menus',
|
35
|
-
onDelete: 'CASCADE',
|
36
|
-
name: 'fk_role_menus_menus',
|
37
|
-
}),
|
38
|
-
]);
|
39
|
-
}
|
40
|
-
|
41
|
-
async down(queryRunner: QueryRunner) {
|
42
|
-
await queryRunner.dropTable('role_menus');
|
43
|
-
}
|
44
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { foreignColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
3
|
-
MigrationInterface,
|
4
|
-
QueryRunner,
|
5
|
-
Table,
|
6
|
-
TableForeignKey,
|
7
|
-
} from 'typeorm';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'route_screens',
|
14
|
-
columns: [
|
15
|
-
foreignColumn({ name: 'route_id', isPrimary: true }),
|
16
|
-
foreignColumn({ name: 'screen_id', isPrimary: true }),
|
17
|
-
timestampColumn(),
|
18
|
-
timestampColumn('updated_at'),
|
19
|
-
],
|
20
|
-
}),
|
21
|
-
);
|
22
|
-
|
23
|
-
await queryRunner.createForeignKeys('route_screens', [
|
24
|
-
new TableForeignKey({
|
25
|
-
columnNames: ['route_id'],
|
26
|
-
referencedColumnNames: ['id'],
|
27
|
-
referencedTableName: 'routes',
|
28
|
-
onDelete: 'CASCADE',
|
29
|
-
name: 'fk_route_screens_routes',
|
30
|
-
}),
|
31
|
-
new TableForeignKey({
|
32
|
-
columnNames: ['screen_id'],
|
33
|
-
referencedColumnNames: ['id'],
|
34
|
-
referencedTableName: 'screens',
|
35
|
-
onDelete: 'CASCADE',
|
36
|
-
name: 'fk_route_screens_screens',
|
37
|
-
}),
|
38
|
-
]);
|
39
|
-
}
|
40
|
-
|
41
|
-
async down(queryRunner: QueryRunner) {
|
42
|
-
await queryRunner.dropTable('route_screens');
|
43
|
-
}
|
44
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { foreignColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
3
|
-
MigrationInterface,
|
4
|
-
QueryRunner,
|
5
|
-
Table,
|
6
|
-
TableForeignKey,
|
7
|
-
} from 'typeorm';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'role_screens',
|
14
|
-
columns: [
|
15
|
-
foreignColumn({ name: 'role_id', isPrimary: true }),
|
16
|
-
foreignColumn({ name: 'screen_id', isPrimary: true }),
|
17
|
-
timestampColumn(),
|
18
|
-
timestampColumn('updated_at'),
|
19
|
-
],
|
20
|
-
}),
|
21
|
-
);
|
22
|
-
|
23
|
-
await queryRunner.createForeignKeys('role_screens', [
|
24
|
-
new TableForeignKey({
|
25
|
-
columnNames: ['role_id'],
|
26
|
-
referencedColumnNames: ['id'],
|
27
|
-
referencedTableName: 'roles',
|
28
|
-
onDelete: 'CASCADE',
|
29
|
-
name: 'fk_role_screens_roles',
|
30
|
-
}),
|
31
|
-
new TableForeignKey({
|
32
|
-
columnNames: ['screen_id'],
|
33
|
-
referencedColumnNames: ['id'],
|
34
|
-
referencedTableName: 'screens',
|
35
|
-
onDelete: 'CASCADE',
|
36
|
-
name: 'fk_role_screens_screens',
|
37
|
-
}),
|
38
|
-
]);
|
39
|
-
}
|
40
|
-
|
41
|
-
async down(queryRunner: QueryRunner) {
|
42
|
-
await queryRunner.dropTable('role_screens');
|
43
|
-
}
|
44
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { foreignColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
3
|
-
MigrationInterface,
|
4
|
-
QueryRunner,
|
5
|
-
Table,
|
6
|
-
TableForeignKey,
|
7
|
-
} from 'typeorm';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'role_users',
|
14
|
-
columns: [
|
15
|
-
foreignColumn({ name: 'role_id', isPrimary: true }),
|
16
|
-
foreignColumn({ name: 'user_id', isPrimary: true }),
|
17
|
-
timestampColumn(),
|
18
|
-
timestampColumn('updated_at'),
|
19
|
-
],
|
20
|
-
}),
|
21
|
-
);
|
22
|
-
|
23
|
-
await queryRunner.createForeignKeys('role_users', [
|
24
|
-
new TableForeignKey({
|
25
|
-
columnNames: ['role_id'],
|
26
|
-
referencedColumnNames: ['id'],
|
27
|
-
referencedTableName: 'roles',
|
28
|
-
onDelete: 'CASCADE',
|
29
|
-
name: 'fk_role_users_roles',
|
30
|
-
}),
|
31
|
-
|
32
|
-
new TableForeignKey({
|
33
|
-
columnNames: ['user_id'],
|
34
|
-
referencedColumnNames: ['id'],
|
35
|
-
referencedTableName: 'users',
|
36
|
-
onDelete: 'CASCADE',
|
37
|
-
name: 'fk_role_users_users',
|
38
|
-
}),
|
39
|
-
]);
|
40
|
-
}
|
41
|
-
|
42
|
-
async down(queryRunner: QueryRunner) {
|
43
|
-
await queryRunner.dropTable('role_users');
|
44
|
-
}
|
45
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { foreignColumn, timestampColumn } from '@hedhog/utils';
|
2
|
-
import {
|
3
|
-
MigrationInterface,
|
4
|
-
QueryRunner,
|
5
|
-
Table,
|
6
|
-
TableForeignKey,
|
7
|
-
} from 'typeorm';
|
8
|
-
|
9
|
-
export class Migrate implements MigrationInterface {
|
10
|
-
async up(queryRunner: QueryRunner) {
|
11
|
-
await queryRunner.createTable(
|
12
|
-
new Table({
|
13
|
-
name: 'role_routes',
|
14
|
-
columns: [
|
15
|
-
foreignColumn({ name: 'role_id', isPrimary: true }),
|
16
|
-
foreignColumn({ name: 'route_id', isPrimary: true }),
|
17
|
-
timestampColumn(),
|
18
|
-
timestampColumn('updated_at'),
|
19
|
-
],
|
20
|
-
}),
|
21
|
-
);
|
22
|
-
|
23
|
-
await queryRunner.createForeignKeys('role_routes', [
|
24
|
-
new TableForeignKey({
|
25
|
-
columnNames: ['role_id'],
|
26
|
-
referencedColumnNames: ['id'],
|
27
|
-
referencedTableName: 'roles',
|
28
|
-
onDelete: 'CASCADE',
|
29
|
-
name: 'fk_role_routes_roles',
|
30
|
-
}),
|
31
|
-
new TableForeignKey({
|
32
|
-
columnNames: ['route_id'],
|
33
|
-
referencedColumnNames: ['id'],
|
34
|
-
referencedTableName: 'routes',
|
35
|
-
onDelete: 'CASCADE',
|
36
|
-
name: 'fk_role_routes_routes',
|
37
|
-
}),
|
38
|
-
]);
|
39
|
-
}
|
40
|
-
|
41
|
-
async down(queryRunner: QueryRunner) {
|
42
|
-
await queryRunner.dropTable('role_routes');
|
43
|
-
}
|
44
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
|
3
|
-
export class Migrate implements MigrationInterface {
|
4
|
-
async up(queryRunner: QueryRunner) {
|
5
|
-
/*
|
6
|
-
const menus = await queryRunner.manager
|
7
|
-
.createQueryBuilder()
|
8
|
-
.select()
|
9
|
-
.from('menus', 'm')
|
10
|
-
.execute();
|
11
|
-
|
12
|
-
for (const menu of menus) {
|
13
|
-
await queryRunner.manager
|
14
|
-
.createQueryBuilder()
|
15
|
-
.insert()
|
16
|
-
.into('role_menus')
|
17
|
-
.values({
|
18
|
-
role_id: 1,
|
19
|
-
menu_id: menu.id,
|
20
|
-
});
|
21
|
-
}
|
22
|
-
*/
|
23
|
-
}
|
24
|
-
|
25
|
-
async down(queryRunner: QueryRunner) {
|
26
|
-
await queryRunner.manager.delete('role_menus', { role_id: 1 });
|
27
|
-
}
|
28
|
-
}
|