-- Tables
use oro_archive;
drop table if exists file;
\W create table file (
  file_id      int not null auto_increment primary key,
  file_name    varchar(512) not null,
  file_format  enum('fit','fits','fts','pic','bpm','jpg','jpeg','tif','tiff','crw','cr2','nef','nrw','dng') not null,
  file_size    int not null check (file_size between 1 and 100000000),
  bit_depth    smallint not null check (bit_depth between 1 and 20),
  x_dim        smallint not null check (x_dim between 1 and 10000),
  y_dim        smallint not null check (y_dim between 1 and 10000),
  object       varchar(512) not null,
  ra           float(9,6) not null check (ra between 0 and 360),
  decl         float(9,6) not null check (decl between -90 and 90),
  epoch        enum('1950','2000') not null,
  observer     varchar(512) not null,
  obs_time     datetime not null,
  telescope    varchar(512) not null,
  camera       varchar(512) not null,
  exp_time     integer not null check (exp_time between 1 and 360000),
  filter       enum('L','Red','Green','Blue','C','U','B','V','R','I','H-alpha','H-beta','OIII','SII') not null,
  desc1        varchar(512) not null,
  desc2        varchar(512),
  desc3        varchar(512),
  desc4        varchar(512),
  desc5        varchar(512),
  ins_at       timestamp not null unique,
  fulltext     (file_name, object, observer, desc1, desc2, desc3, desc4, desc5)
);
describe file;
