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

@Entity('stock_data')
export class StockData {
  @PrimaryGeneratedColumn({ unsigned: true })
  id!: number;

  @Column({ name: 'code', type: 'varchar', length: 255, nullable: false, comment: '股票代码' })
  code!: string;

  @Column({ name: 'data', type: 'json', nullable: false, comment: '股票数据' })
  data!: Array<any>;

  @Column({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  createdAt!: Date;

  @Column({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' })
  updatedAt!: Date;
}