update entity
This commit is contained in:
@ -4,6 +4,8 @@ import {
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm'
|
||||
@ -22,9 +24,15 @@ export class Label extends BaseEntity {
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user!: User
|
||||
|
||||
@ManyToOne(() => Link)
|
||||
@JoinColumn({ name: 'link_id' })
|
||||
link!: Link
|
||||
@ManyToMany(() => Link, (link) => link.labels)
|
||||
@JoinTable({ name: 'link_labels' })
|
||||
link?: Link
|
||||
|
||||
@Column('text')
|
||||
color!: string
|
||||
|
||||
@Column('text')
|
||||
description?: string
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date
|
||||
|
||||
@ -15,7 +15,8 @@ import {
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
OneToMany,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
OneToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
@ -62,6 +63,7 @@ export class Link extends BaseEntity {
|
||||
@UpdateDateColumn()
|
||||
updatedAt?: Date
|
||||
|
||||
@OneToMany(() => Label, (label) => label.link)
|
||||
@ManyToMany(() => Label, (label) => label.link)
|
||||
@JoinTable({ name: 'link_labels' })
|
||||
labels?: Label[]
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ BEGIN;
|
||||
|
||||
ALTER TABLE omnivore.labels
|
||||
DROP COLUMN link_id,
|
||||
ADD COLUMN color text,
|
||||
ADD COLUMN color text NOT NULL,
|
||||
ADD COLUMN description text,
|
||||
ADD CONSTRAINT label_name_unique UNIQUE (user_id, name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user