I'm using NestJS along with Mikro-ORM and PostgreSQL for my project. I've run into an issue where Mikro-ORM continuously generates migration changes for certain fields even when there are no changes to the schema. This happens specifically for columns with the PostgreSQL text[] type.
Here is my entity definition for one of the affected columns:
@Field(() => [AdvertisingTag], { description: 'Werbe-Tag', defaultValue: [] })
@Enum({ items: () => AdvertisingTag, array: true, default: [] })
advertisingTag: AdvertisingTag[];
Every time I run the migration generation, I get the following SQL statement, despite having no changes in my schema:
alter table "Realty" alter column "object_advertisingTag" type text[] using ("object_advertisingTag"::text[]);
I verified that the database field type is text[].
It's interesting to note that for non-array enum types, this issue doesn't occur. For example:
@Field(() => UsageType, { description: 'Nutzungsart', defaultValue: UsageType.PRIVATE })
@Enum({ items: () => UsageType, default: UsageType.PRIVATE })
usageType: UsageType;
What am I missing here? Why does Mikro-ORM keep generating these migrations for text[] columns?