Update Revision database schema

Still uses the old schema, should probably be changed

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-07-26 20:55:34 +02:00
parent e490ecba36
commit 9a545bb394
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB

View file

@ -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;
}