Skip to content
Snippets Groups Projects
Commit e4f076b2 authored by L4168's avatar L4168
Browse files

added onDelete

parent 695a8765
No related branches found
No related tags found
3 merge requests!59Development to master,!36Development,!32Game state
...@@ -17,7 +17,9 @@ export class MapDrawingEntity { ...@@ -17,7 +17,9 @@ export class MapDrawingEntity {
@Column({ type: 'json', nullable: true }) data: JSON; @Column({ type: 'json', nullable: true }) data: JSON;
@ManyToOne(type => FactionEntity, faction => faction.mapDrawings) @ManyToOne(type => FactionEntity, faction => faction.mapDrawings, {
onDelete: 'CASCADE',
})
faction: FactionEntity; faction: FactionEntity;
@ManyToOne(type => GameEntity, gameEntity => gameEntity.id) @ManyToOne(type => GameEntity, gameEntity => gameEntity.id)
gameId: GameEntity; gameId: GameEntity;
......
...@@ -26,11 +26,15 @@ export class FactionEntity { ...@@ -26,11 +26,15 @@ export class FactionEntity {
@Column({ type: 'text' }) @Column({ type: 'text' })
factionPassword: string; factionPassword: string;
@OneToMany(type => Game_PersonEntity, game_persons => game_persons.faction) @OneToMany(type => Game_PersonEntity, game_persons => game_persons.faction, {
onDelete: 'SET NULL',
})
game_persons: Game_PersonEntity[]; game_persons: Game_PersonEntity[];
@ManyToOne(type => GameEntity, game => game.factions) @ManyToOne(type => GameEntity, game => game.factions)
game: GameEntity; game: GameEntity;
@OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.faction) @OneToMany(type => MapDrawingEntity, mapDrawings => mapDrawings.faction, {
onDelete: 'CASCADE',
})
mapDrawings: MapDrawingEntity[]; mapDrawings: MapDrawingEntity[];
factionObject() { factionObject() {
...@@ -102,6 +106,8 @@ export class GameGroupEntity { ...@@ -102,6 +106,8 @@ export class GameGroupEntity {
onDelete: 'CASCADE', onDelete: 'CASCADE',
}) })
players: Game_PersonEntity[]; players: Game_PersonEntity[];
@ManyToOne(type => FactionEntity, faction => faction.factionId) @ManyToOne(type => FactionEntity, faction => faction.factionId, {
onDelete: 'CASCADE',
})
faction: FactionEntity; faction: FactionEntity;
} }
...@@ -56,7 +56,9 @@ export class GameEntity { ...@@ -56,7 +56,9 @@ export class GameEntity {
export class Game_PersonEntity { export class Game_PersonEntity {
@PrimaryGeneratedColumn('uuid') gamepersonId: string; @PrimaryGeneratedColumn('uuid') gamepersonId: string;
@Column({ type: 'text', nullable: true }) role: string; @Column({ type: 'text', nullable: true }) role: string;
@ManyToOne(type => FactionEntity, faction => faction.game_persons) @ManyToOne(type => FactionEntity, faction => faction.game_persons, {
onDelete: 'SET NULL',
})
faction: FactionEntity; faction: FactionEntity;
@ManyToOne(type => GameEntity, game => game.id) @ManyToOne(type => GameEntity, game => game.id)
game: GameEntity; game: GameEntity;
...@@ -90,9 +92,13 @@ export class ObjectivePoint_HistoryEntity { ...@@ -90,9 +92,13 @@ export class ObjectivePoint_HistoryEntity {
@PrimaryGeneratedColumn('uuid') oP_HistoryId: string; @PrimaryGeneratedColumn('uuid') oP_HistoryId: string;
@Column({ type: 'timestamp' }) oP_HistoryTimestamp: Timestamp; @Column({ type: 'timestamp' }) oP_HistoryTimestamp: Timestamp;
@Column('float') action: number; @Column('float') action: number;
@ManyToOne(type => FactionEntity, factionEntity => factionEntity.factionId) @ManyToOne(type => FactionEntity, factionEntity => factionEntity.factionId, {
onDelete: 'CASCADE',
})
capture: FactionEntity; capture: FactionEntity;
@ManyToOne(type => FactionEntity, factionentity => factionentity.factionId) @ManyToOne(type => FactionEntity, factionentity => factionentity.factionId, {
onDelete: 'CASCADE',
})
owner: FactionEntity; owner: FactionEntity;
@ManyToOne( @ManyToOne(
type => ObjectivePointEntity, type => ObjectivePointEntity,
......
...@@ -16,9 +16,13 @@ export class TaskEntity { ...@@ -16,9 +16,13 @@ export class TaskEntity {
@Column({ type: 'text' }) taskDescription: string; @Column({ type: 'text' }) taskDescription: string;
@Column({ type: 'bool' }) taskIsActive: boolean; @Column({ type: 'bool' }) taskIsActive: boolean;
@ManyToOne(type => FactionEntity, faction => faction.factionId) @ManyToOne(type => FactionEntity, faction => faction.factionId, {
onDelete: 'CASCADE',
})
faction: FactionEntity; faction: FactionEntity;
@ManyToOne(type => FactionEntity, faction => faction.factionId) @ManyToOne(type => FactionEntity, faction => faction.factionId, {
onDelete: 'CASCADE',
})
taskWinner: FactionEntity; taskWinner: FactionEntity;
@ManyToOne(type => GameEntity, game => game.id) @ManyToOne(type => GameEntity, game => game.id)
@JoinColumn({ name: 'taskGame' }) @JoinColumn({ name: 'taskGame' })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment