generateMigrationScript ignores type change from varchar to text
Exposed 0.56.0, postgres.
Actual: When I only change the column type, the resulting file is empty. If I also change the column name, the file contains addion of the new text column and removal of the old one.
Expected:
Something like ALTER TABLE your_table ALTER COLUMN your_column TYPE TEXT;.
Summary I found a bug in Exposed 0.56.0 where PostgreSQL migration scripts were generated empty for column type changes. I have submitted a fix to enable proper ALTER COLUMN ... TYPE detection in PostgreSQLDialect.
Submitted PR: 👉 PR #2715
i don't know if this is related to this issue but;
internal object AuditsTable : IntIdTable("insurance_audits") {
// ...
val operation = json<Operation>("operation", DefaultJson)
// ...
}
when i create a table like this then run generateMigrationScript on it, generates;
ALTER TABLE insurance_audits DROP CONSTRAINT operation;
which will create a startup error where it cannot find the CONSTRAINT called operation which is a check;
this issue started happening after i updated to the latest version of exposed at some point, however i'm not exactly sure which version caused this error. this table of mine was always there and i was using the generate migration script method from the beginning and this is the first time i'm seeing the method creates a faulty migration sql.
if this is not really related to this issue, i can create an another issue just about this bug.
Hi @portlek Please confirm whether the database you're using is MariaDB. The migration methods now include check constraints as part of the schema diff. With MariaDB, the JSON data type is internally just an alias for LONGTEXT with a check constraint. So Exposed now correctly detects these check constraints, but then attempts to drop them, which fails because they can't be accessed.
We've already merged a fix to have the schema diff ignore this specific case with MariaDB + JSON, which will be available in upcoming release 1.3.0. If it's not MariaDB you're using, please let us know so we can address this asap.
Full details in our issue tracker --> EXPOSED-1015
@bog-walk thanks's for the clarification. yes i'm using mariadb and glad to hear it being fixed already!