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
I encountered issues when trying to export and re-import data during iterative development. The INSERT statements generated during the export process did not include column names. This caused problems because the column creation order in the tables during development differed from the order in the finalized table definitions.
As a result, the exported SQL file failed to correctly import the data into the updated database schema.
Expected behavior
The exported SQL file should include column names in the INSERT statements to ensure compatibility when importing data, even if the column order differs between the development and finalized table definitions.
Steps to reproduce
Use drizzle-orm with the following migration files:
ls -al migrations/
meta
0000_init.sql
0001_~
0002_~
・・・
Export data from the database:
for table in $(echo "artists" "artist_timelines" "albums" "album_timelines" "tracks" )
do
npx wrangler d1 export spotify-db --table=$table --output ./data/$table.sql --no-schema --local
done
for table in $(echo "artists" "artist_timelines" "albums" "album_timelines" "tracks" )
do
npx wrangler d1 execute spotify-db --file=./data/$table.sql --local
done
During development, I frequently modify the table structure by adding and removing columns using ALTER statements. Once the table structure is finalized, I consolidate these changes into a single CREATE TABLE statement.
To preserve the data generated during application testing, I exported the data and attempted to re-import it into the finalized schema. However, because the exported SQL file lacked column names in the INSERT statements and the column order differed, the import failed.
Which Cloudflare product(s) does this pertain to?
D1
What version(s) of the tool(s) are you using?
3.94.0[wrangler]
What version of Node are you using?
20.16.0
What operating system and version are you using?
macOS 15.1.1
Describe the Bug
Observed behavior
I encountered issues when trying to export and re-import data during iterative development. The INSERT statements generated during the export process did not include column names. This caused problems because the column creation order in the tables during development differed from the order in the finalized table definitions.
As a result, the exported SQL file failed to correctly import the data into the updated database schema.
Expected behavior
The exported SQL file should include column names in the INSERT statements to ensure compatibility when importing data, even if the column order differs between the development and finalized table definitions.
Steps to reproduce
Use drizzle-orm with the following migration files:
Export data from the database:
Delete the database and recreate it:
Attempt to re-import the exported data:
During development, I frequently modify the table structure by adding and removing columns using ALTER statements. Once the table structure is finalized, I consolidate these changes into a single CREATE TABLE statement.
To preserve the data generated during application testing, I exported the data and attempted to re-import it into the finalized schema. However, because the exported SQL file lacked column names in the INSERT statements and the column order differed, the import failed.
Please provide a link to a minimal reproduction
workers-sdk/packages/miniflare/src/workers/d1/dumpSql.ts
Line 82 in 75be0d5
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: