fix typeorm timestamps

This commit is contained in:
Evert Prants 2022-08-26 17:14:40 +03:00
parent c78af3f7dc
commit 9e68698ddc
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
8 changed files with 13 additions and 54 deletions

View File

@ -34,7 +34,7 @@ async function bootstrap() {
saveUninitialized: false, saveUninitialized: false,
store: new RedisStore({ client: redisClient }), store: new RedisStore({ client: redisClient }),
cookie: { cookie: {
sameSite: 'lax', sameSite: 'strict',
secure: process.env.NODE_ENV === 'production', secure: process.env.NODE_ENV === 'production',
}, },
}), }),

View File

@ -22,17 +22,10 @@ export class Document {
@Column({ type: 'text', nullable: false }) @Column({ type: 'text', nullable: false })
body: string; body: string;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@UpdateDateColumn({ @UpdateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
onUpdate: 'CURRENT_TIMESTAMP(6)',
})
public updated_at: Date; public updated_at: Date;
@ManyToOne(() => User) @ManyToOne(() => User)

View File

@ -19,10 +19,7 @@ export class OAuth2ClientAuthorization {
@Column({ type: 'timestamp' }) @Column({ type: 'timestamp' })
public expires_at: Date; public expires_at: Date;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@ManyToOne(() => OAuth2Client) @ManyToOne(() => OAuth2Client)

View File

@ -41,17 +41,10 @@ export class OAuth2Client {
@Column({ default: false }) @Column({ default: false })
verified: boolean; verified: boolean;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@UpdateDateColumn({ @UpdateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
onUpdate: 'CURRENT_TIMESTAMP(6)',
})
public updated_at: Date; public updated_at: Date;
@ManyToOne(() => Upload, { nullable: true, onDelete: 'SET NULL' }) @ManyToOne(() => Upload, { nullable: true, onDelete: 'SET NULL' })

View File

@ -38,16 +38,9 @@ export class OAuth2Token {
@Column({ type: 'timestamp' }) @Column({ type: 'timestamp' })
public expires_at: Date; public expires_at: Date;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@UpdateDateColumn({ @UpdateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
onUpdate: 'CURRENT_TIMESTAMP(6)',
})
public updated_at: Date; public updated_at: Date;
} }

View File

@ -29,16 +29,9 @@ export class Upload {
}) })
uploader: User; uploader: User;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@UpdateDateColumn({ @UpdateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
onUpdate: 'CURRENT_TIMESTAMP(6)',
})
public updated_at: Date; public updated_at: Date;
} }

View File

@ -32,10 +32,7 @@ export class UserToken {
@Column({ type: 'timestamp', nullable: true }) @Column({ type: 'timestamp', nullable: true })
public expires_at: Date; public expires_at: Date;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@ManyToOne(() => User) @ManyToOne(() => User)

View File

@ -37,17 +37,10 @@ export class User {
@Column({ type: 'timestamp' }) @Column({ type: 'timestamp' })
public activity_at: Date; public activity_at: Date;
@CreateDateColumn({ @CreateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date; public created_at: Date;
@UpdateDateColumn({ @UpdateDateColumn()
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
onUpdate: 'CURRENT_TIMESTAMP(6)',
})
public updated_at: Date; public updated_at: Date;
@ManyToOne(() => Upload, { @ManyToOne(() => Upload, {