Build CREATE TABLE query with CHECK constraints properly embedded.
sea-query doesn’t support CHECK constraints natively, so we inject them
by modifying the generated SQL string.
Generate enum type name with table prefix to avoid conflicts.
Always includes table name to ensure uniqueness across tables.
Format: {table}_{enum_name}
Generate foreign key constraint name from table name, columns, and optional user-provided key.
Always includes table name to avoid conflicts across tables.
Uses double underscore to separate table name from the rest.
Format: fk_{table}{key} or fk_{table}{col1}_{col2}…
Generate index name from table name, columns, and optional user-provided key.
Always includes table name to avoid conflicts across tables.
Uses double underscore to separate table name from the rest.
Format: ix_{table}{key} or ix_{table}{col1}_{col2}…
Build the CREATE TABLE statement for a SQLite temp table, including all CHECK constraints.
This combines build_create_table_for_backend with CHECK constraint injection.
Generate unique constraint name from table name, columns, and optional user-provided key.
Always includes table name to avoid conflicts across tables.
Uses double underscore to separate table name from the rest.
Format: uq_{table}{key} or uq_{table}{col1}_{col2}…
Recreate all indexes (both regular and UNIQUE) after a SQLite temp table rebuild.
After DROP TABLE + RENAME, all original indexes are gone, so plain CREATE INDEX is correct.