P
Prisma•2w ago
Chrisyo

ERROR: ALTER COLUMN TYPE is only implemented in the declarative schema changer

Hi all, i have a serious issue. I can't seem to run npx prisma migrate dev safely. For some reason my migration history has a change that was implemented on the 20241006 (20241006150212_added_our_platform_fee_to_store) Theres a sequence of three migration files the first creates the "our_platform_fee" -- ALTER TABLE "Store" ADD COLUMN "our_platform_fee" DECIMAL(65,30) NOT NULL DEFAULT 0.05; Then there is a migration which changes the TYPE -- ALTER COLUMN "our_platform_fee" TYPE INTEGER USING (ROUND("our_platform_fee" * 100)::INTEGER); Until now i have had no errors - now i get this error message. Error message after running "npx prisma migrate dev --name added_fields_to_event" Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": CockroachDB database "defaultdb", schema "public" at "stella-ecomm-development-5939.6zw.aws-eu-west-1.cockroachlabs.cloud:26257" Error: P3006 Migration 20241008063544_change_our_platform_fee_to_int failed to apply cleanly to the shadow database. Error: ERROR: ALTER COLUMN TYPE is only implemented in the declarative schema changer 0: schema_core::state::DevDiagnostic at schema-engine/core/src/state.rs:267 I had a call with Cockroach DB support and they told me to comment out all the migration files SQL except and to change one of them to this ALTER TABLE "Store" ADD COLUMN "our_platform_fee" INT4; Now i've lost all my data in development as it recreated the database! Is there a fix for this, i'm confused as to why it was working until now. Any support would be very much appreciated.
No description
5 Replies
Prisma AI Help
Prisma AI Help•2w ago
Ahoy, knowledge seeker! I'm the Prisma AI Help Bot. Do you want a dev's response that might take a hot second, or an AI answer that's ready before your next coffee sip? Either way, your question is important to us.
Nurul
Nurul•2w ago
Hey 👋 What is your CockroachDB version? Are you on version 23.1? Did you upgrade it recently? I was able to find this GitHub Issue which seems related: https://github.com/prisma/prisma/issues/20557
GitHub
cockroachdb fails with simple migration · Issue #20557 · prisma/p...
Bug description running prisma migrate dev to add a column failed with: npx prisma migrate dev Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "de...
Chrisyo
ChrisyoOP•2w ago
Hey Nurl thanks for replying - i am on "Basic, AWS v25.1.4" I have not recently upgraded my cockroach db instance no.
Nurul
Nurul•7d ago
Hmm! okay In that case I am not sure what exactly caused the issue and why it was working as expected till now. ORM team might be able to debug if we can have a minimal reproduction of this issue
Chrisyo
ChrisyoOP•7d ago
Made this repo with the same migration files @Nurul https://github.com/ChristianAlteri/copy-stella-admin-prisma-issue
GitHub
GitHub - ChristianAlteri/copy-stella-admin-prisma-issue: copy-stell...
copy-stella-admin-prisma-issue. Contribute to ChristianAlteri/copy-stella-admin-prisma-issue development by creating an account on GitHub.

Did you find this page helpful?