Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(api): add created and updated timestamps to profile #928

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
Column,
CreateDateColumn,
Entity,
Index,
JoinColumn,
OneToMany,
OneToOne,
Point,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from "typeorm";

import { OrganizationMembership } from "src/core/organizations/infrastructure/entities/organization-membership.entity";
Expand Down Expand Up @@ -43,4 +45,14 @@ export class Profile {
@Index({ unique: true })
@Column({ length: 128 })
userId!: string;

@CreateDateColumn({
type: "timestamp without time zone",
})
createdAt!: Date;

@UpdateDateColumn({
type: "timestamp without time zone",
})
updatedAt!: Date;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddCreatedAndUpdatedAtToProfile1721939780655 implements MigrationInterface {
name = 'AddCreatedAndUpdatedAtToProfile1721939780655'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "profile" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`);
await queryRunner.query(`ALTER TABLE "profile" ADD "updatedAt" TIMESTAMP NOT NULL DEFAULT now()`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "profile" DROP COLUMN "updatedAt"`);
await queryRunner.query(`ALTER TABLE "profile" DROP COLUMN "createdAt"`);
}

}
Loading