mirror of
https://github.com/immich-app/immich.git
synced 2025-12-25 01:11:43 +03:00
feat: schema diff sql tools (#17116)
This commit is contained in:
16
server/src/tables/stack.table.ts
Normal file
16
server/src/tables/stack.table.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ForeignKeyColumn, PrimaryGeneratedColumn, Table } from 'src/sql-tools';
|
||||
import { AssetTable } from 'src/tables/asset.table';
|
||||
import { UserTable } from 'src/tables/user.table';
|
||||
|
||||
@Table('asset_stack')
|
||||
export class StackTable {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: string;
|
||||
|
||||
@ForeignKeyColumn(() => UserTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
|
||||
ownerId!: string;
|
||||
|
||||
//TODO: Add constraint to ensure primary asset exists in the assets array
|
||||
@ForeignKeyColumn(() => AssetTable, { nullable: false, unique: true })
|
||||
primaryAssetId!: string;
|
||||
}
|
||||
Reference in New Issue
Block a user