
diff -r a3e856c4d161 -r 4f4f8a52a874 dbicdh/PostgreSQL/deploy/1/001-auto.sql
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbicdh/PostgreSQL/deploy/1/001-auto.sql	Sun Feb 08 22:36:04 2015 +0100
@@ -0,0 +1,118 @@
+-- 
+-- Created by SQL::Translator::Producer::PostgreSQL
+-- Created on Sun Feb  1 19:58:35 2015
+-- 
+;
+--
+-- Table: crash_users.
+--
+CREATE TABLE "crash_users" (
+  "id" serial NOT NULL,
+  "user_id" character varying(40) NOT NULL,
+  "os" character varying(40),
+  "cpu_arch" character varying(10),
+  "cpu_count" integer,
+  "extra_info" text,
+  PRIMARY KEY ("id")
+);
+
+;
+--
+-- Table: modules.
+--
+CREATE TABLE "modules" (
+  "id" serial NOT NULL,
+  "debug_id" character varying(33) NOT NULL,
+  "filename" character varying(128) NOT NULL,
+  "version" character varying(64),
+  PRIMARY KEY ("id"),
+  CONSTRAINT "module_id" UNIQUE ("debug_id", "filename")
+);
+
+;
+--
+-- Table: products.
+--
+CREATE TABLE "products" (
+  "id" serial NOT NULL,
+  "distributor" character varying(40),
+  "name" character varying(40),
+  "version" character varying(16),
+  "release_channel" character varying,
+  PRIMARY KEY ("id")
+);
+
+;
+--
+-- Table: crash_reports.
+--
+CREATE TABLE "crash_reports" (
+  "id" serial NOT NULL,
+  "start_time" timestamp,
+  "crash_time" timestamp,
+  "uuid" character varying(36) NOT NULL,
+  "bug_reference" character varying(20),
+  "crash_user_id" integer NOT NULL,
+  "product_id" integer NOT NULL,
+  PRIMARY KEY ("id")
+);
+CREATE INDEX "crash_reports_idx_crash_user_id" on "crash_reports" ("crash_user_id");
+CREATE INDEX "crash_reports_idx_product_id" on "crash_reports" ("product_id");
+
+;
+--
+-- Table: crash_threads.
+--
+CREATE TABLE "crash_threads" (
+  "id" serial NOT NULL,
+  "number" integer NOT NULL,
+  "crashed" bool NOT NULL,
+  "crash_report_id" integer NOT NULL,
+  PRIMARY KEY ("id")
+);
+CREATE INDEX "crash_threads_idx_crash_report_id" on "crash_threads" ("crash_report_id");
+
+;
+--
+-- Table: crash_frames.
+--
+CREATE TABLE "crash_frames" (
+  "id" serial NOT NULL,
+  "number" integer NOT NULL,
+  "function" character varying(128),
+  "source_file" character varying(128),
+  "source_line" integer,
+  "stack_walk_mode" character varying(10),
+  "crash_thread_id" integer NOT NULL,
+  "module_id" integer NOT NULL,
+  PRIMARY KEY ("id")
+);
+CREATE INDEX "crash_frames_idx_crash_thread_id" on "crash_frames" ("crash_thread_id");
+CREATE INDEX "crash_frames_idx_module_id" on "crash_frames" ("module_id");
+
+;
+--
+-- Foreign Key Definitions
+--
+
+;
+ALTER TABLE "crash_reports" ADD CONSTRAINT "crash_reports_fk_crash_user_id" FOREIGN KEY ("crash_user_id")
+  REFERENCES "crash_users" ("id") DEFERRABLE;
+
+;
+ALTER TABLE "crash_reports" ADD CONSTRAINT "crash_reports_fk_product_id" FOREIGN KEY ("product_id")
+  REFERENCES "products" ("id") DEFERRABLE;
+
+;
+ALTER TABLE "crash_threads" ADD CONSTRAINT "crash_threads_fk_crash_report_id" FOREIGN KEY ("crash_report_id")
+  REFERENCES "crash_reports" ("id") DEFERRABLE;
+
+;
+ALTER TABLE "crash_frames" ADD CONSTRAINT "crash_frames_fk_crash_thread_id" FOREIGN KEY ("crash_thread_id")
+  REFERENCES "crash_threads" ("id") DEFERRABLE;
+
+;
+ALTER TABLE "crash_frames" ADD CONSTRAINT "crash_frames_fk_module_id" FOREIGN KEY ("module_id")
+  REFERENCES "modules" ("id") DEFERRABLE;
+
+;




