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

Delete field constraint

Open Blejwi opened this issue 6 years ago • 2 comments

Hello,

I have model in my application where one of the fields is notNull. I Would like to write manual migration where I delete this constraint, but I can't find any builder method that allows me to do so.

I found only schemaConstraintDelete method on builder, but I'm not sure if I can use it to delete field constraint.

Is there any way to delete notNull, default or other SQLColumnConstraint from my model table?

Blejwi avatar Feb 11 '19 12:02 Blejwi

This would require an ALTER COLUMN query which I don't believe Fluent supports at the moment. In the meantime, you should be able to do this query with SQL manually using conn.raw("...") in the migration.

tanner0101 avatar Feb 12 '19 19:02 tanner0101

So looks like FluentKit can now alter columns to change column types by using the updateField API, but there's still no way to delete a field constraint, it seems like you can only add them. This would be a great addition!

0xTim avatar Jul 29 '20 20:07 0xTim