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,
store: new RedisStore({ client: redisClient }),
cookie: {
sameSite: 'lax',
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
},
}),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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