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

Always use mapped type #581

Merged
merged 2 commits into from
Dec 9, 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
9 changes: 0 additions & 9 deletions api/src/db/migrations/Migration20240627115306.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Migration } from "@mikro-orm/migrations";

export class Migration20220721122758 extends Migration {
export class Migration20241204114353 extends Migration {
async up(): Promise<void> {
this.addSql(
'create table "Page" ("id" uuid not null, "content" json not null, "stage" json not null, "seo" json not null, "createdAt" timestamp with time zone not null, "updatedAt" timestamp with time zone not null);',
'create table "Footer" ("id" uuid not null, "content" json not null, "scope_domain" text not null, "scope_language" text not null, "createdAt" timestamptz(0) not null, "updatedAt" timestamptz(0) not null, constraint "Footer_pkey" primary key ("id"));',
);
this.addSql('alter table "Page" add constraint "Page_pkey" primary key ("id");');

this.addSql(
'create table "Link" ("id" uuid not null, "content" json not null, "createdAt" timestamp with time zone not null, "updatedAt" timestamp with time zone not null);',
'create table "Link" ("id" uuid not null, "content" json not null, "createdAt" timestamptz(0) not null, "updatedAt" timestamptz(0) not null, constraint "Link_pkey" primary key ("id"));',
);

this.addSql(
'create table "Page" ("id" uuid not null, "content" json not null, "seo" json not null, "stage" json not null, "createdAt" timestamptz(0) not null, "updatedAt" timestamptz(0) not null, constraint "Page_pkey" primary key ("id"));',
);
this.addSql('alter table "Link" add constraint "Link_pkey" primary key ("id");');

this.addSql(
'alter table "PageTreeNode" add column "scope_domain" text not null, add column "scope_language" text not null, add column "category" text check ("category" in (\'MainNavigation\')) not null default \'MainNavigation\';',
Expand Down
4 changes: 2 additions & 2 deletions api/src/documents/links/entities/link.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export class Link extends BaseEntity<Link, "id"> implements DocumentInterface {
content: BlockDataInterface;

@Property({
columnType: "timestamp with time zone",
type: "timestamp with time zone",
})
@Field()
createdAt: Date = new Date();

@Property({
columnType: "timestamp with time zone",
type: "timestamp with time zone",
onUpdate: () => new Date(),
})
@Field()
Expand Down
4 changes: 2 additions & 2 deletions api/src/documents/pages/entities/page.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export class Page extends BaseEntity<Page, "id"> implements DocumentInterface {
stage: BlockDataInterface;

@Property({
columnType: "timestamp with time zone",
type: "timestamp with time zone",
})
@Field()
createdAt: Date = new Date();

@Property({
columnType: "timestamp with time zone",
type: "timestamp with time zone",
onUpdate: () => new Date(),
})
@Field()
Expand Down
4 changes: 2 additions & 2 deletions api/src/footers/dto/footer-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { IsString } from "class-validator";
@ObjectType()
@InputType("FooterScopeInput")
export class FooterScope {
@Property({ columnType: "text" })
@Property({ type: "text" })
@Field()
@IsString()
domain: string;

@Property({ columnType: "text" })
@Property({ type: "text" })
@Field()
@IsString()
language: string;
Expand Down
4 changes: 2 additions & 2 deletions api/src/footers/entities/footer.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export class Footer extends BaseEntity<Footer, "id"> implements DocumentInterfac
@Field(() => FooterScope)
scope: FooterScope;

@Property({ columnType: "timestamp with time zone" })
@Property({ type: "timestamp with time zone" })
@Field()
createdAt: Date = new Date();

@Property({ columnType: "timestamp with time zone", onUpdate: () => new Date() })
@Property({ type: "timestamp with time zone", onUpdate: () => new Date() })
@Field()
updatedAt: Date = new Date();
}
3 changes: 2 additions & 1 deletion project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ prelogin
rdndmb
requirepass
schemaname
tablename
tablename
timestamptz
Loading