chore: migrate database files (#8126)
This commit is contained in:
19
server/src/entities/asset-stack.entity.ts
Normal file
19
server/src/entities/asset-stack.entity.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { AssetEntity } from 'src/entities/asset.entity';
|
||||
import { Column, Entity, JoinColumn, OneToMany, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity('asset_stack')
|
||||
export class AssetStackEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@OneToMany(() => AssetEntity, (asset) => asset.stack)
|
||||
assets!: AssetEntity[];
|
||||
|
||||
@OneToOne(() => AssetEntity)
|
||||
@JoinColumn()
|
||||
//TODO: Add constraint to ensure primary asset exists in the assets array
|
||||
primaryAsset!: AssetEntity;
|
||||
|
||||
@Column({ nullable: false })
|
||||
primaryAssetId!: string;
|
||||
}
|
||||
Reference in New Issue
Block a user