Created
July 24, 2012 09:49
-
-
Save akandratovich/3169150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET statement_timeout = 0; | |
SET client_encoding = 'UTF8'; | |
SET standard_conforming_strings = on; | |
SET check_function_bodies = false; | |
SET client_min_messages = warning; | |
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; | |
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; | |
SET search_path = public, pg_catalog; | |
SET default_with_oids = false; | |
CREATE TABLE m ( | |
f integer, | |
t integer, | |
"time" integer | |
); | |
CREATE TABLE u ( | |
id integer NOT NULL, | |
name character varying | |
); | |
CREATE TABLE u2u ( | |
f integer, | |
t integer | |
); | |
ALTER TABLE ONLY u ADD CONSTRAINT u_id PRIMARY KEY (id); | |
CREATE INDEX fki_f_id ON u2u USING btree (f); | |
CREATE INDEX fki_m_f ON m USING btree (f); | |
CREATE INDEX fki_m_t ON m USING btree (t); | |
CREATE INDEX fki_t_id ON u2u USING btree (t); | |
CREATE INDEX time_i ON m USING btree ("time"); | |
ALTER TABLE ONLY u2u ADD CONSTRAINT f_id FOREIGN KEY (f) REFERENCES u(id); | |
ALTER TABLE ONLY m ADD CONSTRAINT m_f FOREIGN KEY (f) REFERENCES u(id); | |
ALTER TABLE ONLY m ADD CONSTRAINT m_t FOREIGN KEY (t) REFERENCES u(id); | |
ALTER TABLE ONLY u2u ADD CONSTRAINT t_id FOREIGN KEY (t) REFERENCES u(id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment