Cal
Cal
DTDrizzle Team
Created by Cal on 5/22/2024 in #help
drizzle-kit push inconsistent with database with migrations already applied
Hi team Just wanting to sanity check something here to make sure that I am not barking up the wrong tree...From my understanding, the drizzle-kit push command should look at changes that I have made and push these up to the database before I make a migration to commit that change for good? Anyway, here's my issue... So, I've got a pg_enum defined:
enum_schema enum_name enum_value
public gate_types approval
public gate_types manual
public gate_types post_deployment
public gate_types preparation
public gate_types approval_gate
enum_schema enum_name enum_value
public gate_types approval
public gate_types manual
public gate_types post_deployment
public gate_types preparation
public gate_types approval_gate
These were generated over time using migration's and I've recently upgraded to the new Drizzle Kit version (v0.21.4) (ORM: v0.30.10) If I run the drizzle-kit generate command I get: No schema changes, nothing to migrate 😴 But then, when I run drizzle-kit push:
[✓] Pulling schema from database...

[✓] Pulling schema from database...
Warning You are about to execute current statements:

ALTER TYPE "gate_types" ADD VALUE 'preparation';


PostgresError: enum label "preparation" already exists
at [redacted] {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42710',
file: 'pg_enum.c',
line: '293',
routine: 'AddEnumLabel'
}
[✓] Pulling schema from database...

[✓] Pulling schema from database...
Warning You are about to execute current statements:

ALTER TYPE "gate_types" ADD VALUE 'preparation';


PostgresError: enum label "preparation" already exists
at [redacted] {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42710',
file: 'pg_enum.c',
line: '293',
routine: 'AddEnumLabel'
}
I've also removed some logs from the above around dropping/adding FK's - but appears unrelated to this inconsistency
75 replies