AndyBoni
AndyBoni
DTDrizzle Team
Created by AndyBoni on 2/2/2025 in #help
ExpoSQLite migration immediately fails... How to solve (without deleting migration files)?
I am trying to run my first update migrations after my first DB change (after initial migration to create initial migration from schema)... But the migration immediatey fails:
0000_migration_file.sql
CREATE TABLE `categories` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`wordIds` text NOT NULL,
`type` text NOT NULL,
`deletedAt` text,
`learning` integer DEFAULT 0,
`targetLanguage` text DEFAULT 'DE' NOT NULL
);
--> statement-breakpoint
CREATE TABLE `daily_progress` (
`date` text PRIMARY KEY NOT NULL,
`metricType` text PRIMARY KEY NOT NULL,
`count` integer NOT NULL
);
[...]
0000_migration_file.sql
CREATE TABLE `categories` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`wordIds` text NOT NULL,
`type` text NOT NULL,
`deletedAt` text,
`learning` integer DEFAULT 0,
`targetLanguage` text DEFAULT 'DE' NOT NULL
);
--> statement-breakpoint
CREATE TABLE `daily_progress` (
`date` text PRIMARY KEY NOT NULL,
`metricType` text PRIMARY KEY NOT NULL,
`count` integer NOT NULL
);
[...]
It already fails on the first migration file... but why? This shouldn't even run, no? Those tables were already created on the first app run.
0002_migration_file.sql
ALTER TABLE `word_scheduling` ADD `deletedAt` text;
0002_migration_file.sql
ALTER TABLE `word_scheduling` ADD `deletedAt` text;
I would expect this one and the one before (0001) to be running via the const { success, error } = useMigrations(drizzleDb, migrations)` method. But it seems it tries to run the first migration which I believe shouldn't be executed (?) I used npx drizzle-kit generate before to generate my migration files. Anyone got experience with Expo/SQLite & Drizzle failing migrations? Am I forgetting anything? Thanks!
1 replies