You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I encountered a non-trivial issue that concerns both turso and drizzle-kit.
For deep understanding of the further explanations, I highly recommend you first to read the issue on @drizzle-kit side.
For adding the primary key to my table, I used the drizzle-kit generate command that generated the following SQL script:
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_test_table` (
`id` integer PRIMARY KEY NOT NULL,
`name` text
);
--> statement-breakpoint
INSERT INTO `__new_test_table`("id", "name") SELECT "id", "name" FROM `test_table`;--> statement-breakpoint
DROP TABLE `test_table`;--> statement-breakpoint
ALTER TABLE `__new_test_table` RENAME TO `test_table`;--> statement-breakpoint
PRAGMA foreign_keys=ON;
NOTE: At the line "INSERT INTO __new_test_table("id", "name") SELECT "id", "name" FROM test_table;" we're trying to access the id column, but it doesn't exist yet.
The most important part related to Turso is when we're trying to apply migration changes to the database:
Applying changes to the remote database works without any errors. This is unexpected behavior, because the migration script is incorrect?
Applying changes to the local turso server (launched with the turso dev command) throws an error, which is the expected and correct behavior.
Applying the same changes directly using the sqlite3 command on the local database file does not throw an error. I'm not sure why this happens - it's very strange.
The software on Turso Cloud is, therefore, the expected behavior as it follows SQLite's (arguably weird) semantics and the local dev server has a compatibility bug essentially.
penberg
changed the title
Inconsistent behavior between cloud and local turso server
Inconsistent behavior between libSQL server and SQLite for double-quoted strings
May 22, 2025
Hello, I encountered a non-trivial issue that concerns both
turso
anddrizzle-kit
.For deep understanding of the further explanations, I highly recommend you first to read the issue on @drizzle-kit side.
For adding the primary key to my table, I used the
drizzle-kit generate
command that generated the following SQL script:NOTE: At the line "INSERT INTO __new_test_table("id", "name") SELECT "id", "name" FROM test_table;" we're trying to access the id column, but it doesn't exist yet.
The most important part related to Turso is when we're trying to apply migration changes to the database:
turso dev
command) throws an error, which is the expected and correct behavior.sqlite3
command on the local database file does not throw an error. I'm not sure why this happens - it's very strange.Versions of my packages:
The text was updated successfully, but these errors were encountered: