mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00:00 
			
		
		
		
	make activity_log.duration nullable
				
					
				
			This commit is contained in:
		
							parent
							
								
									15148b7875
								
							
						
					
					
						commit
						0979392925
					
				
					 2 changed files with 22 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-only
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
export class NullableActivityLogDuration1731935047347 {
 | 
			
		||||
    name = 'NullableActivityLogDuration1731935047347'
 | 
			
		||||
 | 
			
		||||
    async up(queryRunner) {
 | 
			
		||||
        await queryRunner.query(`ALTER TABLE "activity_log" ALTER COLUMN "duration" DROP NOT NULL`);
 | 
			
		||||
        await queryRunner.query(`ALTER TABLE "activity_log" ALTER COLUMN "duration" DROP DEFAULT`);
 | 
			
		||||
				await queryRunner.query(`UPDATE "activity_log" SET "duration" = NULL WHERE "duration" = 0`);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
    async down(queryRunner) {
 | 
			
		||||
				await queryRunner.query(`UPDATE "activity_log" SET "duration" = 0 WHERE "duration" IS NULL`);
 | 
			
		||||
        await queryRunner.query(`ALTER TABLE "activity_log" ALTER COLUMN "duration" SET DEFAULT '0'`);
 | 
			
		||||
        await queryRunner.query(`ALTER TABLE "activity_log" ALTER COLUMN "duration" SET NOT NULL`);
 | 
			
		||||
		}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -23,8 +23,8 @@ export class SkActivityLog {
 | 
			
		|||
	/**
 | 
			
		||||
	 * Processing duration in milliseconds
 | 
			
		||||
	 */
 | 
			
		||||
	@Column('double precision', { default: 0 })
 | 
			
		||||
	public duration = 0;
 | 
			
		||||
	@Column('double precision', { nullable: true })
 | 
			
		||||
	public duration: number | null = null;
 | 
			
		||||
 | 
			
		||||
	@Column({
 | 
			
		||||
		type: 'text',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue