14 lines
722 B
TypeScript
14 lines
722 B
TypeScript
import type { BUN_MARIADB_DatabaseSchemaType, CreateDBSchemaParams } from "../../types";
|
|
/**
|
|
* Topologically order tables so referenced (parent) tables come before the
|
|
* tables that reference them. Declaration order is kept wherever the FK
|
|
* graph allows it.
|
|
*
|
|
* - Self references (e.g. `comments.parent_comment_id`) are ignored.
|
|
* - References to tables outside the schema are ignored.
|
|
* - Cycles do not throw: a table already on the current path is skipped,
|
|
* so every table is still emitted exactly once. Foreign keys are created
|
|
* after all tables exist, so cycles are safe to sync.
|
|
*/
|
|
export default function orderDBSchema({ db_schema, }: CreateDBSchemaParams): Promise<BUN_MARIADB_DatabaseSchemaType>;
|