Skip to content

Instantly share code, notes, and snippets.

@qcom
Last active August 29, 2015 14:05
Show Gist options
  • Save qcom/ac21d995366fa2e3db1b to your computer and use it in GitHub Desktop.
Save qcom/ac21d995366fa2e3db1b to your computer and use it in GitHub Desktop.
CREATE TABLE IF NOT EXISTS items (
id serial PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS industries (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS items_industries (
item integer REFERENCES items(id),
industry integer REFERENCES industries(id)
);
CREATE TABLE IF NOT EXISTS categories (
id serial PRIMARY KEY,
name text UNIQUE NOT NULL
);
CREATE TABLE IF NOT EXISTS items_categories (
item integer REFERENCES items(id),
industry integer REFERENCES industries(id)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment