I want to write table schemas declarative way like
- GORM AutoMigrate https://gorm.io/ko_KR/docs/migration.html
- django Migrations https://docs.djangoproject.com/en/3.2/topics/migrations/
However, As far I know, Diesel requires hand-written migration DDL like below.
-- up.sql
CREATE TABLE members (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50) NOT NULL
);
-- down.sql
DROP TABLE members;
It is complex a little bit because it is stateful.
Is a declarative way to write schemas provided by Diesel? Or do a good external tool exist?
I found Prisma can generate DDL equivalent to up.sql from declarative schema written in its own syntax. But I couldn't find a way to generate down.sql https://www.prisma.io/docs/concepts/components/prisma-migrate