transform migrations to work with mysql, postgres and sqlite
sqlite currently fails syntax of views
This commit is contained in:
parent
2cee8b5119
commit
a73c712626
29 changed files with 1626 additions and 382 deletions
|
@ -8,18 +8,20 @@ import {
|
|||
UpdateDateColumn,
|
||||
AfterUpdate,
|
||||
BeforeUpdate,
|
||||
ColumnType,
|
||||
} from "typeorm";
|
||||
import { calendarType } from "../settings/calendarType";
|
||||
import { getTypeByORM } from "../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class calendar {
|
||||
@PrimaryGeneratedColumn("uuid")
|
||||
id: string;
|
||||
|
||||
@Column({ type: "datetime", nullable: false })
|
||||
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||
starttime: Date;
|
||||
|
||||
@Column({ type: "datetime", nullable: false })
|
||||
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||
endtime: Date;
|
||||
|
||||
@Column({ type: "varchar", length: 255, nullable: false })
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||||
import { membership } from "./membership";
|
||||
import { memberAwards } from "./memberAwards";
|
||||
import { memberQualifications } from "./memberQualifications";
|
||||
import { memberExecutivePositions } from "./memberExecutivePositions";
|
||||
import { communication } from "./communication";
|
||||
import { salutation } from "../../settings/salutation";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class member {
|
||||
|
@ -20,7 +21,7 @@ export class member {
|
|||
@Column({ type: "varchar", length: 255 })
|
||||
nameaffix: string;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
birthdate: Date;
|
||||
|
||||
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { member } from "./member";
|
||||
import { award } from "../../settings/award";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class memberAwards {
|
||||
|
@ -13,7 +14,7 @@ export class memberAwards {
|
|||
@Column({ type: "varchar", length: 255, nullable: true })
|
||||
note?: string;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
date: Date;
|
||||
|
||||
@Column()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { member } from "./member";
|
||||
import { executivePosition } from "../../settings/executivePosition";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class memberExecutivePositions {
|
||||
|
@ -10,10 +11,10 @@ export class memberExecutivePositions {
|
|||
@Column({ type: "varchar", length: 255, nullable: true })
|
||||
note?: string;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
start: Date;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||
end?: Date;
|
||||
|
||||
@Column()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { member } from "./member";
|
||||
import { qualification } from "../../settings/qualification";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class memberQualifications {
|
||||
|
@ -10,10 +11,10 @@ export class memberQualifications {
|
|||
@Column({ type: "varchar", length: 255, nullable: true })
|
||||
note?: string;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
start: Date;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||
end?: Date;
|
||||
|
||||
@Column({ type: "varchar", length: 255, nullable: true })
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { member } from "./member";
|
||||
import { membershipStatus } from "../../settings/membershipStatus";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class membership {
|
||||
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||
id: number;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
start: Date;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||
end?: Date;
|
||||
|
||||
@Column({ type: "varchar", length: 255, nullable: true })
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { protocolAgenda } from "./protocolAgenda";
|
||||
import { protocolDecision } from "./protocolDecision";
|
||||
import { protocolPresence } from "./protocolPresence";
|
||||
import { protocolPrintout } from "./protocolPrintout";
|
||||
import { protocolVoting } from "./protocolVoting";
|
||||
import { getTypeByORM } from "../../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class protocol {
|
||||
|
@ -13,13 +14,13 @@ export class protocol {
|
|||
@Column({ type: "varchar", length: 255, unique: true })
|
||||
title: string;
|
||||
|
||||
@Column({ type: "date" })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType })
|
||||
date: Date;
|
||||
|
||||
@Column({ type: "time", nullable: true })
|
||||
@Column({ type: getTypeByORM("time").type as ColumnType, nullable: true })
|
||||
starttime: Date;
|
||||
|
||||
@Column({ type: "time", nullable: true })
|
||||
@Column({ type: getTypeByORM("time").type as ColumnType, nullable: true })
|
||||
endtime: Date;
|
||||
|
||||
@Column({ type: "text", nullable: true })
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||
import { user } from "./user/user";
|
||||
import { getTypeByORM } from "../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class refresh {
|
||||
|
@ -9,7 +10,7 @@ export class refresh {
|
|||
@PrimaryColumn()
|
||||
userId: string;
|
||||
|
||||
@Column({ type: "datetime" })
|
||||
@Column({ type: getTypeByORM("datetime").type as ColumnType })
|
||||
expiry: Date;
|
||||
|
||||
@ManyToOne(() => user, {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Column, CreateDateColumn, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { Column, ColumnType, CreateDateColumn, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||
import { webapiPermission } from "./webapi_permission";
|
||||
import { getTypeByORM } from "../../migrations/ormHelper";
|
||||
|
||||
@Entity()
|
||||
export class webapi {
|
||||
|
@ -15,10 +16,10 @@ export class webapi {
|
|||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@Column({ type: "datetime", nullable: true })
|
||||
@Column({ type: getTypeByORM("datetime").type as ColumnType, nullable: true })
|
||||
lastUsage?: Date;
|
||||
|
||||
@Column({ type: "date", nullable: true })
|
||||
@Column({ type: getTypeByORM("date").type as ColumnType, nullable: true })
|
||||
expiry?: Date;
|
||||
|
||||
@OneToMany(() => webapiPermission, (apiPermission) => apiPermission.webapi, { cascade: ["insert"] })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue