communication update (breaking schema - clear database before use)
This commit is contained in:
parent
837b67e648
commit
cc3975978a
21 changed files with 248 additions and 307 deletions
|
@ -1,18 +1,17 @@
|
||||||
import "dotenv/config";
|
import "dotenv/config";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { DataSource } from "typeorm";
|
import { DataSource } from "typeorm";
|
||||||
import { member } from "./entities/member";
|
|
||||||
import { executive_position } from "./entities/executive_position";
|
|
||||||
import { qualification } from "./entities/qualification";
|
|
||||||
import { member_awards } from "./entities/member_awards";
|
|
||||||
import { award } from "./entities/award";
|
import { award } from "./entities/award";
|
||||||
import { city } from "./entities/city";
|
import { communication } from "./entities/communication";
|
||||||
import { city_district } from "./entities/city_district";
|
import { executive_position } from "./entities/executive_position";
|
||||||
|
import { member_awards } from "./entities/member_awards";
|
||||||
|
import { member_executive_positions } from "./entities/member_executive_positions";
|
||||||
|
import { member_qualifications } from "./entities/member_qualifications";
|
||||||
|
import { member } from "./entities/member";
|
||||||
import { membership } from "./entities/membership";
|
import { membership } from "./entities/membership";
|
||||||
import { authentication } from "./entities/authentication";
|
import { membership_status } from "./entities/membership_status";
|
||||||
import { session } from "./entities/session";
|
import { qualification } from "./entities/qualification";
|
||||||
import { Initial1723905344553 } from "./migrations/1723905344553-initial";
|
import { Initial1724242210553 } from "./migrations/1724242210553-initial";
|
||||||
import { SplitMember1724064152696 } from "./migrations/1724064152696-split_member";
|
|
||||||
|
|
||||||
const dataSource = new DataSource({
|
const dataSource = new DataSource({
|
||||||
type: "mysql",
|
type: "mysql",
|
||||||
|
@ -25,18 +24,18 @@ const dataSource = new DataSource({
|
||||||
logging: process.env.NODE_ENV ? true : ["schema", "error", "warn", "log", "migration"],
|
logging: process.env.NODE_ENV ? true : ["schema", "error", "warn", "log", "migration"],
|
||||||
bigNumberStrings: false,
|
bigNumberStrings: false,
|
||||||
entities: [
|
entities: [
|
||||||
member,
|
|
||||||
executive_position,
|
|
||||||
qualification,
|
|
||||||
member_awards,
|
|
||||||
award,
|
award,
|
||||||
city,
|
communication,
|
||||||
city_district,
|
executive_position,
|
||||||
|
member_awards,
|
||||||
|
member_executive_positions,
|
||||||
|
member_qualifications,
|
||||||
|
member,
|
||||||
membership,
|
membership,
|
||||||
authentication,
|
membership_status,
|
||||||
session,
|
qualification,
|
||||||
],
|
],
|
||||||
migrations: [Initial1723905344553, SplitMember1724064152696],
|
migrations: [Initial1724242210553],
|
||||||
migrationsRun: true,
|
migrationsRun: true,
|
||||||
migrationsTransactionMode: "each",
|
migrationsTransactionMode: "each",
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
import { Column, Entity, PrimaryColumn } from "typeorm";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class authentication {
|
|
||||||
@PrimaryColumn({ type: "varchar", length: 36 })
|
|
||||||
username: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
|
||||||
secret: string;
|
|
||||||
}
|
|
|
@ -3,8 +3,8 @@ import { member_awards } from "./member_awards";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class award {
|
export class award {
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
id: string;
|
id: number;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
award: string;
|
award: string;
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
|
||||||
import { member } from "./member";
|
|
||||||
import { city_district } from "./city_district";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class city {
|
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, unique: true })
|
|
||||||
postal_code: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
|
||||||
city: string;
|
|
||||||
|
|
||||||
@OneToMany(() => city_district, (district) => district.city, {
|
|
||||||
onDelete: "RESTRICT",
|
|
||||||
})
|
|
||||||
districts: city_district[];
|
|
||||||
|
|
||||||
@OneToMany(() => member, (member) => member.city_district, {
|
|
||||||
onDelete: "RESTRICT",
|
|
||||||
})
|
|
||||||
members: member[];
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn } from "typeorm";
|
|
||||||
import { member } from "./member";
|
|
||||||
import { city } from "./city";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class city_district {
|
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
|
||||||
district?: string;
|
|
||||||
|
|
||||||
@ManyToOne(() => city, (city) => city.districts)
|
|
||||||
@JoinColumn()
|
|
||||||
city: city;
|
|
||||||
|
|
||||||
@OneToMany(() => member, (member) => member.city_district, {
|
|
||||||
onDelete: "RESTRICT",
|
|
||||||
})
|
|
||||||
members: member[];
|
|
||||||
}
|
|
38
entities/communication.ts
Normal file
38
entities/communication.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||||
|
import { member } from "./member";
|
||||||
|
import { CommunicationType } from "../enums/membership_type";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class communication {
|
||||||
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({ type: "enum", enum: CommunicationType, default: CommunicationType.Phone })
|
||||||
|
type: CommunicationType;
|
||||||
|
|
||||||
|
@Column({ type: "boolean", default: false })
|
||||||
|
preffered: boolean;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
mobile: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
email: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
city: string;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
street: string;
|
||||||
|
|
||||||
|
@Column({ type: "integer" })
|
||||||
|
streetnumber: number;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
streetnumber_addition: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => member, (member) => member.awards, {
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
})
|
||||||
|
member: member;
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import { Column, Entity, ManyToMany, PrimaryColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||||
import { member } from "./member";
|
import { member_executive_positions } from "./member_executive_positions";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class executive_position {
|
export class executive_position {
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
id: string;
|
id: number;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
postition: string;
|
postition: string;
|
||||||
|
@ -12,8 +12,12 @@ export class executive_position {
|
||||||
@Column({ type: "int", default: -1 })
|
@Column({ type: "int", default: -1 })
|
||||||
number_of_performers: string;
|
number_of_performers: string;
|
||||||
|
|
||||||
@ManyToMany(() => member, (member) => member.positions, {
|
@OneToMany(
|
||||||
onDelete: "RESTRICT",
|
() => member_executive_positions,
|
||||||
})
|
(member_executive_positions) => member_executive_positions.executive_position,
|
||||||
members: member[];
|
{
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
members: member_executive_positions[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryColumn } from "typeorm";
|
import { Column, Entity, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||||||
import { executive_position } from "./executive_position";
|
|
||||||
import { qualification } from "./qualification";
|
|
||||||
import { city_district } from "./city_district";
|
|
||||||
import { Salutation } from "../enums/salutation";
|
import { Salutation } from "../enums/salutation";
|
||||||
import { city } from "./city";
|
|
||||||
import { membership } from "./membership";
|
import { membership } from "./membership";
|
||||||
import { NewsletterType } from "../enums/newsletter_type";
|
|
||||||
import { member_awards } from "./member_awards";
|
import { member_awards } from "./member_awards";
|
||||||
|
import { member_qualifications } from "./member_qualifications";
|
||||||
|
import { member_executive_positions } from "./member_executive_positions";
|
||||||
|
import { communication } from "./communication";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class member {
|
export class member {
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
id: string;
|
id: number;
|
||||||
|
|
||||||
@Column({ type: "enum", enum: Salutation, default: Salutation.none })
|
|
||||||
salutation: Salutation;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
||||||
member_id?: string;
|
member_id?: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
@Column({ type: "enum", enum: Salutation, default: Salutation.none })
|
||||||
sepa_mandat?: string;
|
salutation: Salutation;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
@ -29,19 +24,7 @@ export class member {
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
phone: string;
|
nameaffix: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
|
||||||
mobile: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
|
||||||
email: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
|
||||||
official_email?: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
|
||||||
street: string;
|
|
||||||
|
|
||||||
@Column({ type: "date" })
|
@Column({ type: "date" })
|
||||||
birthdate: Date;
|
birthdate: Date;
|
||||||
|
@ -49,40 +32,29 @@ export class member {
|
||||||
@Column({ type: "date", nullable: true, default: null })
|
@Column({ type: "date", nullable: true, default: null })
|
||||||
deathdate?: Date;
|
deathdate?: Date;
|
||||||
|
|
||||||
@Column({ type: "boolean", default: false })
|
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
||||||
push_alert: boolean;
|
sepa_mandat?: string;
|
||||||
|
|
||||||
@Column({ type: "enum", enum: NewsletterType, default: NewsletterType.Online })
|
@ManyToOne(() => communication, (member_communications) => member_communications.member)
|
||||||
newsletter: NewsletterType;
|
communications: communication;
|
||||||
|
|
||||||
|
@OneToOne(() => communication, {
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
sendNewsletter: communication;
|
||||||
|
|
||||||
@OneToMany(() => membership, (membership) => membership.member)
|
@OneToMany(() => membership, (membership) => membership.member)
|
||||||
memberships: membership[];
|
memberships: membership[];
|
||||||
|
|
||||||
@ManyToOne(() => city, (city) => city.members)
|
@OneToMany(() => member_executive_positions, (member_executive_positions) => member_executive_positions.member, {
|
||||||
@JoinColumn({
|
|
||||||
name: "city",
|
|
||||||
})
|
|
||||||
city: city;
|
|
||||||
|
|
||||||
@ManyToOne(() => city_district, (city_district) => city_district.members, {
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
@JoinColumn({
|
|
||||||
name: "district",
|
|
||||||
})
|
|
||||||
city_district: city_district;
|
|
||||||
|
|
||||||
@ManyToMany(() => executive_position, (executive_position) => executive_position.members, {
|
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinTable({ name: "member_executive_position" })
|
positions: member_executive_positions[];
|
||||||
positions: executive_position[];
|
|
||||||
|
|
||||||
@ManyToMany(() => qualification, (qualification) => qualification.members, {
|
@OneToMany(() => member_qualifications, (qualification) => qualification.member, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
})
|
})
|
||||||
@JoinTable({ name: "member_qualification" })
|
qualifications: member_qualifications[];
|
||||||
qualifications: qualification[];
|
|
||||||
|
|
||||||
@OneToMany(() => member_awards, (awards) => awards.member, {
|
@OneToMany(() => member_awards, (awards) => awards.member, {
|
||||||
onDelete: "CASCADE",
|
onDelete: "CASCADE",
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
import { Column, Entity, ManyToOne, PrimaryColumn, Unique } from "typeorm";
|
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||||
import { member } from "./member";
|
import { member } from "./member";
|
||||||
import { award } from "./award";
|
import { award } from "./award";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@Unique(["memberId", "awardId"])
|
|
||||||
export class member_awards {
|
export class member_awards {
|
||||||
@PrimaryColumn({ type: "varchar", length: 36 })
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
memberId: string;
|
id: number;
|
||||||
|
|
||||||
@PrimaryColumn({ type: "varchar", length: 36 })
|
|
||||||
awardId: string;
|
|
||||||
|
|
||||||
@Column({ type: "boolean", default: true })
|
@Column({ type: "boolean", default: true })
|
||||||
given: boolean;
|
given: boolean;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
||||||
reason?: string;
|
note?: string;
|
||||||
|
|
||||||
@Column({ type: "date" })
|
@Column({ type: "date" })
|
||||||
date: Date;
|
date: Date;
|
||||||
|
|
28
entities/member_executive_positions.ts
Normal file
28
entities/member_executive_positions.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||||
|
import { member } from "./member";
|
||||||
|
import { executive_position } from "./executive_position";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class member_executive_positions {
|
||||||
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({ type: "boolean", default: true })
|
||||||
|
given: boolean;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
||||||
|
note?: string;
|
||||||
|
|
||||||
|
@Column({ type: "date" })
|
||||||
|
date: Date;
|
||||||
|
|
||||||
|
@ManyToOne(() => member, (member) => member.awards, {
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
})
|
||||||
|
member: member;
|
||||||
|
|
||||||
|
@ManyToOne(() => executive_position, (executive_position) => executive_position.members, {
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
})
|
||||||
|
executive_position: executive_position;
|
||||||
|
}
|
28
entities/member_qualifications.ts
Normal file
28
entities/member_qualifications.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
||||||
|
import { member } from "./member";
|
||||||
|
import { qualification } from "./qualification";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class member_qualifications {
|
||||||
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({ type: "boolean", default: true })
|
||||||
|
given: boolean;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
||||||
|
note?: string;
|
||||||
|
|
||||||
|
@Column({ type: "date" })
|
||||||
|
date: Date;
|
||||||
|
|
||||||
|
@ManyToOne(() => member, (member) => member.awards, {
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
})
|
||||||
|
member: member;
|
||||||
|
|
||||||
|
@ManyToOne(() => qualification, (qualification) => qualification.members, {
|
||||||
|
onDelete: "RESTRICT",
|
||||||
|
})
|
||||||
|
qualification: qualification;
|
||||||
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
||||||
import { member } from "./member";
|
import { member } from "./member";
|
||||||
import { MembershipType } from "../enums/membership_type";
|
import { membership_status } from "./membership_status";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class membership {
|
export class membership {
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
id: string;
|
id: number;
|
||||||
|
|
||||||
@Column({ type: "date" })
|
@Column({ type: "date" })
|
||||||
start: Date;
|
start: Date;
|
||||||
|
@ -13,13 +13,14 @@ export class membership {
|
||||||
@Column({ type: "date", nullable: true, default: null })
|
@Column({ type: "date", nullable: true, default: null })
|
||||||
end?: Date;
|
end?: Date;
|
||||||
|
|
||||||
@Column({ type: "enum", enum: MembershipType, default: MembershipType.Active })
|
|
||||||
type: MembershipType;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, nullable: true })
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
reason?: string;
|
termination_reason?: string;
|
||||||
|
|
||||||
@ManyToOne(() => member, (member) => member.memberships)
|
@ManyToOne(() => member, (member) => member.memberships)
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
member: member;
|
member: member;
|
||||||
|
|
||||||
|
@ManyToOne(() => membership_status, (membership_status) => membership_status.memberships)
|
||||||
|
@JoinColumn()
|
||||||
|
status: membership_status;
|
||||||
}
|
}
|
||||||
|
|
14
entities/membership_status.ts
Normal file
14
entities/membership_status.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||||
|
import { membership } from "./membership";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class membership_status {
|
||||||
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
status: string;
|
||||||
|
|
||||||
|
@OneToMany(() => membership, (membership) => membership.status)
|
||||||
|
memberships: membership[];
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import { Column, Entity, ManyToMany, PrimaryColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
|
||||||
import { member } from "./member";
|
import { member_qualifications } from "./member_qualifications";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class qualification {
|
export class qualification {
|
||||||
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||||||
id: string;
|
id: number;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255 })
|
@Column({ type: "varchar", length: 255 })
|
||||||
qualification: string;
|
qualification: string;
|
||||||
|
@ -12,8 +12,8 @@ export class qualification {
|
||||||
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
@Column({ type: "varchar", length: 255, nullable: true, default: null })
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
@ManyToMany(() => member, (member) => member.positions, {
|
@OneToMany(() => member_qualifications, (member_qualifications) => member_qualifications.qualification, {
|
||||||
onDelete: "RESTRICT",
|
onDelete: "RESTRICT",
|
||||||
})
|
})
|
||||||
members: member[];
|
members: member_qualifications[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
|
||||||
import { member } from "./member";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class session {
|
|
||||||
@PrimaryColumn({ type: "varchar", length: 36 })
|
|
||||||
accessToken: string;
|
|
||||||
|
|
||||||
@Column({ type: "datetime" })
|
|
||||||
expiration: Date;
|
|
||||||
|
|
||||||
@ManyToOne(() => member)
|
|
||||||
member: member;
|
|
||||||
}
|
|
|
@ -1,4 +1,7 @@
|
||||||
export enum MembershipType {
|
export enum CommunicationType {
|
||||||
Active = "active",
|
Phone = "phone",
|
||||||
Passive = "passive",
|
Mobile = "mobile",
|
||||||
|
Address = "address",
|
||||||
|
Mail = "mail",
|
||||||
|
InternalMail = "internalMail",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
export enum NewsletterType {
|
|
||||||
Online = "online",
|
|
||||||
Offline = "offline",
|
|
||||||
None = "none",
|
|
||||||
}
|
|
17
index.ts
17
index.ts
|
@ -2,17 +2,16 @@ import "dotenv/config";
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
|
|
||||||
export { dataSource } from "./data-source";
|
export { dataSource } from "./data-source";
|
||||||
export { member } from "./entities/member";
|
export { award } from "./entities/award";
|
||||||
export { qualification } from "./entities/qualification";
|
export { communication } from "./entities/communication";
|
||||||
export { executive_position } from "./entities/executive_position";
|
export { executive_position } from "./entities/executive_position";
|
||||||
export { member_awards } from "./entities/member_awards";
|
export { member_awards } from "./entities/member_awards";
|
||||||
export { award } from "./entities/award";
|
export { member_executive_positions } from "./entities/member_executive_positions";
|
||||||
export { city } from "./entities/city";
|
export { member_qualifications } from "./entities/member_qualifications";
|
||||||
export { city_district } from "./entities/city_district";
|
export { member } from "./entities/member";
|
||||||
export { membership } from "./entities/membership";
|
export { membership } from "./entities/membership";
|
||||||
export { authentication } from "./entities/authentication";
|
export { membership_status } from "./entities/membership_status";
|
||||||
export { session } from "./entities/session";
|
export { qualification } from "./entities/qualification";
|
||||||
|
|
||||||
export { MembershipType } from "./enums/membership_type";
|
export { CommunicationType } from "./enums/membership_type";
|
||||||
export { NewsletterType } from "./enums/newsletter_type";
|
|
||||||
export { Salutation } from "./enums/salutation";
|
export { Salutation } from "./enums/salutation";
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
||||||
|
|
||||||
export class Initial1723905344553 implements MigrationInterface {
|
|
||||||
name = 'Initial1723905344553'
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.query(`CREATE TABLE \`executive_position\` (\`id\` varchar(36) NOT NULL, \`postition\` varchar(255) NOT NULL, \`number_of_performers\` int NOT NULL DEFAULT '1', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`qualification\` (\`id\` varchar(36) NOT NULL, \`qualification\` varchar(255) NOT NULL, \`number_of_performers\` int NOT NULL DEFAULT '1', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`member\` (\`id\` varchar(36) NOT NULL, \`member_id\` varchar(255) NULL, \`firstname\` varchar(255) NOT NULL, \`lastname\` varchar(255) NOT NULL, \`phone\` varchar(255) NOT NULL, \`mobile\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`postal_code\` varchar(255) NOT NULL, \`place\` varchar(255) NOT NULL, \`street\` varchar(255) NOT NULL, \`birthdate\` date NOT NULL, \`accession_date\` date NOT NULL, \`leaving_data\` date NULL, \`active\` tinyint NOT NULL DEFAULT 1, \`push_alert\` tinyint NOT NULL DEFAULT 0, UNIQUE INDEX \`IDX_73e1828d94de0b2ddf89da0546\` (\`member_id\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`authentication\` (\`username\` varchar(36) NOT NULL, \`secret\` varchar(255) NOT NULL, PRIMARY KEY (\`username\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`session\` (\`accessToken\` varchar(36) NOT NULL, \`expiration\` datetime NOT NULL, \`memberId\` varchar(36) NULL, PRIMARY KEY (\`accessToken\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`member_executive_position\` (\`memberId\` varchar(36) NOT NULL, \`executivePositionId\` varchar(36) NOT NULL, INDEX \`IDX_d624e879b218a815ba6280ee03\` (\`memberId\`), INDEX \`IDX_871ad125ada81704d0ff5f77fd\` (\`executivePositionId\`), PRIMARY KEY (\`memberId\`, \`executivePositionId\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`member_qualification\` (\`memberId\` varchar(36) NOT NULL, \`qualificationId\` varchar(36) NOT NULL, INDEX \`IDX_6e044da7d52bc06dbe86451acd\` (\`memberId\`), INDEX \`IDX_0cd599d7a2617a381266258693\` (\`qualificationId\`), PRIMARY KEY (\`memberId\`, \`qualificationId\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` ADD CONSTRAINT \`FK_1f8d57f74fb4486a743d89d4820\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_executive_position\` ADD CONSTRAINT \`FK_d624e879b218a815ba6280ee035\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_executive_position\` ADD CONSTRAINT \`FK_871ad125ada81704d0ff5f77fda\` FOREIGN KEY (\`executivePositionId\`) REFERENCES \`executive_position\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_qualification\` ADD CONSTRAINT \`FK_6e044da7d52bc06dbe86451acdc\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE CASCADE ON UPDATE CASCADE`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_qualification\` ADD CONSTRAINT \`FK_0cd599d7a2617a3812662586930\` FOREIGN KEY (\`qualificationId\`) REFERENCES \`qualification\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_qualification\` DROP FOREIGN KEY \`FK_0cd599d7a2617a3812662586930\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_qualification\` DROP FOREIGN KEY \`FK_6e044da7d52bc06dbe86451acdc\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_executive_position\` DROP FOREIGN KEY \`FK_871ad125ada81704d0ff5f77fda\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_executive_position\` DROP FOREIGN KEY \`FK_d624e879b218a815ba6280ee035\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` DROP FOREIGN KEY \`FK_1f8d57f74fb4486a743d89d4820\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_0cd599d7a2617a381266258693\` ON \`member_qualification\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_6e044da7d52bc06dbe86451acd\` ON \`member_qualification\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`member_qualification\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_871ad125ada81704d0ff5f77fd\` ON \`member_executive_position\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_d624e879b218a815ba6280ee03\` ON \`member_executive_position\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`member_executive_position\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`session\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`authentication\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_73e1828d94de0b2ddf89da0546\` ON \`member\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`member\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`qualification\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`executive_position\``);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
||||||
|
|
||||||
export class SplitMember1724064152696 implements MigrationInterface {
|
|
||||||
name = 'SplitMember1724064152696'
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.query(`ALTER TABLE \`qualification\` CHANGE \`number_of_performers\` \`description\` int NOT NULL DEFAULT '1'`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`city\` (\`id\` varchar(36) NOT NULL, \`postal_code\` varchar(255) NOT NULL, \`city\` varchar(255) NOT NULL, UNIQUE INDEX \`IDX_cc45d5049db48b8d7c0f9cf2b3\` (\`postal_code\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`city_district\` (\`id\` varchar(36) NOT NULL, \`district\` varchar(255) NULL, \`cityId\` varchar(36) NULL, UNIQUE INDEX \`IDX_9c5511a4d64dda3dc96472db53\` (\`district\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`membership\` (\`id\` varchar(36) NOT NULL, \`start\` date NOT NULL, \`end\` date NULL, \`type\` enum ('active', 'passive') NOT NULL DEFAULT 'active', \`reason\` varchar(255) NULL, \`memberId\` varchar(36) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`award\` (\`id\` varchar(36) NOT NULL, \`award\` varchar(255) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`CREATE TABLE \`member_awards\` (\`memberId\` varchar(36) NOT NULL, \`awardId\` varchar(36) NOT NULL, \`given\` tinyint NOT NULL DEFAULT 1, \`reason\` varchar(255) NULL, \`date\` date NOT NULL, UNIQUE INDEX \`IDX_abbbec2c01332355aab3b811c0\` (\`memberId\`, \`awardId\`), PRIMARY KEY (\`memberId\`, \`awardId\`)) ENGINE=InnoDB`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`postal_code\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`place\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`accession_date\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`leaving_data\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`active\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`salutation\` enum ('sir', 'madam', 'other', 'none') NOT NULL DEFAULT 'none'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`sepa_mandat\` varchar(255) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD UNIQUE INDEX \`IDX_ab51d77cababfc4aa052344ec3\` (\`sepa_mandat\`)`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`official_email\` varchar(255) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`deathdate\` date NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`newsletter\` enum ('online', 'offline', 'none') NOT NULL DEFAULT 'online'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`city\` varchar(36) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`district\` varchar(36) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`executive_position\` CHANGE \`number_of_performers\` \`number_of_performers\` int NOT NULL DEFAULT '-1'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`qualification\` DROP COLUMN \`description\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`qualification\` ADD \`description\` varchar(255) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` CHANGE \`member_id\` \`member_id\` varchar(255) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` DROP FOREIGN KEY \`FK_1f8d57f74fb4486a743d89d4820\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` CHANGE \`memberId\` \`memberId\` varchar(36) NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`city_district\` ADD CONSTRAINT \`FK_7193b3158b46421daeae4a62f95\` FOREIGN KEY (\`cityId\`) REFERENCES \`city\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`membership\` ADD CONSTRAINT \`FK_3b4b41597707b13086e71727422\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_awards\` ADD CONSTRAINT \`FK_a47e04bfd3671d8a375d1896d25\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_awards\` ADD CONSTRAINT \`FK_ba47b44c2ddf34c1bcc75df6675\` FOREIGN KEY (\`awardId\`) REFERENCES \`award\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD CONSTRAINT \`FK_cf71c62f17604b8c0e9c15c9556\` FOREIGN KEY (\`city\`) REFERENCES \`city\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD CONSTRAINT \`FK_e74f4be05ffd453b5dfb51d6f79\` FOREIGN KEY (\`district\`) REFERENCES \`city_district\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` ADD CONSTRAINT \`FK_1f8d57f74fb4486a743d89d4820\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` DROP FOREIGN KEY \`FK_1f8d57f74fb4486a743d89d4820\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP FOREIGN KEY \`FK_e74f4be05ffd453b5dfb51d6f79\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP FOREIGN KEY \`FK_cf71c62f17604b8c0e9c15c9556\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_awards\` DROP FOREIGN KEY \`FK_ba47b44c2ddf34c1bcc75df6675\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member_awards\` DROP FOREIGN KEY \`FK_a47e04bfd3671d8a375d1896d25\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`membership\` DROP FOREIGN KEY \`FK_3b4b41597707b13086e71727422\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`city_district\` DROP FOREIGN KEY \`FK_7193b3158b46421daeae4a62f95\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` CHANGE \`memberId\` \`memberId\` varchar(36) NULL DEFAULT 'NULL'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`session\` ADD CONSTRAINT \`FK_1f8d57f74fb4486a743d89d4820\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` CHANGE \`member_id\` \`member_id\` varchar(255) NULL DEFAULT 'NULL'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`qualification\` DROP COLUMN \`description\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`qualification\` ADD \`description\` int NOT NULL DEFAULT '1'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`executive_position\` CHANGE \`number_of_performers\` \`number_of_performers\` int NOT NULL DEFAULT '1'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`district\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`city\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`newsletter\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`deathdate\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`official_email\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP INDEX \`IDX_ab51d77cababfc4aa052344ec3\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`sepa_mandat\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` DROP COLUMN \`salutation\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`active\` tinyint NOT NULL DEFAULT '1'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`leaving_data\` date NULL DEFAULT 'NULL'`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`accession_date\` date NOT NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`place\` varchar(255) NOT NULL`);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`member\` ADD \`postal_code\` varchar(255) NOT NULL`);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_abbbec2c01332355aab3b811c0\` ON \`member_awards\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`member_awards\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`award\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`membership\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_9c5511a4d64dda3dc96472db53\` ON \`city_district\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`city_district\``);
|
|
||||||
await queryRunner.query(`DROP INDEX \`IDX_cc45d5049db48b8d7c0f9cf2b3\` ON \`city\``);
|
|
||||||
await queryRunner.query(`DROP TABLE \`city\``);
|
|
||||||
await queryRunner.query(`ALTER TABLE \`qualification\` CHANGE \`description\` \`number_of_performers\` int NOT NULL DEFAULT '1'`);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
54
migrations/1724242210553-initial.ts
Normal file
54
migrations/1724242210553-initial.ts
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class Initial1724242210553 implements MigrationInterface {
|
||||||
|
name = 'Initial1724242210553'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`CREATE TABLE \`membership_status\` (\`id\` int NOT NULL AUTO_INCREMENT, \`status\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`membership\` (\`id\` int NOT NULL AUTO_INCREMENT, \`start\` date NOT NULL, \`end\` date NULL, \`termination_reason\` varchar(255) NULL, \`memberId\` int NULL, \`statusId\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`qualification\` (\`id\` int NOT NULL AUTO_INCREMENT, \`qualification\` varchar(255) NOT NULL, \`description\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`member_qualifications\` (\`id\` int NOT NULL AUTO_INCREMENT, \`given\` tinyint NOT NULL DEFAULT 1, \`note\` varchar(255) NULL, \`date\` date NOT NULL, \`memberId\` int NULL, \`qualificationId\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`executive_position\` (\`id\` int NOT NULL AUTO_INCREMENT, \`postition\` varchar(255) NOT NULL, \`number_of_performers\` int NOT NULL DEFAULT '-1', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`member_executive_positions\` (\`id\` int NOT NULL AUTO_INCREMENT, \`given\` tinyint NOT NULL DEFAULT 1, \`note\` varchar(255) NULL, \`date\` date NOT NULL, \`memberId\` int NULL, \`executivePositionId\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`communication\` (\`id\` int NOT NULL AUTO_INCREMENT, \`type\` enum ('phone', 'mobile', 'address', 'mail', 'internalMail') NOT NULL DEFAULT 'phone', \`preffered\` tinyint NOT NULL DEFAULT 0, \`mobile\` varchar(255) NOT NULL, \`email\` varchar(255) NOT NULL, \`city\` varchar(255) NOT NULL, \`street\` varchar(255) NOT NULL, \`streetnumber\` int NOT NULL, \`streetnumber_addition\` varchar(255) NOT NULL, \`memberId\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`member\` (\`id\` int NOT NULL AUTO_INCREMENT, \`member_id\` varchar(255) NULL, \`salutation\` enum ('sir', 'madam', 'other', 'none') NOT NULL DEFAULT 'none', \`firstname\` varchar(255) NOT NULL, \`lastname\` varchar(255) NOT NULL, \`nameaffix\` varchar(255) NOT NULL, \`birthdate\` date NOT NULL, \`deathdate\` date NULL, \`sepa_mandat\` varchar(255) NULL, \`communicationsId\` int NULL, UNIQUE INDEX \`IDX_73e1828d94de0b2ddf89da0546\` (\`member_id\`), UNIQUE INDEX \`IDX_ab51d77cababfc4aa052344ec3\` (\`sepa_mandat\`), PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`member_awards\` (\`id\` int NOT NULL AUTO_INCREMENT, \`given\` tinyint NOT NULL DEFAULT 1, \`note\` varchar(255) NULL, \`date\` date NOT NULL, \`memberId\` int NULL, \`awardId\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`award\` (\`id\` int NOT NULL AUTO_INCREMENT, \`award\` varchar(255) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`membership\` ADD CONSTRAINT \`FK_3b4b41597707b13086e71727422\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`membership\` ADD CONSTRAINT \`FK_e9fd4d37c4ac0fb08bd6eeeda3c\` FOREIGN KEY (\`statusId\`) REFERENCES \`membership_status\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_qualifications\` ADD CONSTRAINT \`FK_98b70e687c35709d2f01b3d7d74\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_qualifications\` ADD CONSTRAINT \`FK_dbebe53df1caa0b6715a220b0ea\` FOREIGN KEY (\`qualificationId\`) REFERENCES \`qualification\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_executive_positions\` ADD CONSTRAINT \`FK_2912b056a5d0b7977360a986164\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_executive_positions\` ADD CONSTRAINT \`FK_1fd52c8f109123e5a2c67dc2c83\` FOREIGN KEY (\`executivePositionId\`) REFERENCES \`executive_position\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`communication\` ADD CONSTRAINT \`FK_fc5f59e5c9aafdedd25ed8ed36e\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member\` ADD CONSTRAINT \`FK_de8e6856d6b77e1b2815a8c0d4f\` FOREIGN KEY (\`communicationsId\`) REFERENCES \`communication\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_awards\` ADD CONSTRAINT \`FK_a47e04bfd3671d8a375d1896d25\` FOREIGN KEY (\`memberId\`) REFERENCES \`member\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_awards\` ADD CONSTRAINT \`FK_ba47b44c2ddf34c1bcc75df6675\` FOREIGN KEY (\`awardId\`) REFERENCES \`award\`(\`id\`) ON DELETE RESTRICT ON UPDATE NO ACTION`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_awards\` DROP FOREIGN KEY \`FK_ba47b44c2ddf34c1bcc75df6675\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_awards\` DROP FOREIGN KEY \`FK_a47e04bfd3671d8a375d1896d25\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member\` DROP FOREIGN KEY \`FK_de8e6856d6b77e1b2815a8c0d4f\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`communication\` DROP FOREIGN KEY \`FK_fc5f59e5c9aafdedd25ed8ed36e\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_executive_positions\` DROP FOREIGN KEY \`FK_1fd52c8f109123e5a2c67dc2c83\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_executive_positions\` DROP FOREIGN KEY \`FK_2912b056a5d0b7977360a986164\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_qualifications\` DROP FOREIGN KEY \`FK_dbebe53df1caa0b6715a220b0ea\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`member_qualifications\` DROP FOREIGN KEY \`FK_98b70e687c35709d2f01b3d7d74\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`membership\` DROP FOREIGN KEY \`FK_e9fd4d37c4ac0fb08bd6eeeda3c\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`membership\` DROP FOREIGN KEY \`FK_3b4b41597707b13086e71727422\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`award\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`member_awards\``);
|
||||||
|
await queryRunner.query(`DROP INDEX \`IDX_ab51d77cababfc4aa052344ec3\` ON \`member\``);
|
||||||
|
await queryRunner.query(`DROP INDEX \`IDX_73e1828d94de0b2ddf89da0546\` ON \`member\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`member\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`communication\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`member_executive_positions\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`executive_position\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`member_qualifications\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`qualification\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`membership\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`membership_status\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue