fix(server): cannot delete an asset if presented in album (#2223)

* fix(server): cannot delete an asset if presented in album

* added migration

* preserve correct migration
This commit is contained in:
Alex 2023-04-09 21:48:01 -05:00 committed by GitHub
parent 6f7071b12d
commit db628cec11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ export class AlbumEntity {
@JoinTable()
sharedUsers!: UserEntity[];
@ManyToMany(() => AssetEntity)
@ManyToMany(() => AssetEntity, (asset) => asset.albums)
@JoinTable()
assets!: AssetEntity[];

View File

@ -101,7 +101,7 @@ export class AssetEntity {
@JoinTable({ name: 'shared_link__asset' })
sharedLinks!: SharedLinkEntity[];
@ManyToMany(() => AlbumEntity, (album) => album.assets)
@ManyToMany(() => AlbumEntity, (album) => album.assets, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
albums?: AlbumEntity[];
}