durcno@1.0.0-alpha.4
Minor Changes
-
a7442fe - Thanks to @almahdi404 !
feat(migration/ddl): add type DDL API and split ddl module into files
Introduced a new generic type DDL API to replace the old enum-specific helpers. The old methods (
createEnum,dropEnum,alterEnumAddValue) are still available but now marked@deprecated.New API:
// Create a PostgreSQL enum typeddl.createType("public", "user_type", { asEnum: ["admin", "user"] });// Drop a typeddl.dropType("public", "user_type");// Alter a type — fluent chainable builderddl.alterType("public", "user_type").addValue("moderator", { after: "admin" }).renameValue("guest", "visitor");alterTypeintroduces a newrenameValuecapability that was not available in the old API.The
src/migration/ddl/module was also refactored from a single monolithic file into focused modules (enum.ts,indexes.ts,schema.ts,sequence.ts,statement.ts,table.ts,types.ts,utils.ts) with a re-exportingindex.ts. This is a purely internal restructuring with no public API changes.The migration generator (
durcno generate) now emits the new type API in freshly generated migration files.
Patch Changes
-
05ebbad - Thanks to @almahdi404 !
fix(connectors/pglite): run migrations without transactions for pglite
PGlite does not support DDL statements inside transactions and requires sequential execution. Previously, the
generatecommand always emitted migration files withtransaction: true, which caused migrations to fail silently or error out when using the PGlite connector.PgLiteConnectornow declares a staticmigrationOptionsoverride on the baseConnectorclass:class PgLiteConnector extends Connector {...static override migrationOptions = {transaction: false,execution: "sequential" as const,};...}The
generatecommand readsconnector.migrationOptionsand passes those values throughgenerateMigration/generateNoOpMigrationso that the emittedoptionsexport inup.tsanddown.tsreflects the connector's requirements automatically — no manual edits needed. -
6373d04 - Thanks to @almahdi404 !
fix(cli/migration): combine transaction statements into single query for joined execution
Previously, even in
joinedexecution mode,BEGINandCOMMITwere issued as separateclient.query()calls around the batched SQL. This meant three round-trips to the database instead of one.The fix embeds
BEGIN;andCOMMIT;directly into the single SQL string sent forjoinedexecution, reducing it to a single round-trip and making joined migrations significantly faster.For
sequentialexecution the behavior is unchanged:BEGIN/COMMITare still sent as individual queries between each statement. TheROLLBACKon error is also now correctly scoped tosequentialmode only, since a failedjoinedquery is already rolled back by the database.