mirror of
https://github.com/immich-app/immich.git
synced 2026-02-12 20:08:25 +03:00
remove unnecessary FK names
This commit is contained in:
@@ -3,17 +3,19 @@ import { UserEntity } from 'src/entities/user.entity';
|
||||
import { Column, Entity, Index, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
|
||||
@Entity('albums_shared_users_users')
|
||||
// Indices for JoinTable
|
||||
@Index('IDX_427c350ad49bd3935a50baab73', ['albums'])
|
||||
@Index('IDX_f48513bf9bccefd6ff3ad30bd0', ['users'])
|
||||
export class AlbumPermissionsEntity {
|
||||
@PrimaryColumn({ type: 'uuid', name: 'albumsId', foreignKeyConstraintName: 'FK_f48513bf9bccefd6ff3ad30bd06' })
|
||||
export class AlbumPermissionEntity {
|
||||
@PrimaryColumn({ type: 'uuid', name: 'albumsId' })
|
||||
@ManyToOne(() => AlbumEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
||||
albums!: AlbumEntity;
|
||||
|
||||
@PrimaryColumn({ type: 'uuid', name: 'usersId', foreignKeyConstraintName: 'FK_427c350ad49bd3935a50baab737' })
|
||||
@PrimaryColumn({ type: 'uuid', name: 'usersId' })
|
||||
@ManyToOne(() => UserEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
||||
users!: UserEntity;
|
||||
|
||||
@Column({ default: true })
|
||||
// Readonly is false when migrating previous entries
|
||||
@Column({ default: false })
|
||||
readonly!: boolean;
|
||||
}
|
||||
|
||||
@@ -55,17 +55,7 @@ export class AlbumEntity {
|
||||
@ManyToMany(() => UserEntity)
|
||||
@JoinTable({
|
||||
name: 'albums_shared_users_users',
|
||||
inverseJoinColumn: {
|
||||
name: 'usersId',
|
||||
// referencedColumnName: 'id',
|
||||
// foreignKeyConstraintName: 'FK_f48513bf9bccefd6ff3ad30bd06',
|
||||
},
|
||||
joinColumn: {
|
||||
name: 'albumsId',
|
||||
// referencedColumnName: 'id',
|
||||
// foreignKeyConstraintName: 'FK_427c350ad49bd3935a50baab737',
|
||||
},
|
||||
synchronize: false,
|
||||
synchronize: false, // Table is managed by AlbumPermissionEntity
|
||||
})
|
||||
sharedUsers!: UserEntity[];
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddAlbumPermissions1712904446100 implements MigrationInterface {
|
||||
name = 'AddAlbumPermissions1712904446100'
|
||||
export class AddAlbumPermission1712905775156 implements MigrationInterface {
|
||||
name = 'AddAlbumPermission1712905775156'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "albums_shared_users_users" ADD "readonly" boolean NOT NULL DEFAULT true`);
|
||||
await queryRunner.query(`ALTER TABLE "albums_shared_users_users" ADD "readonly" boolean NOT NULL DEFAULT false`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
Reference in New Issue
Block a user