Skip to content

Commit

Permalink
Merge pull request #1715 from OneUptime/createdat-date
Browse files Browse the repository at this point in the history
Createdat date
  • Loading branch information
simlarsen authored Sep 24, 2024
2 parents 51334d8 + 1577f72 commit 211ac48
Show file tree
Hide file tree
Showing 11 changed files with 2,290 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { PlanType } from "../../../Types/Billing/SubscriptionPlan";
import { getColumnAccessControlForAllColumns } from "../../../Types/Database/AccessControl/ColumnAccessControl";
import { getColumnBillingAccessControlForAllColumns } from "../../../Types/Database/AccessControl/ColumnBillingAccessControl";
import Columns from "../../../Types/Database/Columns";
import ColumnType from "../../../Types/Database/ColumnType";
import TableColumn, {
TableColumnMetadata,
getTableColumn,
Expand Down Expand Up @@ -63,23 +64,29 @@ export default class DatabaseBaseModel extends BaseEntity {
type: TableColumnType.Date,
description: "Date and Time when the object was created.",
})
@CreateDateColumn()
@CreateDateColumn({
type: ColumnType.Date,
})
public createdAt?: Date = undefined;

@TableColumn({
title: "Updated",
type: TableColumnType.Date,
description: "Date and Time when the object was updated.",
})
@UpdateDateColumn()
@UpdateDateColumn({
type: ColumnType.Date,
})
public updatedAt?: Date = undefined;

@TableColumn({
title: "Deleted",
type: TableColumnType.Date,
description: "Date and Time when the object was deleted.",
})
@DeleteDateColumn()
@DeleteDateColumn({
type: ColumnType.Date,
})
public deletedAt?: Date = undefined;

@TableColumn({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class MigrationName1727192530019 implements MigrationInterface {
public name = "MigrationName1727192530019";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "File" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "File" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class MigrationName1727193130193 implements MigrationInterface {
public name = "MigrationName1727193130193";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "User" ALTER COLUMN "createdAt" TYPE TIMESTAMP WITH TIME ZONE`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "User" ALTER COLUMN "createdAt" TYPE TIMESTAMP`,
);
}
}
Loading

0 comments on commit 211ac48

Please sign in to comment.