@hedhog/admin 0.0.81 → 0.0.82
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,81 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
|
3
|
-
export class Migrate implements MigrationInterface {
|
4
|
-
async up(queryRunner: QueryRunner) {
|
5
|
-
/*
|
6
|
-
const screenIdScreen = await queryRunner.manager
|
7
|
-
.createQueryBuilder()
|
8
|
-
.select()
|
9
|
-
.from('screens', 's')
|
10
|
-
.where('slug = :slug', { slug: '/management/screens' })
|
11
|
-
.execute();
|
12
|
-
|
13
|
-
const screenIdRole = await queryRunner.manager
|
14
|
-
.createQueryBuilder()
|
15
|
-
.select()
|
16
|
-
.from('screens', 's')
|
17
|
-
.where('slug = :slug', { slug: '/management/roles' })
|
18
|
-
.execute();
|
19
|
-
|
20
|
-
const screenIdUser = await queryRunner.manager
|
21
|
-
.createQueryBuilder()
|
22
|
-
.select()
|
23
|
-
.from('screens', 's')
|
24
|
-
.where('slug = :slug', { slug: '/management/users' })
|
25
|
-
.execute();
|
26
|
-
|
27
|
-
const screenIdMenu = await queryRunner.manager
|
28
|
-
.createQueryBuilder()
|
29
|
-
.select()
|
30
|
-
.from('screens', 's')
|
31
|
-
.where('slug = :slug', { slug: '/management/menus' })
|
32
|
-
.execute();
|
33
|
-
|
34
|
-
const screenIdRoute = await queryRunner.manager
|
35
|
-
.createQueryBuilder()
|
36
|
-
.select()
|
37
|
-
.from('screens', 's')
|
38
|
-
.where('slug = :slug', { slug: '/management/routes' })
|
39
|
-
.execute();
|
40
|
-
|
41
|
-
const screenIdSetting = await queryRunner.manager
|
42
|
-
.createQueryBuilder()
|
43
|
-
.select()
|
44
|
-
.from('screens', 's')
|
45
|
-
.where('slug = :slug', { slug: '/management/settings' })
|
46
|
-
.execute();
|
47
|
-
|
48
|
-
for (const { url, screendId } of [
|
49
|
-
{ url: '/screens%', screendId: screenIdScreen[0].id },
|
50
|
-
{ url: '/roles%', screendId: screenIdRole[0].id },
|
51
|
-
{ url: '/users%', screendId: screenIdUser[0].id },
|
52
|
-
{ url: '/menus%', screendId: screenIdMenu[0].id },
|
53
|
-
{ url: '/routes%', screendId: screenIdRoute[0].id },
|
54
|
-
{ url: '/settings%', screendId: screenIdSetting[0].id },
|
55
|
-
]) {
|
56
|
-
const routesScreens = await queryRunner.manager
|
57
|
-
.createQueryBuilder()
|
58
|
-
.select()
|
59
|
-
.from('routes', 's')
|
60
|
-
.where('s.url LIKE :url', { url })
|
61
|
-
.execute();
|
62
|
-
|
63
|
-
for (const route of routesScreens) {
|
64
|
-
await queryRunner.manager
|
65
|
-
.createQueryBuilder()
|
66
|
-
.insert()
|
67
|
-
.into('route_screens')
|
68
|
-
.values({
|
69
|
-
route_id: route.id,
|
70
|
-
screen_id: screendId,
|
71
|
-
})
|
72
|
-
.execute();
|
73
|
-
}
|
74
|
-
}
|
75
|
-
*/
|
76
|
-
}
|
77
|
-
|
78
|
-
async down(queryRunner: QueryRunner) {
|
79
|
-
await queryRunner.manager.delete('route_screens', {});
|
80
|
-
}
|
81
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
|
3
|
-
export class Migrate implements MigrationInterface {
|
4
|
-
async up(queryRunner: QueryRunner) {
|
5
|
-
/*
|
6
|
-
await queryRunner.manager
|
7
|
-
.createQueryBuilder()
|
8
|
-
.insert()
|
9
|
-
.into('role_users', ['role_id', 'user_id'])
|
10
|
-
.values([
|
11
|
-
{ role_id: 1, user_id: 1 },
|
12
|
-
{ role_id: 2, user_id: 2 },
|
13
|
-
{ role_id: 3, user_id: 2 },
|
14
|
-
])
|
15
|
-
.execute();
|
16
|
-
*/
|
17
|
-
}
|
18
|
-
|
19
|
-
async down(queryRunner: QueryRunner) {
|
20
|
-
await queryRunner.manager.delete('role_users', { role_id: 1 });
|
21
|
-
await queryRunner.manager.delete('role_users', { role_id: 2 });
|
22
|
-
}
|
23
|
-
}
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
|
3
|
-
export class Migrate implements MigrationInterface {
|
4
|
-
async up(queryRunner: QueryRunner) {
|
5
|
-
/*
|
6
|
-
const routes = await queryRunner.manager
|
7
|
-
.createQueryBuilder()
|
8
|
-
.select()
|
9
|
-
.from('routes', 'r')
|
10
|
-
.execute();
|
11
|
-
|
12
|
-
for (const route of routes) {
|
13
|
-
await queryRunner.manager
|
14
|
-
.createQueryBuilder()
|
15
|
-
.insert()
|
16
|
-
.into('role_routes', ['role_id', 'route_id'])
|
17
|
-
.values({
|
18
|
-
role_id: 1,
|
19
|
-
route_id: route.id,
|
20
|
-
})
|
21
|
-
.execute();
|
22
|
-
}
|
23
|
-
|
24
|
-
await queryRunner.manager
|
25
|
-
.createQueryBuilder()
|
26
|
-
.insert()
|
27
|
-
.into('role_routes', ['role_id', 'route_id'])
|
28
|
-
.values({
|
29
|
-
role_id: 2,
|
30
|
-
route_id: 3,
|
31
|
-
})
|
32
|
-
.execute();
|
33
|
-
|
34
|
-
const routesScreens = await queryRunner.manager
|
35
|
-
.createQueryBuilder()
|
36
|
-
.select()
|
37
|
-
.from('routes', 's')
|
38
|
-
.where('s.url LIKE :url', { url: '/screens%' })
|
39
|
-
.execute();
|
40
|
-
|
41
|
-
for (const route of routesScreens) {
|
42
|
-
await queryRunner.manager
|
43
|
-
.createQueryBuilder()
|
44
|
-
.insert()
|
45
|
-
.into('role_routes', ['role_id', 'route_id'])
|
46
|
-
.values({
|
47
|
-
role_id: 2,
|
48
|
-
route_id: route.id,
|
49
|
-
})
|
50
|
-
.execute();
|
51
|
-
}
|
52
|
-
*/
|
53
|
-
}
|
54
|
-
|
55
|
-
async down(queryRunner: QueryRunner) {
|
56
|
-
await queryRunner.manager.delete('role_routes', { role_id: 1 });
|
57
|
-
await queryRunner.manager.delete('role_routes', { role_id: 2 });
|
58
|
-
}
|
59
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
|
3
|
-
export class Migrate implements MigrationInterface {
|
4
|
-
async up(queryRunner: QueryRunner) {
|
5
|
-
/*
|
6
|
-
const screens = await queryRunner.manager
|
7
|
-
.createQueryBuilder()
|
8
|
-
.select()
|
9
|
-
.from('screens', 's')
|
10
|
-
.execute();
|
11
|
-
|
12
|
-
for (const screen of screens) {
|
13
|
-
await queryRunner.manager
|
14
|
-
.createQueryBuilder()
|
15
|
-
.insert()
|
16
|
-
.into('role_screens', ['role_id', 'screen_id'])
|
17
|
-
.values({
|
18
|
-
role_id: 1,
|
19
|
-
screen_id: screen.id,
|
20
|
-
})
|
21
|
-
.execute();
|
22
|
-
}
|
23
|
-
*/
|
24
|
-
}
|
25
|
-
|
26
|
-
async down(queryRunner: QueryRunner) {
|
27
|
-
await queryRunner.manager.delete('role_screens', { role_id: 1 });
|
28
|
-
}
|
29
|
-
}
|
@@ -1,39 +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
|
-
await queryRunner.manager
|
13
|
-
.createQueryBuilder()
|
14
|
-
.insert()
|
15
|
-
.into('role_menus', ['role_id', 'menu_id'])
|
16
|
-
.values(
|
17
|
-
menus.map((menu) => ({
|
18
|
-
role_id: 1,
|
19
|
-
menu_id: menu.id,
|
20
|
-
})),
|
21
|
-
)
|
22
|
-
.execute();
|
23
|
-
|
24
|
-
await queryRunner.manager
|
25
|
-
.createQueryBuilder()
|
26
|
-
.insert()
|
27
|
-
.into('role_menus', ['role_id', 'menu_id'])
|
28
|
-
.values({
|
29
|
-
role_id: 2,
|
30
|
-
menu_id: 1,
|
31
|
-
});
|
32
|
-
*/
|
33
|
-
}
|
34
|
-
|
35
|
-
async down(queryRunner: QueryRunner) {
|
36
|
-
await queryRunner.manager.delete('role_menus', { role_id: 1 });
|
37
|
-
await queryRunner.manager.delete('role_menus', { role_id: 2 });
|
38
|
-
}
|
39
|
-
}
|
@@ -1,186 +0,0 @@
|
|
1
|
-
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
2
|
-
import { foreignColumn, idColumn, timestampColumn } from '@hedhog/utils';
|
3
|
-
|
4
|
-
export class Migrate implements MigrationInterface {
|
5
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
6
|
-
await queryRunner.createTable(
|
7
|
-
new Table({
|
8
|
-
name: 'setting_groups',
|
9
|
-
columns: [
|
10
|
-
idColumn(),
|
11
|
-
{
|
12
|
-
name: 'icon',
|
13
|
-
type: 'varchar',
|
14
|
-
length: '31',
|
15
|
-
},
|
16
|
-
{
|
17
|
-
name: 'slug',
|
18
|
-
type: 'varchar',
|
19
|
-
length: '63',
|
20
|
-
isUnique: true,
|
21
|
-
},
|
22
|
-
timestampColumn(),
|
23
|
-
timestampColumn('updated_at'),
|
24
|
-
],
|
25
|
-
}),
|
26
|
-
);
|
27
|
-
|
28
|
-
await queryRunner.createTable(
|
29
|
-
new Table({
|
30
|
-
name: 'setting_group_translations',
|
31
|
-
columns: [
|
32
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
33
|
-
foreignColumn({ name: 'group_id', isPrimary: true }),
|
34
|
-
{
|
35
|
-
name: 'name',
|
36
|
-
type: 'varchar',
|
37
|
-
length: '63',
|
38
|
-
},
|
39
|
-
{
|
40
|
-
name: 'description',
|
41
|
-
type: 'varchar',
|
42
|
-
length: '255',
|
43
|
-
isNullable: true,
|
44
|
-
},
|
45
|
-
timestampColumn(),
|
46
|
-
timestampColumn('updated_at'),
|
47
|
-
],
|
48
|
-
foreignKeys: [
|
49
|
-
{
|
50
|
-
columnNames: ['locale_id'],
|
51
|
-
referencedColumnNames: ['id'],
|
52
|
-
referencedTableName: 'locales',
|
53
|
-
onDelete: 'CASCADE',
|
54
|
-
},
|
55
|
-
{
|
56
|
-
columnNames: ['group_id'],
|
57
|
-
referencedColumnNames: ['id'],
|
58
|
-
referencedTableName: 'setting_groups',
|
59
|
-
onDelete: 'CASCADE',
|
60
|
-
},
|
61
|
-
],
|
62
|
-
}),
|
63
|
-
);
|
64
|
-
|
65
|
-
await queryRunner.createTable(
|
66
|
-
new Table({
|
67
|
-
name: 'settings',
|
68
|
-
columns: [
|
69
|
-
idColumn(),
|
70
|
-
foreignColumn({ name: 'group_id' }),
|
71
|
-
{
|
72
|
-
name: 'slug',
|
73
|
-
type: 'varchar',
|
74
|
-
isUnique: true,
|
75
|
-
length: '63',
|
76
|
-
},
|
77
|
-
{
|
78
|
-
name: 'type',
|
79
|
-
type: 'enum',
|
80
|
-
enum: ['string', 'number', 'boolean', 'json'],
|
81
|
-
default: "'string'",
|
82
|
-
},
|
83
|
-
{
|
84
|
-
name: 'value',
|
85
|
-
type: 'varchar',
|
86
|
-
length: '1023',
|
87
|
-
isNullable: true,
|
88
|
-
},
|
89
|
-
{
|
90
|
-
name: 'userOverride',
|
91
|
-
type: 'boolean',
|
92
|
-
default: false,
|
93
|
-
},
|
94
|
-
timestampColumn(),
|
95
|
-
timestampColumn('updated_at'),
|
96
|
-
],
|
97
|
-
foreignKeys: [
|
98
|
-
{
|
99
|
-
columnNames: ['group_id'],
|
100
|
-
referencedColumnNames: ['id'],
|
101
|
-
referencedTableName: 'setting_groups',
|
102
|
-
onDelete: 'CASCADE',
|
103
|
-
},
|
104
|
-
],
|
105
|
-
}),
|
106
|
-
);
|
107
|
-
|
108
|
-
await queryRunner.createTable(
|
109
|
-
new Table({
|
110
|
-
name: 'setting_translations',
|
111
|
-
columns: [
|
112
|
-
foreignColumn({ name: 'locale_id', isPrimary: true }),
|
113
|
-
foreignColumn({ name: 'setting_id', isPrimary: true }),
|
114
|
-
{
|
115
|
-
name: 'description',
|
116
|
-
type: 'varchar',
|
117
|
-
isNullable: true,
|
118
|
-
length: '255',
|
119
|
-
},
|
120
|
-
{
|
121
|
-
name: 'name',
|
122
|
-
type: 'varchar',
|
123
|
-
isNullable: true,
|
124
|
-
length: '63',
|
125
|
-
},
|
126
|
-
timestampColumn(),
|
127
|
-
timestampColumn('updated_at'),
|
128
|
-
],
|
129
|
-
foreignKeys: [
|
130
|
-
{
|
131
|
-
columnNames: ['locale_id'],
|
132
|
-
referencedColumnNames: ['id'],
|
133
|
-
referencedTableName: 'locales',
|
134
|
-
onDelete: 'CASCADE',
|
135
|
-
},
|
136
|
-
{
|
137
|
-
columnNames: ['setting_id'],
|
138
|
-
referencedColumnNames: ['id'],
|
139
|
-
referencedTableName: 'settings',
|
140
|
-
onDelete: 'CASCADE',
|
141
|
-
},
|
142
|
-
],
|
143
|
-
}),
|
144
|
-
);
|
145
|
-
|
146
|
-
await queryRunner.createTable(
|
147
|
-
new Table({
|
148
|
-
name: 'setting_users',
|
149
|
-
columns: [
|
150
|
-
foreignColumn({ name: 'user_id', isPrimary: true }),
|
151
|
-
foreignColumn({ name: 'setting_id', isPrimary: true }),
|
152
|
-
{
|
153
|
-
name: 'value',
|
154
|
-
type: 'varchar',
|
155
|
-
length: '1023',
|
156
|
-
isNullable: true,
|
157
|
-
},
|
158
|
-
timestampColumn(),
|
159
|
-
timestampColumn('updated_at'),
|
160
|
-
],
|
161
|
-
foreignKeys: [
|
162
|
-
{
|
163
|
-
columnNames: ['user_id'],
|
164
|
-
referencedColumnNames: ['id'],
|
165
|
-
referencedTableName: 'users',
|
166
|
-
onDelete: 'CASCADE',
|
167
|
-
},
|
168
|
-
{
|
169
|
-
columnNames: ['setting_id'],
|
170
|
-
referencedColumnNames: ['id'],
|
171
|
-
referencedTableName: 'settings',
|
172
|
-
onDelete: 'CASCADE',
|
173
|
-
},
|
174
|
-
],
|
175
|
-
}),
|
176
|
-
);
|
177
|
-
}
|
178
|
-
|
179
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
180
|
-
await queryRunner.dropTable('setting_users');
|
181
|
-
await queryRunner.dropTable('setting_translations');
|
182
|
-
await queryRunner.dropTable('settings');
|
183
|
-
await queryRunner.dropTable('setting_group_translations');
|
184
|
-
await queryRunner.dropTable('setting_groups');
|
185
|
-
}
|
186
|
-
}
|