Replace view tables position columns from integer to double (#14162)

This commit is contained in:
Weiko
2025-08-29 18:39:11 +02:00
committed by GitHub
parent 1c4568c8b1
commit 316055be64
6 changed files with 50 additions and 7 deletions
@@ -0,0 +1,43 @@
import { type MigrationInterface, type QueryRunner } from 'typeorm';
export class UpdateViewsPositionsToDouble1756483901854
implements MigrationInterface
{
name = 'UpdateViewsPositionsToDouble1756483901854';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."viewFilter" ALTER COLUMN "positionInViewFilterGroup" TYPE double precision`,
);
await queryRunner.query(
`ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "positionInViewFilterGroup" TYPE double precision`,
);
await queryRunner.query(
`ALTER TABLE "core"."viewGroup" ALTER COLUMN "position" TYPE double precision`,
);
await queryRunner.query(
`ALTER TABLE "core"."view" ALTER COLUMN "position" TYPE double precision`,
);
await queryRunner.query(
`ALTER TABLE "core"."viewField" ALTER COLUMN "position" TYPE double precision`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "core"."viewField" ALTER COLUMN "position" TYPE integer`,
);
await queryRunner.query(
`ALTER TABLE "core"."view" ALTER COLUMN "position" TYPE integer`,
);
await queryRunner.query(
`ALTER TABLE "core"."viewGroup" ALTER COLUMN "position" TYPE integer`,
);
await queryRunner.query(
`ALTER TABLE "core"."viewFilterGroup" ALTER COLUMN "positionInViewFilterGroup" TYPE integer`,
);
await queryRunner.query(
`ALTER TABLE "core"."viewFilter" ALTER COLUMN "positionInViewFilterGroup" TYPE integer`,
);
}
}
@@ -47,7 +47,7 @@ export class ViewFieldEntity extends SyncableEntity {
@Column({ nullable: false, type: 'int', default: 0 })
size: number;
@Column({ nullable: false, type: 'int', default: 0 })
@Column({ nullable: false, type: 'double precision', default: 0 })
position: number;
@Column({
@@ -36,8 +36,8 @@ export class ViewFilterGroupEntity extends SyncableEntity {
})
logicalOperator: ViewFilterGroupLogicalOperator;
@Column({ nullable: true, type: 'int' })
positionInViewFilterGroup?: number | null;
@Column({ nullable: true, type: 'double precision' })
positionInViewFilterGroup: number | null;
@Column({ nullable: false, type: 'uuid' })
viewId: string;
@@ -50,8 +50,8 @@ export class ViewFilterEntity extends SyncableEntity {
@Column({ nullable: true, type: 'uuid' })
viewFilterGroupId?: string | null;
@Column({ nullable: true, type: 'int' })
positionInViewFilterGroup?: number | null;
@Column({ nullable: true, type: 'double precision' })
positionInViewFilterGroup: number | null;
@Column({ nullable: true, type: 'text', default: null })
subFieldName?: string | null;
@@ -38,7 +38,7 @@ export class ViewGroupEntity extends SyncableEntity {
@Column({ nullable: false, type: 'text' })
fieldValue: string;
@Column({ nullable: false, type: 'int', default: 0 })
@Column({ nullable: false, type: 'double precision', default: 0 })
position: number;
@Column({ nullable: false, type: 'uuid' })
@@ -66,7 +66,7 @@ export class ViewEntity extends SyncableEntity {
@Column({ nullable: false, type: 'text' })
icon: string;
@Column({ nullable: false, type: 'int', default: 0 })
@Column({ nullable: false, type: 'double precision', default: 0 })
position: number;
@Column({ nullable: false, default: false, type: 'boolean' })