Skip to content

Commit

Permalink
Added authorGithubId column to contributions table (based on PR Ameri…
Browse files Browse the repository at this point in the history
  • Loading branch information
NotKevin authored and NotKevin committed Nov 22, 2021
1 parent 0c184d5 commit ed9f86d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/api/src/entities/Contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export class Contribution extends Node<Contribution> {
@Property({ columnType: 'text' })
nodeID: string;

@Property({ columnType: 'text' })
authorGithubId: string;

@Property({ columnType: 'text' })
description: string;

Expand All @@ -21,13 +24,14 @@ export class Contribution extends Node<Contribution> {

@Property({ columnType: 'timestamp' })
contributedAt: Date;

constructor({
nodeID,
description,
type,
score,
contributedAt,
authorGithubId,
...extraValues
}: ContributionConstructorValues) {
super(extraValues);
Expand All @@ -36,5 +40,6 @@ export class Contribution extends Node<Contribution> {
this.type = type;
this.score = score;
this.contributedAt = contributedAt;
this.authorGithubId = authorGithubId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Migration } from '@mikro-orm/migrations';

export class Migration20211122225031 extends Migration {

async up(): Promise<void> {
this.addSql('alter table "contribution" add column "authorGithubId" text not null;');
}

async down(): Promise<void> {
this.addSql('alter table "contribution" drop column "authorGithubId";');
}
}

0 comments on commit ed9f86d

Please sign in to comment.