I encountered an issue with the createdAt property while using graphql, typescript, mikro-orm and postgresql for implementing CRUD operations on posts:
DriverException: alter table "post" alter column "created_at" type timestamptz(0) using ("created_at"::timestamptz(0)); - cannot cast type jsonb to timestamp with time zone
Here is the entity definition for the createdAt property:
@Field(() => String)
@Property({ type: "date" })
createdAt = new Date();
Additionally, these are the migration snippets generated from the createdAt entity:
this.addSql('alter table "post" drop constraint if exists "post_created_at_check";');
this.addSql('alter table "post" alter column "created_at" type timestamptz(0) using ("created_at"::timestamptz(0));');
How can I resolve this error? What changes should I make to fix it?