fluent-kit icon indicating copy to clipboard operation
fluent-kit copied to clipboard

Add rename functionality to schema builder

Open madsodgaard opened this issue 4 years ago • 0 comments

Currently, we have to use raw queries in order to rename columns.

sqlDB.raw("ALTER TABLE table RENAME COLUMN col1 TO col2")

I also tried using the new raw SQL helpers for Fluent, but the issue is something like .updateField(.sql(raw:)) appends ALTER COLUMN, so it would not work (for Postgres) at least.

It would be nice to have a solution built into schema builder, that allowed something like:

schemaBuilder.rename("col1", to: "col2")

or just another raw SQL helper to add a complete raw expression to the schema builder.

madsodgaard avatar Nov 18 '20 11:11 madsodgaard