bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
45 lines (44 loc) • 1.16 kB
TypeScript
import type { TableMetadata } from "kysely";
import type { IndexMetadata } from "../connection/Connection";
import type { Entity, EntityManager } from "../entities";
type IntrospectedTable = TableMetadata & {
indices: IndexMetadata[];
};
type SchemaDiffTable = {
name: string;
isNew: boolean;
isDrop?: boolean;
columns: {
add: string[];
drop: string[];
change: string[];
};
indices: {
add: string[];
drop: string[];
};
};
/**
* @todo: add modified fields
* @todo: add drop tables
*
* @todo: change exclude tables to startWith, then add "bknd_" tables
*/
export declare class SchemaManager {
private readonly em;
static EXCLUDE_TABLES: string[];
constructor(em: EntityManager<any>);
private getIntrospector;
introspect(): Promise<IntrospectedTable[]>;
getIntrospectionFromEntity(entity: Entity): IntrospectedTable;
getDiff(): Promise<SchemaDiffTable[]>;
private collectFieldSchemas;
sync(config?: {
force?: boolean;
drop?: boolean;
}): Promise<{
sql: string;
parameters: readonly unknown[];
}[]>;
}
export {};