-
Notifications
You must be signed in to change notification settings - Fork 590
/
create.js
41 lines (36 loc) · 937 Bytes
/
create.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// @flow
import { Sync, ConsoleLog } from "webiny-sql-table-sync";
import {
UserTable,
PermissionTable,
RoleTable,
RoleGroupTable,
Identity2RoleTable,
Identity2RoleGroupTable,
Role2RoleGroupTable,
Role2PermissionTable
} from "webiny-api-security/lib/mysql";
import { MySQLTable } from "webiny-api";
// Configure MySQLTable driver
import { connection } from "./../../configs/database";
MySQLTable.getDriver().setConnection(connection);
(async () => {
const tables = [
UserTable,
Identity2RoleTable,
RoleTable,
PermissionTable,
Role2PermissionTable,
RoleGroupTable,
Identity2RoleGroupTable,
Role2RoleGroupTable
];
const sync = new Sync({
tables,
drop: true,
logClass: ConsoleLog
});
await sync.execute();
const { default: importer } = await import("./import");
return importer();
})();