-- 
-- Created by SQL::Translator::Producer::SQLite
-- Created on Sat Nov 15 15:48:49 2008
-- 
BEGIN TRANSACTION;


--
-- Table: basic
--
DROP TABLE basic;
CREATE TABLE basic (
  type_id INTEGER PRIMARY KEY NOT NULL,
  pack_code char(1) NOT NULL,
  length_bits integer NOT NULL
);


--
-- Table: encoded_string
--
DROP TABLE encoded_string;
CREATE TABLE encoded_string (
  type_id INTEGER PRIMARY KEY NOT NULL,
  base_type_id integer NOT NULL,
  encoding varchar(20) NOT NULL
);

CREATE INDEX encoded_string_idx_base_type_id_encoded_stri ON encoded_string (base_type_id);

--
-- Table: enum
--
DROP TABLE enum;
CREATE TABLE enum (
  type_id INTEGER PRIMARY KEY NOT NULL,
  base_type_id integer NOT NULL
);

CREATE INDEX enum_idx_base_type_id_enum ON enum (base_type_id);

--
-- Table: enum_values
--
DROP TABLE enum_values;
CREATE TABLE enum_values (
  enum_id integer NOT NULL,
  value varchar(1024) NOT NULL,
  translation varchar(1024) NOT NULL,
  PRIMARY KEY (enum_id, value)
);

CREATE INDEX enum_values_idx_enum_id_enum_v ON enum_values (enum_id);

--
-- Table: fileformats
--
DROP TABLE fileformats;
CREATE TABLE fileformats (
  type_id INTEGER PRIMARY KEY NOT NULL,
  base_type_id integer NOT NULL
);

CREATE INDEX fileformats_idx_base_type_id_f ON fileformats (base_type_id);

--
-- Table: recurring_count
--
DROP TABLE recurring_count;
CREATE TABLE recurring_count (
  type_id INTEGER PRIMARY KEY NOT NULL,
  base_type_id integer NOT NULL,
  count integer NOT NULL
);

CREATE INDEX recurring_count_idx_base_type_id_recurring_co ON recurring_count (base_type_id);

--
-- Table: recurring_terminated
--
DROP TABLE recurring_terminated;
CREATE TABLE recurring_terminated (
  type_id INTEGER PRIMARY KEY NOT NULL,
  base_type_id integer NOT NULL,
  terminator varchar(1024) NOT NULL
);

CREATE INDEX recurring_terminated_idx_base_type_id_recurring_te ON recurring_terminated (base_type_id);

--
-- Table: structure
--
DROP TABLE structure;
CREATE TABLE structure (
  type_id INTEGER PRIMARY KEY NOT NULL
);


--
-- Table: structure_fields
--
DROP TABLE structure_fields;
CREATE TABLE structure_fields (
  struct_id integer NOT NULL,
  name varchar(255) NOT NULL,
  position integer NOT NULL,
  type_id integer NOT NULL,
  value varchar(1024),
  comments varchar(1024),
  PRIMARY KEY (struct_id, position)
);

CREATE INDEX structure_fields_idx_struct_id_structure_field ON structure_fields (struct_id);
CREATE INDEX structure_fields_idx_type_id_s ON structure_fields (type_id);

--
-- Table: systems
--
DROP TABLE systems;
CREATE TABLE systems (
  id INTEGER PRIMARY KEY NOT NULL,
  name varchar(255) NOT NULL,
  comments varchar(16384) NOT NULL
);


--
-- Table: types
--
DROP TABLE types;
CREATE TABLE types (
  id INTEGER PRIMARY KEY NOT NULL,
  system_id integer NOT NULL,
  name varchar(255) NOT NULL,
  comments varchar(16384)
);

CREATE INDEX types_idx_system_id_types ON types (system_id);

COMMIT;

