weird __drizzle_migrations row id (move from `drizzle-kit push` to `drizzle-kit migrate`)

tl;dr: how is the starting id defined when running drizzle-kit migrate? i though it was the migration filename id but it doesn't seem to be. i had to forego the described challenge in the title. seemed trivial, but i found a few pitfalls in the dx. i tried to manually create the rows in the drizzle table but the it's unclear how the index is defined. i had 10 migrations: locally, the id started in 25. in my remote db, it started in 4. i worked my way around it by setting SELECT 1; temporarily in my migration files so the drizzle-kit migrate command would fill the __drizzle_migrations table; although the hash doesn't match the contents it doesn't matter because the command uses the index.
4 Replies
Peit
Peit2w ago
what do you mean 'starting id'? it looks at the when from the journal.json file which corresponds to the created_at in the __drizzle_migration table
paske
paskeOP2w ago
what do you mean 'starting id'?
the id of the first row in the __drizle_migrations (id, hash,created_at) generated table. in attached img see how the first row starts actually at id: 25 (i'd expect 1 instead), which is odd as this is completely managed by drizzle
No description
Peit
Peit2w ago
thats just an auto incrementing sequence and has no bearing on the migration process iirc
paske
paskeOP6d ago
yeah i assume that's the case. maybe drizzle-kit push affects that sequence? it's odd that the first row id's is 25 given i just started to use drizzle-kit migrate

Did you find this page helpful?