Skip to content

Instantly share code, notes, and snippets.

@jacobh
Created March 6, 2012 11:55
Show Gist options
  • Save jacobh/1985859 to your computer and use it in GitHub Desktop.
Save jacobh/1985859 to your computer and use it in GitHub Desktop.
BEGIN;
CREATE TABLE "feeds_feed_owners" (
"id" integer NOT NULL PRIMARY KEY,
"feed_id" integer NOT NULL,
"user_id" integer NOT NULL REFERENCES "auth_user" ("id"),
UNIQUE ("feed_id", "user_id")
)
;
CREATE TABLE "feeds_feed" (
"id" integer NOT NULL PRIMARY KEY
)
;
CREATE TABLE "feeds_masterfeed_subscribers" (
"id" integer NOT NULL PRIMARY KEY,
"masterfeed_id" integer NOT NULL,
"user_id" integer NOT NULL REFERENCES "auth_user" ("id"),
UNIQUE ("masterfeed_id", "user_id")
)
;
CREATE TABLE "feeds_masterfeed" (
"feed_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "feeds_feed" ("id"),
"school_id" integer REFERENCES "schools_school" ("id"),
"slug" varchar(255) NOT NULL,
"title" varchar(255) NOT NULL,
"description" text NOT NULL,
"code" varchar(10) NOT NULL UNIQUE,
"is_public" bool NOT NULL
)
;
CREATE TABLE "feeds_subfeed" (
"feed_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "feeds_feed" ("id"),
"master_feed_id" integer NOT NULL REFERENCES "feeds_masterfeed" ("feed_ptr_id")
)
;
CREATE TABLE "feeds_item" (
"id" integer NOT NULL PRIMARY KEY,
"feed_id" integer NOT NULL REFERENCES "feeds_feed" ("id"),
"date" date NOT NULL,
"title" varchar(255) NOT NULL,
"description" text NOT NULL
)
;
CREATE TABLE "feeds_note" (
"item_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "feeds_item" ("id")
)
;
CREATE TABLE "feeds_event" (
"item_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "feeds_item" ("id"),
"start_time" time NOT NULL,
"end_time" time NOT NULL,
"is_all_day" bool NOT NULL
)
;
CREATE TABLE "feeds_assesment" (
"item_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "feeds_item" ("id"),
"start_date" date NOT NULL,
"weighting" decimal NOT NULL
)
;
CREATE TABLE "feeds_task" (
"item_ptr_id" integer NOT NULL PRIMARY KEY REFERENCES "feeds_item" ("id"),
"start_date" date NOT NULL
)
;
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment