How can I change mysql column name using migration...
# orm-help
y
How can I change mysql column name using migration without data loss ?  The above case is possible when the default is null and when there is no data https://www.prisma.io/docs/concepts/components/prisma-migrate/prisma-migrate-flows The below DDL can be changed without any data loss and that’s what I want. “alter table user change name name2 varchar(191)” The attempts I have tested are as follows. But it failed. 1. Directly modify DB with DDL 2. Modify schema.prisma 3. prisma migrate dev --preview-feature Is it possible to change the column name without default null without losing data by migration?
a
I think the steps would be: 1. change the field name in Prisma schem 2. Generate a new migration with
prisma migrate dev --create-only
3. Edit the
migration.sql
file, removing the
ALTER TABLE DROP COLUMN
and
ALTER TABLE CREATE COLUMN
statements and inserting the
ALTER TABLE
statement instead. 4. Apply migration with
prisma migrate dev
Have you tried this?
y
I have already tried it and I got the following error.
t
oh, that's an interesting error — it would be great if you can open a github issue with as much detail as possible 🙏 we'll look into it soon
👌 1