import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity({ name: 'terms' })
export class Term {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  document_type: string;

  @Column()
  version: string;

  @Column({ nullable: true, type: 'datetime' })
  created_by: string | null;

  @CreateDateColumn({
    default: () => "datetime('now', 'localtime')",
    type: 'datetime',
  }) // defaultはSQLite用設定値.本番用は別途migrationで設定
  created_at: Date;

  @Column({ nullable: true, type: 'varchar' })
  updated_by: string | null;

  @UpdateDateColumn({
    default: () => "datetime('now', 'localtime')",
    type: 'datetime',
  }) // defaultはSQLite用設定値.本番用は別途migrationで設定
  updated_at: Date;
}
