Skip to content

Commit

Permalink
chore: update type of bot events
Browse files Browse the repository at this point in the history
  • Loading branch information
DamirLut committed Apr 15, 2024
1 parent 1b63550 commit 13da829
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/entities/events.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export class BotEventsEntity extends BaseEntity {
@Property()
type: BotEvents;

@Property()
@Property({ type: 'text' })
message: string;

@Property({ nullable: true, default: null })
@Property({ type: 'text', nullable: true, default: null })
attachment: string | null;

@Property({ default: 0 })
Expand Down
8 changes: 4 additions & 4 deletions src/lib/orm/migrations/.snapshot-rgdbot_dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@
},
"message": {
"name": "message",
"type": "varchar(255)",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"mappedType": "string"
"mappedType": "text"
},
"attachment": {
"name": "attachment",
"type": "varchar(255)",
"type": "text",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"default": "null",
"mappedType": "string"
"mappedType": "text"
},
"triggered_count": {
"name": "triggered_count",
Expand Down
15 changes: 15 additions & 0 deletions src/lib/orm/migrations/Migration20240415205714.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Migration } from '@mikro-orm/migrations';

export class Migration20240415205714 extends Migration {

async up(): Promise<void> {
this.addSql('alter table "bot_events" alter column "message" type text using ("message"::text);');
this.addSql('alter table "bot_events" alter column "attachment" type text using ("attachment"::text);');
}

async down(): Promise<void> {
this.addSql('alter table "bot_events" alter column "message" type varchar(255) using ("message"::varchar(255));');
this.addSql('alter table "bot_events" alter column "attachment" type varchar(255) using ("attachment"::varchar(255));');
}

}

0 comments on commit 13da829

Please sign in to comment.