Browse Source

✨ feat(contacts): add default value for created_time field in Linkman entity

- set default value of created_time to CURRENT_TIMESTAMP to automatically record creation time
- maintain consistency with database timestamp conventions
yourname 9 months ago
parent
commit
61f734319d
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/server/modules/contacts/linkman.entity.ts

+ 5 - 1
src/server/modules/contacts/linkman.entity.ts

@@ -47,7 +47,11 @@ export class Linkman {
   @Column({ name: 'created_user_id', type: 'int', unsigned: true, nullable: true })
   createdUserId?: number;
 
-  @Column({ name: 'created_time', type: 'datetime' })
+  @Column({
+    name: 'created_time',
+    type: 'datetime',
+    default: () => 'CURRENT_TIMESTAMP'
+  })
   createdTime!: Date;
 
   @Column({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })