dbicdh/SQLite/deploy/1/001-auto.sql
changeset 59 4f4f8a52a874
equal deleted inserted replaced
58:a3e856c4d161 59:4f4f8a52a874
       
     1 -- 
       
     2 -- Created by SQL::Translator::Producer::SQLite
       
     3 -- Created on Sun Feb  1 19:58:35 2015
       
     4 -- 
       
     5 
       
     6 ;
       
     7 BEGIN TRANSACTION;
       
     8 --
       
     9 -- Table: crash_users
       
    10 --
       
    11 CREATE TABLE crash_users (
       
    12   id INTEGER PRIMARY KEY NOT NULL,
       
    13   user_id varchar(40) NOT NULL,
       
    14   os varchar(40),
       
    15   cpu_arch varchar(10),
       
    16   cpu_count int,
       
    17   extra_info text
       
    18 );
       
    19 --
       
    20 -- Table: modules
       
    21 --
       
    22 CREATE TABLE modules (
       
    23   id INTEGER PRIMARY KEY NOT NULL,
       
    24   debug_id varchar(33) NOT NULL,
       
    25   filename varchar(128) NOT NULL,
       
    26   version varchar(64)
       
    27 );
       
    28 CREATE UNIQUE INDEX module_id ON modules (debug_id, filename);
       
    29 --
       
    30 -- Table: products
       
    31 --
       
    32 CREATE TABLE products (
       
    33   id INTEGER PRIMARY KEY NOT NULL,
       
    34   distributor varchar(40),
       
    35   name varchar(40),
       
    36   version varchar(16),
       
    37   release_channel varchar
       
    38 );
       
    39 --
       
    40 -- Table: crash_reports
       
    41 --
       
    42 CREATE TABLE crash_reports (
       
    43   id INTEGER PRIMARY KEY NOT NULL,
       
    44   start_time timestamp,
       
    45   crash_time timestamp,
       
    46   uuid varchar(36) NOT NULL,
       
    47   bug_reference varchar(20),
       
    48   crash_user_id int NOT NULL,
       
    49   product_id int NOT NULL,
       
    50   FOREIGN KEY (crash_user_id) REFERENCES crash_users(id),
       
    51   FOREIGN KEY (product_id) REFERENCES products(id)
       
    52 );
       
    53 CREATE INDEX crash_reports_idx_crash_user_id ON crash_reports (crash_user_id);
       
    54 CREATE INDEX crash_reports_idx_product_id ON crash_reports (product_id);
       
    55 --
       
    56 -- Table: crash_threads
       
    57 --
       
    58 CREATE TABLE crash_threads (
       
    59   id INTEGER PRIMARY KEY NOT NULL,
       
    60   number int NOT NULL,
       
    61   crashed bool NOT NULL,
       
    62   crash_report_id int NOT NULL,
       
    63   FOREIGN KEY (crash_report_id) REFERENCES crash_reports(id)
       
    64 );
       
    65 CREATE INDEX crash_threads_idx_crash_report_id ON crash_threads (crash_report_id);
       
    66 --
       
    67 -- Table: crash_frames
       
    68 --
       
    69 CREATE TABLE crash_frames (
       
    70   id INTEGER PRIMARY KEY NOT NULL,
       
    71   number int NOT NULL,
       
    72   function varchar(128),
       
    73   source_file varchar(128),
       
    74   source_line int,
       
    75   stack_walk_mode varchar(10),
       
    76   crash_thread_id int NOT NULL,
       
    77   module_id int NOT NULL,
       
    78   FOREIGN KEY (crash_thread_id) REFERENCES crash_threads(id),
       
    79   FOREIGN KEY (module_id) REFERENCES modules(id)
       
    80 );
       
    81 CREATE INDEX crash_frames_idx_crash_thread_id ON crash_frames (crash_thread_id);
       
    82 CREATE INDEX crash_frames_idx_module_id ON crash_frames (module_id);
       
    83 COMMIT;