All pastes #921504 Raw Edit

Anonymous

public sql v1 · immutable
#921504 ·published 2008-02-28 02:16 UTC
rendered paste body
BEGIN;CREATE TABLE "applications_businessprocess" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL);CREATE TABLE "applications_applicationprocesses" (    "id" serial NOT NULL PRIMARY KEY,    "application_id" integer NOT NULL,    "process_id" integer NOT NULL REFERENCES "applications_businessprocess" ("id") DEFERRABLE INITIALLY DEFERRED);CREATE TABLE "applications_ministry" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL);CREATE TABLE "applications_system" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL,    "abbrev" varchar(20) NOT NULL);CREATE TABLE "applications_contact" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL,    "email" varchar(75) NOT NULL,    "phone" varchar(20) NOT NULL,    "cell" varchar(20) NOT NULL,    "fax" varchar(20) NOT NULL);CREATE TABLE "applications_environment" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL);CREATE TABLE "applications_application" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(200) NOT NULL,    "appcode" varchar(20) NOT NULL,    "description" text NOT NULL,    "projectdirectory" varchar(200) NOT NULL,    "projectcharter" varchar(200) NOT NULL,    "inuat" boolean NOT NULL,    "api_id" integer NOT NULL,    "ministry_id" integer NOT NULL REFERENCES "applications_ministry" ("id") DEFERRABLE INITIALLY DEFERRED,    "address" varchar(250) NOT NULL,    "city" varchar(60) NOT NULL,    "postalcode" varchar(10) NOT NULL,    "averagetransaction" double precision NOT NULL,    "averagedailytransactions" double precision NOT NULL,    "monthlytransactions" double precision NOT NULL);ALTER TABLE "applications_applicationprocesses" ADD CONSTRAINT application_id_refs_id_2913fd13 FOREIGN KEY ("application_id") REFERENCES "applications_application" ("id") DEFERRABLE INITIALLY DEFERRED;CREATE TABLE "applications_cardtype" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(20) NOT NULL,    "abbrev" varchar(10) NOT NULL,    "acquirer" varchar(30) NOT NULL);CREATE TABLE "applications_api" (    "id" serial NOT NULL PRIMARY KEY,    "system_id" integer NOT NULL REFERENCES "applications_system" ("id") DEFERRABLE INITIALLY DEFERRED,    "name" varchar(20) NOT NULL);ALTER TABLE "applications_application" ADD CONSTRAINT api_id_refs_id_20209831 FOREIGN KEY ("api_id") REFERENCES "applications_api" ("id") DEFERRABLE INITIALLY DEFERRED;CREATE TABLE "applications_applicationdescriptor" (    "id" serial NOT NULL PRIMARY KEY,    "application_id" integer NOT NULL REFERENCES "applications_application" ("id") DEFERRABLE INITIALLY DEFERRED,    "descriptortype_id" integer NOT NULL,    "descriptor" varchar(20) NOT NULL);CREATE TABLE "applications_contacttype" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL);CREATE TABLE "applications_applicationcontact" (    "id" serial NOT NULL PRIMARY KEY,    "contact_id" integer NOT NULL REFERENCES "applications_contact" ("id") DEFERRABLE INITIALLY DEFERRED,    "application_id" integer NOT NULL REFERENCES "applications_application" ("id") DEFERRABLE INITIALLY DEFERRED,    "contacttype_id" integer NOT NULL REFERENCES "applications_contacttype" ("id") DEFERRABLE INITIALLY DEFERRED,    "backup" boolean NOT NULL);CREATE TABLE "applications_applicationenvironmentcard" (    "id" serial NOT NULL PRIMARY KEY,    "applicationenvironment_id" integer NOT NULL,    "cardtype_id" integer NOT NULL REFERENCES "applications_cardtype" ("id") DEFERRABLE INITIALLY DEFERRED,    "merchantnumber" varchar(20) NOT NULL,    "chainnumber" varchar(20) NOT NULL,    "programcode" varchar(20) NOT NULL,    "locationid" varchar(20) NOT NULL,    "bank" varchar(10) NOT NULL,    "transit" varchar(10) NOT NULL,    "account" varchar(20) NOT NULL);CREATE TABLE "applications_descriptortype" (    "id" serial NOT NULL PRIMARY KEY,    "name" varchar(50) NOT NULL,    "maxlength" integer NOT NULL);ALTER TABLE "applications_applicationdescriptor" ADD CONSTRAINT descriptortype_id_refs_id_20249c20 FOREIGN KEY ("descriptortype_id") REFERENCES "applications_descriptortype" ("id") DEFERRABLE INITIALLY DEFERRED;CREATE TABLE "applications_applicationenvironment" (    "id" serial NOT NULL PRIMARY KEY,    "application_id" integer NOT NULL REFERENCES "applications_application" ("id") DEFERRABLE INITIALLY DEFERRED,    "environment_id" integer NOT NULL REFERENCES "applications_environment" ("id") DEFERRABLE INITIALLY DEFERRED,    "termid" varchar(20) NOT NULL,    "appid" integer NOT NULL);ALTER TABLE "applications_applicationenvironmentcard" ADD CONSTRAINT applicationenvironment_id_refs_id_748ed36d FOREIGN KEY ("applicationenvironment_id") REFERENCES "applications_applicationenvironment" ("id") DEFERRABLE INITIALLY DEFERRED;CREATE INDEX "applications_applicationprocesses_application_id" ON "applications_applicationprocesses" ("application_id");CREATE INDEX "applications_applicationprocesses_process_id" ON "applications_applicationprocesses" ("process_id");CREATE INDEX "applications_application_api_id" ON "applications_application" ("api_id");CREATE INDEX "applications_application_ministry_id" ON "applications_application" ("ministry_id");CREATE INDEX "applications_api_system_id" ON "applications_api" ("system_id");CREATE INDEX "applications_applicationdescriptor_application_id" ON "applications_applicationdescriptor" ("application_id");CREATE INDEX "applications_applicationdescriptor_descriptortype_id" ON "applications_applicationdescriptor" ("descriptortype_id");CREATE INDEX "applications_applicationcontact_contact_id" ON "applications_applicationcontact" ("contact_id");CREATE INDEX "applications_applicationcontact_application_id" ON "applications_applicationcontact" ("application_id");CREATE INDEX "applications_applicationcontact_contacttype_id" ON "applications_applicationcontact" ("contacttype_id");CREATE INDEX "applications_applicationenvironmentcard_applicationenvironment_id" ON "applications_applicationenvironmentcard" ("applicationenvironment_id");CREATE INDEX "applications_applicationenvironmentcard_cardtype_id" ON "applications_applicationenvironmentcard" ("cardtype_id");CREATE INDEX "applications_applicationenvironment_application_id" ON "applications_applicationenvironment" ("application_id");CREATE INDEX "applications_applicationenvironment_environment_id" ON "applications_applicationenvironment" ("environment_id");COMMIT;