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
Is your feature request related to a problem? Please describe.
Although MicroORM does not explicitly support MySql virtual columns, I can create one quite easily using columnType, e.g.
@Entity
class Foo {
@Property({ columnType: 'bool GENERATED ALWAYS AS (<SOME EXPRESSION>))' })
generated_value?: boolean
}
This appears to work fine, except that each mikro-orm migration:create will produce an alter table ... modify ... for that column, because the generator expression is currently not read back from the information schema.
Describe the solution you'd like
I understand that implementing virtual columns properly would be a major effort.
For now, I would be happy if I could tell MicroORM to just ignore that column when generating migrations.
If it helps, I would even be fine with the column not beeing part of the entity class, i.e. not having MikroORM be aware of it at all.
Describe alternatives you've considered
I'm using the virtual column to enforce a partial uniqueness constraint on the table, and I would have to find a completely different solution to doing that, e.g. triggers (which MikroORM also does not support at the moment, I think?) or just using LOCK TABLES.
The text was updated successfully, but these errors were encountered:
```ts
@Property({
columnType: 'timestamp',
extra: 'VIRTUAL GENERATED',
ignoreSchemaChanges: ['type', 'extra'],
})
changingField!: Date;
```
This is useful for situations such as mikro-orm#1904, where `knex` is unable to
properly diff the column.
```ts
@Property({
columnType: 'timestamp',
extra: 'VIRTUAL GENERATED',
ignoreSchemaChanges: ['type', 'extra'],
})
changingField!: Date;
```
This is useful for situations such as #1904, where `knex` is unable to properly diff the column.
Closes#1904
Is your feature request related to a problem? Please describe.
Although MicroORM does not explicitly support MySql virtual columns, I can create one quite easily using
columnType
, e.g.This appears to work fine, except that each
mikro-orm migration:create
will produce analter table ... modify ...
for that column, because the generator expression is currently not read back from the information schema.Describe the solution you'd like
I understand that implementing virtual columns properly would be a major effort.
For now, I would be happy if I could tell MicroORM to just ignore that column when generating migrations.
If it helps, I would even be fine with the column not beeing part of the entity class, i.e. not having MikroORM be aware of it at all.
Describe alternatives you've considered
I'm using the virtual column to enforce a partial uniqueness constraint on the table, and I would have to find a completely different solution to doing that, e.g. triggers (which MikroORM also does not support at the moment, I think?) or just using
LOCK TABLES
.The text was updated successfully, but these errors were encountered: