mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-17 02:25:29 +10:00
* add migration to delete duplicates that currently exist in the db * change model and migration to add a unique index constraint to id and name * renamed unique index name to be readable * redid model and migration to use @Unique instead of @Index * remove //Here comment --------- Co-authored-by: Aster Fialla <asterfialla@gmail.com>
41 lines
749 B
TypeScript
41 lines
749 B
TypeScript
import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Unique} from "typeorm"
|
|
|
|
@Entity({name: "Member", synchronize: true})
|
|
@Unique("UQ_Member_userid_name", ['userid', 'name'])
|
|
export class Member {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
id: number
|
|
|
|
@Column()
|
|
userid: string
|
|
|
|
@Column({
|
|
length: 100
|
|
})
|
|
name: string
|
|
|
|
@Column({
|
|
type: "varchar",
|
|
nullable: true,
|
|
length: 100
|
|
})
|
|
displayname: string
|
|
|
|
@Column({
|
|
nullable: true,
|
|
})
|
|
proxy: string
|
|
|
|
@Column({
|
|
nullable: true,
|
|
})
|
|
propic: string
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt: Date
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt: Date
|
|
}
|