v0.0.2-alpha.22
Pre-releaseReleased all 12 packages at 0.0.2-alpha.22 in lockstep (nextly, create-nextly-app, and 10 @nextlyhq/* packages).
What's changed
@nextlyhq/adapter-drizzle
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
@nextlyhq/adapter-mysql
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
-
Updated dependencies [
bdece5c,faf14cd,17f0353,7f465db,7cae340]:- @nextlyhq/adapter-drizzle@0.0.2-alpha.22
@nextlyhq/adapter-postgres
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
-
Updated dependencies [
bdece5c,faf14cd,17f0353,7f465db,7cae340]:- @nextlyhq/adapter-drizzle@0.0.2-alpha.22
@nextlyhq/adapter-sqlite
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
-
Updated dependencies [
bdece5c,faf14cd,17f0353,7f465db,7cae340]:- @nextlyhq/adapter-drizzle@0.0.2-alpha.22
@nextlyhq/admin
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
-
Updated dependencies [
bdece5c,faf14cd,17f0353,7f465db,7cae340]:- @nextlyhq/ui@0.0.2-alpha.22
create-nextly-app
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
nextly
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
-
Updated dependencies [
bdece5c,faf14cd,17f0353,7f465db,7cae340]:- @nextlyhq/adapter-drizzle@0.0.2-alpha.22
- @nextlyhq/adapter-mysql@0.0.2-alpha.22
- @nextlyhq/adapter-postgres@0.0.2-alpha.22
- @nextlyhq/adapter-sqlite@0.0.2-alpha.22
@nextlyhq/plugin-form-builder
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
-
Updated dependencies [
bdece5c,faf14cd,17f0353,7f465db,7cae340]:- @nextlyhq/admin@0.0.2-alpha.22
- nextly@0.0.2-alpha.22
- @nextlyhq/ui@0.0.2-alpha.22
@nextlyhq/storage-s3
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
@nextlyhq/storage-uploadthing
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
@nextlyhq/storage-vercel-blob
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared
@nextlyhq/ui
Patch Changes
-
#87
bdece5cThanks @faisal-rx! - Fix code-first / HMR schema applies wrongly dropping managed tables on SQLite & MySQL.On SQLite and MySQL, drizzle-kit's
pushSchemaignorestablesFilterand introspects the whole database, so any managed table missing from the desired schema was flagged as a data-losing "orphan" DROP — failing the apply and offering the table as a spurious rename source. Three cases are fixed:- Schema-events ledger (
nextly_schema_events) is now a first-class managed core table (declared ingetCoreSchema/getDialectTables/CORE_TABLE_NAMES), so no schema path — apply, HMR,migrate, ordb:sync— ever treats it as an orphan drop or offers it as a spurious rename target. To make it round-trip cleanly, the SQLite primary key gains an explicitNOT NULL(SQLite, unlike PG/MySQL, treats a bareTEXT PRIMARY KEYas nullable) and the SQLite partial unique index is dropped — drizzle-kit 0.31.10 cannot round-trip a SQLite partial index (drizzle-team/drizzle-orm#4688), and keeping it churnedDROP/CREATE INDEXon every push. Postgres keeps its partial unique index. The "one applied row per file" guarantee is now enforced in code on all dialects: an atomic conditionalmarkApplied(setsappliedonly when no other applied row exists for the filename) plus the existing cross-process migrate lock. - UI-created collections, singles, and components are now preserved during a code-first HMR apply: every DB-registered resource is included in the desired schema (code-config entries take precedence), so adding a collection in code no longer drops resources created via the admin UI.
- Migration status: a collection added in code after the initial DB setup is now marked
appliedonce its table is created, instead of showingpendingforever in the builder listing (mirrors the existing singles behaviour).
- Schema-events ledger (
-
#87
faf14cdThanks @faisal-rx! - Fix fresh-database first-run aborting on MySQL.Now that
nextly_schema_eventsis a core table,freshPushSchemacreates it (and its indexes) during first-run setup. The setup then also replayed the out-of-bandgetSchemaEventsDdlunconditionally, and the MySQL raw DDL'sCREATE INDEXhas noIF NOT EXISTS, so it failed with a duplicate-index error and first-run reported failure on a fresh MySQL database. The out-of-band bootstrap is now guarded by atableExistscheck (matchingnextly migrate'sensureLedger), so it only runs as a fallback when the ledger is genuinely missing. -
#87
17f0353Thanks @faisal-rx! - Fixnextly migrate:creategenerating the wrong schema for components.The migration snapshot generator built component tables with the collection table-builder, so they came out with
slug/titleand were missing the component embedding columns (_parent_id,_parent_table,_parent_field,_order,_component_type). The generated snapshot then diverged from the real component table the apply pipeline creates, which madenextly migrate:resolve --appliedfail its schema-match verification for any project with a component. Components now usebuildDesiredTableFromComponentFields, matching the apply path. -
#87
7f465dbThanks @faisal-rx! - Fixnextly migrate:createomitting the component parent index, which brokemigrate:resolve --applied.The apply pipeline always creates a composite index (
idx_<table>_parenton_parent_id,_parent_table,_parent_field) for component tables, but the migration-snapshot builder did not emit it. So the live index looked like an unmanaged extra andnextly migrate:resolve --appliedfailed verification ("Live schema does not match the target snapshot") for any project with a component. The snapshot builder now emits the parent index, matching the apply pipeline. -
#87
7cae340Thanks @faisal-rx! - Fix twonextly_schema_eventsledger edge cases on the code-first schema path.- Postgres index/default churn: the ledger's raw bootstrap DDL declared
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), but the Drizzle def supplies the value app-side ($defaultFn) with no SQL default. Now that the ledger is a core table flowing through drizzle-kit's Postgres diff, that mismatch made every push/migrate emitALTER COLUMN started_at DROP DEFAULT. The raw DDL now omits the redundant default (matching the MySQL/SQLite ledger DDL and theidcolumn), so the ledger round-trips cleanly with no churn. Added a Postgres round-trip integration test alongside the existing SQLite one. markAppliedrace no-op: when the "one applied row per file" guard blocked a concurrent second apply, the losing row was left dangling atin_progressand the caller still logged a success.markAppliednow resolves the blocked row tosupersededand returns whether it applied, andnextly migratereports the file as already-applied-by-a-concurrent-run instead of a false success.
- Postgres index/default churn: the ledger's raw bootstrap DDL declared