Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as SQL by KidShenck ( 17 years ago )
BEGIN;
CREATE TABLE "Venues_school" (
    "id" serial NOT NULL PRIMARY KEY,
    "name" varchar(30) NOT NULL UNIQUE,
    "city_id" integer NOT NULL REFERENCES "StaticData_city" ("id") DEFERRABLE INITIALLY DEFERRED,
    "address" varchar(50) NOT NULL,
    "zipcode" varchar(10) NOT NULL,
    "phone" varchar(20) NOT NULL,
    "email" varchar(75) NOT NULL,
    "division_id" integer NOT NULL REFERENCES "StaticData_district" ("id") DEFERRABLE INITIALLY DEFERRED,
    "track_id" integer NOT NULL,
    "head_coach_id" integer NOT NULL,
    "team_id" integer NOT NULL
)
;
CREATE TABLE "Venues_facility" (
    "id" serial NOT NULL PRIMARY KEY,
    "name" varchar(30) NOT NULL UNIQUE,
    "city_id" integer NOT NULL REFERENCES "StaticData_city" ("id") DEFERRABLE INITIALLY DEFERRED,
    "content_type_id" integer NOT NULL REFERENCES "django_content_type" ("id") DEFERRABLE INITIALLY DEFERRED,
    "object_id" integer CHECK ("object_id" >= 0) NOT NULL
)
;
ALTER TABLE "Venues_school" ADD CONSTRAINT "track_id_refs_id_7ad25734" FOREIGN KEY ("track_id") REFERENCES "Venues_facility" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE TABLE "Venues_track" (
    "id" serial NOT NULL PRIMARY KEY,
    "name" varchar(30) NOT NULL UNIQUE,
    "city_id" integer NOT NULL REFERENCES "StaticData_city" ("id") DEFERRABLE INITIALLY DEFERRED,
    "num_lanes" integer CHECK ("num_lanes" >= 0) NOT NULL,
    "num_finish_lines" integer CHECK ("num_finish_lines" >= 0) NOT NULL
)
;
CREATE TABLE "Venues_course" (
    "id" serial NOT NULL PRIMARY KEY,
    "name" varchar(30) NOT NULL UNIQUE,
    "city_id" integer NOT NULL REFERENCES "StaticData_city" ("id") DEFERRABLE INITIALLY DEFERRED,
    "length_in_meters" integer CHECK ("length_in_meters" >= 0) NOT NULL,
    "preferred_unit" varchar(3) NOT NULL
)
;
CREATE TABLE "Venues_school_agegroup" (
    "id" serial NOT NULL PRIMARY KEY,
    "school_id" integer NOT NULL REFERENCES "Venues_school" ("id") DEFERRABLE INITIALLY DEFERRED,
    "agegroup_id" integer NOT NULL REFERENCES "StaticData_agegroup" ("id") DEFERRABLE INITIALLY DEFERRED,
    UNIQUE ("school_id", "agegroup_id")
)
;
-- The following references should be added but depend on non-existent tables:
-- ALTER TABLE "Venues_school" ADD CONSTRAINT "team_id_refs_group_ptr_id_5e435ebc" FOREIGN KEY ("team_id") REFERENCES "Groups_team" ("group_ptr_id") DEFERRABLE INITIALLY DEFERRED;
-- ALTER TABLE "Venues_school" ADD CONSTRAINT "head_coach_id_refs_person_ptr_id_1c3a7c29" FOREIGN KEY ("head_coach_id") REFERENCES "People_coach" ("person_ptr_id") DEFERRABLE INITIALLY DEFERRED;
COMMIT;

 

Revise this Paste

Your Name: Code Language: