Updates
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
import type { BUN_MARIADB_FieldSchemaType, BUN_MARIADB_TableSchemaType, BunMariaDBConfig } from "../../types";
|
||||
export type DesiredForeignKey = {
|
||||
name: string;
|
||||
column: string;
|
||||
refTable: string;
|
||||
refColumn: string;
|
||||
cascadeDelete: boolean;
|
||||
cascadeUpdate: boolean;
|
||||
field: BUN_MARIADB_FieldSchemaType;
|
||||
};
|
||||
export type LiveForeignKey = {
|
||||
name: string;
|
||||
column: string;
|
||||
refTable: string;
|
||||
refColumn: string;
|
||||
deleteRule: string;
|
||||
updateRule: string;
|
||||
};
|
||||
export declare function grabDesiredForeignKeys(table: BUN_MARIADB_TableSchemaType): DesiredForeignKey[];
|
||||
export declare function grabLiveForeignKeys({ tableName, config, }: {
|
||||
tableName: string;
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<LiveForeignKey[]>;
|
||||
export declare function dropForeignKey({ tableName, constraintName, config, }: {
|
||||
tableName: string;
|
||||
constraintName: string;
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<void>;
|
||||
export declare function dropForeignKeysOnColumns({ tableName, columns, config, }: {
|
||||
tableName: string;
|
||||
columns: string[];
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<void>;
|
||||
/**
|
||||
* Drop foreign keys that are removed from schema or need recreation
|
||||
* (name/cascade/target changed). Run before index cleanup.
|
||||
*/
|
||||
export declare function dropObsoleteForeignKeys({ table, config, }: {
|
||||
table: BUN_MARIADB_TableSchemaType;
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<void>;
|
||||
/**
|
||||
* Ensure all desired foreign keys exist. Run after indexes/uniques.
|
||||
*/
|
||||
export declare function ensureForeignKeys({ table, config, }: {
|
||||
table: BUN_MARIADB_TableSchemaType;
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<void>;
|
||||
export default function syncForeignKeys({ table, config, }: {
|
||||
table: BUN_MARIADB_TableSchemaType;
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<void>;
|
||||
Reference in New Issue
Block a user