diff --git a/packages/api/src/entities/Contribution.ts b/packages/api/src/entities/Contribution.ts index 8c53519..529738c 100644 --- a/packages/api/src/entities/Contribution.ts +++ b/packages/api/src/entities/Contribution.ts @@ -10,6 +10,9 @@ export class Contribution extends Node { @Property({ columnType: 'text' }) nodeID: string; + @Property({ columnType: 'text' }) + authorGithubId: string; + @Property({ columnType: 'text' }) description: string; @@ -21,13 +24,14 @@ export class Contribution extends Node { @Property({ columnType: 'timestamp' }) contributedAt: Date; - + constructor({ nodeID, description, type, score, contributedAt, + authorGithubId, ...extraValues }: ContributionConstructorValues) { super(extraValues); @@ -36,5 +40,6 @@ export class Contribution extends Node { this.type = type; this.score = score; this.contributedAt = contributedAt; + this.authorGithubId = authorGithubId; } } diff --git a/packages/api/src/migrations/0007-add-author-github-id-to-contribution-table.ts b/packages/api/src/migrations/0007-add-author-github-id-to-contribution-table.ts new file mode 100644 index 0000000..5d225f0 --- /dev/null +++ b/packages/api/src/migrations/0007-add-author-github-id-to-contribution-table.ts @@ -0,0 +1,12 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20211122225031 extends Migration { + + async up(): Promise { + this.addSql('alter table "contribution" add column "authorGithubId" text not null;'); + } + + async down(): Promise { + this.addSql('alter table "contribution" drop column "authorGithubId";'); + } +}