You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this setup, an entry is “soft-deleted” by setting deleted_at. Additionally when using not_deleted as an GENERATED ALWAYS column, it should probably not be part of insert or update statements. However insert with MutableColumns includes the virtual column, causing an error since MySQL does not allow direct insertion into a GENERATED ALWAYS column.
Background: The nullable generated column helps with the unique constraint over non-deleted rows.
Describe the solution you'd like
Properly detect and exclude GENERATED ALWAYS columns from the mutable columns so that the schema above can be used without causing SQL errors. This would allow GENERATED ALWAYS columns to work as intended, without manual workarounds in or around the generated code, which excludes the column manually.
The text was updated successfully, but these errors were encountered:
Related Issues
#209
#300
This seems to be solved for PostgreSQL already, so opening another issue for MySQL.
Is your feature request related to a problem? Please describe.
If having a MySQL table for e.g. cars that supports soft deletion via a generated column. The schema could look like this:
With this setup, an entry is “soft-deleted” by setting
deleted_at
. Additionally when usingnot_deleted
as anGENERATED ALWAYS
column, it should probably not be part of insert or update statements. However insert withMutableColumns
includes the virtual column, causing an error since MySQL does not allow direct insertion into a GENERATED ALWAYS column.Background: The nullable generated column helps with the unique constraint over non-deleted rows.
Describe the solution you'd like
Properly detect and exclude
GENERATED ALWAYS
columns from the mutable columns so that the schema above can be used without causing SQL errors. This would allowGENERATED ALWAYS
columns to work as intended, without manual workarounds in or around the generated code, which excludes the column manually.The text was updated successfully, but these errors were encountered: