How to use the webiny-api.MySQLTable.getDriver function in webiny-api

To help you get started, we’ve selected a few webiny-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / examples / api / src / import / cms / create.js View on Github external
// @flow
import { Sync, ConsoleLog } from "webiny-sql-table-sync";
import { PageTable, CategoryTable, RevisionTable } from "webiny-api-cms/lib/mysql";
import FileTable from "webiny-api/lib/tables/file.mysql";
import ImageTable from "webiny-api/lib/tables/image.mysql";

import { MySQLTable } from "webiny-api";

// Configure MySQLTable driver
import { connection } from "./../../configs/database";

MySQLTable.getDriver().setConnection(connection);

(async () => {
    const tables = [PageTable, CategoryTable, RevisionTable, FileTable, ImageTable];

    const sync = new Sync({
        tables,
        drop: true,
        logClass: ConsoleLog
    });
    await sync.execute();

    const { default: importer } = await import("./import");
    return importer();
})();
github webiny / webiny-js / examples / api / src / import / users / create.js View on Github external
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,
github webiny / webiny-js / examples / api / src / import / users / create.js View on Github external
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 "./../../app/database";

MySQLTable.getDriver().setConnection(connection);

(async () => {
    const tables = [
        UserTable,
        Identity2RoleTable,
        RoleTable,
        PermissionTable,
        Role2PermissionTable,
        RoleGroupTable,
        Identity2RoleGroupTable,
        Role2RoleGroupTable
    ];

    const sync = new Sync({
        tables,
        drop: true,