data-table@0.3.0
Breaking Changes📦 remixView on GitHub →
⚠ 12 breaking✨ 3 features🔧 28 symbols
Summary
This release fundamentally changes how database migrations are handled, moving from a schema-builder API to plain SQL files executed via adapters. This includes removing many related APIs and introducing explicit transaction control directives within SQL scripts.
⚠️ Breaking Changes
- Migrations are now plain SQL files organized in directories named `YYYYMMDDHHmmss_<slug>/` containing `up.sql` and optional `down.sql`. The old schema-builder API for migrations is removed.
- The `createMigration` function is removed.
- The types `MigrationContext`, `MigrationSchema`, `AlterTableBuilder`, `CreateMigrationInput`, `Migration`, `KeyColumns`, and `TableInput` are removed from `remix/data-table/migrations`.
- The function `parseMigrationFilename` is removed and replaced by `parseMigrationDirectoryName`.
- The `column` / `ColumnBuilder` re-exports from `remix/data-table/migrations` are removed (they remain available from the main `remix/data-table` entry).
- The structure of `MigrationDescriptor` changed to `{ id, name, up: string, down?: string, transaction?, path? }`. Checksums are now computed by the runner based on the SQL content.
- `MigrateResult.sql` is now an array of strings (`string[]`) instead of `SqlStatement[]`.
- `loadMigrations(directory)` now scans folder-per-migration layouts (not `.ts` files) and returns descriptors containing SQL strings.
- The `DatabaseAdapter` gained a required `executeScript(sql, transaction?)` method. Existing first-party adapters implement this.
- The methods `migrate(request)` and the entire `DataMigrationOperation` ADT (`CreateTableOperation`, `AlterTableOperation`, etc.) are removed from `DatabaseAdapter` and public exports.
- `compileSql` now only accepts `DataManipulationOperation`.
- `isDataManipulationOperation` is removed from `remix/data-table/sql-helpers`.
Migration Steps
- Replace existing schema-builder migration files (e.g., `createMigration({...})`) with a directory structure containing `up.sql` and `down.sql` files with the equivalent SQL logic.
- Update code referencing removed APIs like `createMigration` or the removed types from `remix/data-table/migrations`.
- If implementing a custom `DatabaseAdapter`, implement the required `executeScript(sql, transaction?)` method.
- Update calls to `loadMigrations` to handle the new return structure containing SQL strings instead of statement objects.
- If using transaction control, update migration files to use SQL directives (e.g., `-- data-table/transaction: none`) or set the `transaction` field in the `MigrationDescriptor`.
✨ New Features
- Migrations now use plain SQL files (`up.sql`, `down.sql`) executed as multi-statement queries.
- Added support for explicit transaction control within `up.sql` using directives like `-- data-table/transaction: none`.
- New transaction modes supported: `auto` (default), `required`, and `none`.
Affected Symbols
remix/data-table/migrationscreateMigrationMigrationContextMigrationSchemaAlterTableBuilderCreateMigrationInputMigrationKeyColumnsTableInputparseMigrationFilenamecolumnColumnBuilderMigrationDescriptorMigrateResult.sqlloadMigrationsDatabaseAdapterexecuteScriptmigrate(request)DataMigrationOperationCreateTableOperationAlterTableOperationIndexDefinition*ConstraintcompileSqlDataManipulationOperationisDataManipulationOperationremix/data-table/sql-helpersjournal-store.ts