From 9a545bb39468d96aee7c755b6678e850f4c57255 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 26 Jul 2020 20:55:34 +0200 Subject: [PATCH] Update Revision database schema Still uses the old schema, should probably be changed Signed-off-by: David Mehren --- src/revisions/revision.entity.ts | 43 ++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/revisions/revision.entity.ts b/src/revisions/revision.entity.ts index 9a51f7f7a..d3ed60afa 100644 --- a/src/revisions/revision.entity.ts +++ b/src/revisions/revision.entity.ts @@ -1,11 +1,50 @@ -import { Entity, PrimaryGeneratedColumn } from 'typeorm'; +import { + Column, + CreateDateColumn, + Entity, + ManyToOne, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm'; import { Note } from '../notes/note.entity'; @Entity() export class Revision { - //TODO: Still missing many properties + //TODO: This is the old schema, we probably want to change it @PrimaryGeneratedColumn('uuid') id: string; + @Column({ + type: 'text', + }) + patch: string; + + @Column({ + type: 'text', + }) + lastContent: string; + + @Column({ + type: 'text', + }) + content: string; + + @Column() + length: number; + + @Column({ type: 'text' }) + authorship: string; + + @CreateDateColumn() + createdAt: Date; + + @UpdateDateColumn() + updatedAt: Date; + + @ManyToOne( + _ => Note, + note => note.revisions, + { onDelete: 'CASCADE' }, + ) note: Note; }