Fix bugs, improve schema gen
This commit is contained in:
+17
-1
@@ -1,4 +1,20 @@
|
||||
import type { BUN_MARIADB_FieldSchemaType } from "../../types";
|
||||
import { type BUN_MARIADB_FieldSchemaType, type BUN_MARIADB_ForeignKeyRule } from "../../types";
|
||||
export declare function defaultForeignKeyName(tableName: string, fieldName: string): string;
|
||||
export declare function resolveForeignKeyName(field: BUN_MARIADB_FieldSchemaType, tableName: string): string;
|
||||
/**
|
||||
* Normalize a referential action as MariaDB reports it in
|
||||
* `information_schema.REFERENTIAL_CONSTRAINTS`. InnoDB treats `NO ACTION`
|
||||
* exactly like `RESTRICT`, so both compare as `RESTRICT`.
|
||||
*/
|
||||
export declare function normalizeForeignKeyRule(rule: string | undefined | null): BUN_MARIADB_ForeignKeyRule;
|
||||
/**
|
||||
* Resolve the ON DELETE / ON UPDATE actions for a field's foreign key.
|
||||
* Precedence: `foreignKey.onDelete` > field `onDeleteLiteral` / `onDelete`
|
||||
* (legacy) > `cascadeDelete` > `RESTRICT`. Same for update, except the
|
||||
* field-level `onUpdate*` keys are column `ON UPDATE` clauses, not FK rules.
|
||||
*/
|
||||
export declare function resolveForeignKeyRules(field: BUN_MARIADB_FieldSchemaType, tableName?: string): {
|
||||
onDelete: BUN_MARIADB_ForeignKeyRule;
|
||||
onUpdate: BUN_MARIADB_ForeignKeyRule;
|
||||
};
|
||||
export default function buildForeignKeyConstraint(field: BUN_MARIADB_FieldSchemaType, tableName: string): string;
|
||||
|
||||
Reference in New Issue
Block a user