set readonly=true as default for new album shares
This commit is contained in:
@@ -15,7 +15,6 @@ export class AlbumPermissionEntity {
|
|||||||
@ManyToOne(() => UserEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
@ManyToOne(() => UserEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
||||||
users!: UserEntity;
|
users!: UserEntity;
|
||||||
|
|
||||||
// Readonly is false when migrating previous entries
|
@Column({ default: true })
|
||||||
@Column({ default: false })
|
|
||||||
readonly!: boolean;
|
readonly!: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class SetReadonlyDefault1712905931092 implements MigrationInterface {
|
||||||
|
name = 'SetReadonlyDefault1712905931092'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "albums_shared_users_users" ALTER COLUMN "readonly" SET DEFAULT true`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "albums_shared_users_users" ALTER COLUMN "readonly" SET DEFAULT false`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user