Andrii Sherman
Andrii Sherman
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
helped us to make an improvement
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
and thanks a lot for his case
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
We will provide errors with explanations, so that won't happen. We will release that tomorrow. If you don't have such issues now, then the best answer would be: 'That won't happen again 😅.'
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
remove enum and then create needed one
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
and then handle it in a way we discussed
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
so it will also have 5 enum values
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
you would need to add values from database to a ts schema
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
or you just asking?
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
So in terms of rectifying already broken migration files, what do you think the best cause of action should be here? Given that a temp fix to manually sort it is fine, although if other developers are working on the platform, I'd hate to explain that after the migrate they need to run a random script to fix the issue?
Do you have such issues now?
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
you can use enum, if you are sure values won't change
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
outside of drizzle as well
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
yes
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
and you can use $type with text, varchar or any other type
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
And then we can change the type as much as we need; it's just a TypeScript helper for us
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
btw, we are not using enums on all our projects, we instead are doing this:
column: varchar("column_name").$type<"active" | "non_active">().notNull().default("active"),
column: varchar("column_name").$type<"active" | "non_active">().notNull().default("active"),
column will be of type "active" | "non_active"
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
Push is trying to reinsert because there are more enum values in the database than in the code. The reason why: - You changed enums and generated a migration. - Kit can't handle deletion or reordering of enums because PostgreSQL can't do it itself. - You migrate'd, but your generated SQL statements didn't include statements to reorder or remove values from the enum. - You tried to push, and as long as the new enum order was not updated in the database, we saw the error you encountered. We will: - Properly detect that some values were removed or reordered. - On generate, prompt you that we didn't generate some migration statements due to limitations and suggest ways to fix that yourself. - On push, fail with an error and explanation, asking you to push without the enum and then repush with the enum
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
I guess I now understand what happened, and our update should make it straightforward for users to understand what happened. Let me explain
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
and then push to stage/prod/etc.
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
this flow is good actually so you push as much as you need to test your schema and when you are ready with you schema -> generate the migration
75 replies
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
I guess we need to have some big turorial and blog post explaining the difference
75 replies