shelving
Version:
Toolkit for using data in JavaScript.
38 lines (37 loc) • 2.07 kB
TypeScript
import type { Schema } from "../../schema/Schema.js";
import type { Data } from "../../util/data.js";
import type { Identifier } from "../../util/item.js";
import type { Collection } from "../collection/Collection.js";
import type { SQLProvider } from "../provider/SQLProvider.js";
import { SQLMigrator, type SQLTable, type SQLTableColumn } from "./SQLMigrator.js";
type PostgreSQLColumnRow = {
readonly generated: boolean;
readonly identity: boolean;
readonly name: string;
readonly nullable: boolean;
readonly primary: boolean;
readonly type: string;
readonly value: string | null;
};
/** PostgreSQL migrator using pg_catalog-style schema inspection. */
export declare class PostgreSQLMigrator<T extends SQLProvider = SQLProvider> extends SQLMigrator<T> {
protected getTables(): Promise<readonly string[]>;
protected getTable(name: string): Promise<SQLTable | undefined>;
protected getCreateTableSuffix<TData extends Data>(_collection: Collection<string, Identifier, TData>): string;
protected getDataColumnDefinition(): string;
protected getGeneratedColumnDefinition(_columnName: string, path: string, definition: string): string;
protected getIDColumnDefinition<TData extends Data>(collection: Collection<string, Identifier, TData>): string;
protected getAlterColumnQueries(tableName: string, from: SQLTableColumn, to: SQLTableColumn): readonly string[];
protected definition<TValue>(schema: Schema<TValue>): string | undefined;
protected getCurrentColumnStatement({ generated, identity, name: _name, nullable, primary, type, value }: PostgreSQLColumnRow): string;
protected getGeneratedExpression(path: string, definition: string): string;
protected getGeneratedCast(definition: string): string | undefined;
protected parseColumn({ name, statement }: SQLTableColumn): {
readonly defaultValue?: string | undefined;
readonly generated: boolean;
readonly name: string;
readonly nullable: boolean;
readonly type: string;
} | undefined;
}
export {};