Understanding what's colliding at db-push (Warning: Found data-loss statements)

I'm trying to push some schema changes to my dev environment schema and I'm running into an issue where I've already changed the type of a column, and it's already applied to the database, but this issue keeps coming up.
% npx drizzle-kit push:pg
drizzle-kit: v0.20.14
drizzle-orm: v0.30.4

No config path provided, using default path
Reading config file '/apps/web/drizzle.config.ts'
Warning Found data-loss statements:
· You're about to change type column type from charType to characterType with 3 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
% npx drizzle-kit push:pg
drizzle-kit: v0.20.14
drizzle-orm: v0.30.4

No config path provided, using default path
Reading config file '/apps/web/drizzle.config.ts'
Warning Found data-loss statements:
· You're about to change type column type from charType to characterType with 3 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
characterType is a Postgres enum I've declared in my Drizzle schema. I'm not sure what charType is referring to, is that a Postgres data type? However, this is the column SQL already applied to the database
alter table characters
add type "characterType" default 'Player'::"characterType" not null;
alter table characters
add type "characterType" default 'Player'::"characterType" not null;
And this is the table where it is used
+------------------------------------+-----+------+
|id |name |type |
+------------------------------------+-----+------+
|92e1e5ea-2465-4262-9d94-cb73cb8ecf0a|Babbe|Player|
|3469e219-6a67-4c0a-9e2e-0176846278f8|Babbe|Player|
|0690b6ae-2ab6-4bec-a48b-f1a49c923760|Nisse|Player|
+------------------------------------+-----+------+
+------------------------------------+-----+------+
|id |name |type |
+------------------------------------+-----+------+
|92e1e5ea-2465-4262-9d94-cb73cb8ecf0a|Babbe|Player|
|3469e219-6a67-4c0a-9e2e-0176846278f8|Babbe|Player|
|0690b6ae-2ab6-4bec-a48b-f1a49c923760|Nisse|Player|
+------------------------------------+-----+------+
It all seems perfectly fine... I don't see where the issue is. If I drop the column, then re-apply the changes to the database, Drizzle CLI does not complain. How can I debug this?
5 Replies
shay
shay6mo ago
@maxpaj hey, did you ever resolve this issue? i'm just as confused lol - i have to drop data every time even though the prospective changes are already applied
maxpaj
maxpajOP6mo ago
Nope, not yet
shay
shay6mo ago
dang
maxpaj
maxpajOP6mo ago
Let me know if you find a solution
shay
shay6mo ago
will do
Want results from more Discord servers?
Add your server