import { CSN, LinkedModel } from "cds-internal-tool"; import { DataSource, DataSourceOptions } from "typeorm"; import { MySQLCredential } from "./types"; export declare function formatTenantDatabaseName(credentials: MySQLCredential, tenant_db_prefix?: string, tenant?: string): string; export declare function getTenantDatabaseName(tenant?: string): string; /** * get mysql credential for tenant * * @param tenant * @returns */ export declare function getMySQLCredential(tenant: string): import("mysql2").ConnectionOptions; export declare function getDataSourceOption(tenant?: string): Promise; export declare function csn4(tenant?: string): Promise; export declare function runWithAdminConnection(runner: (ds: DataSource) => Promise): Promise; /** * get raw CSN from linked model * * cannot be cached will cause stack overflow */ export declare const _rawCSN: (m: LinkedModel) => Promise; /** * check tenant database is existed or not * * @param tenant * @returns */ export declare function hasTenantDatabase(tenant?: string): Promise; /** * create a mysql 'database' for tenant * * @param tenant * @returns */ export declare function createDatabase(tenant: string): Promise; /** * drop database for tenant * * @param tenant */ export declare function dropDatabase(tenant: string): Promise; /** * sync tenant data model * * @param tenant * @param csn CSN, optional * @returns */ export declare function syncTenant(tenant: string, csn?: CSN): Promise; /** * deploy CSV (only) for tenant * * @param tenant */ export declare function deployCSV(tenant?: string, csvList?: Array): Promise; /** * deploy (migrate) database model into target tenant database * * @param model plain CSN object * @param tenant tenant id * @returns */ export declare function deploy(model: CSN, tenant?: string): Promise; /** * get tenant 0 (admin tenant) name * * @returns */ export declare function getAdminTenantName(): string; /** * get (lower case) tables of target tenant * * @param tenant * @returns */ export declare function getTables(tenant?: string): Promise>; /** * get (lower case) columns of tables in target tenant * * @param table table name * @param tenant tenant id * @returns */ export declare function getColumns(table: string, tenant?: string): Promise>; /** * deploy admin tenant if required * * @returns */ export declare function deployT0(): Promise;