Advertisement
RCola

ERROR: current transaction is aborted, commands ignored unti

May 8th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
  3. --
  4.  
  5. CREATE SCHEMA public;
  6.  
  7.  
  8. ALTER SCHEMA public OWNER TO postgres;
  9.  
  10. CREATE SEQUENCE customer_customer_id_seq
  11.     START WITH 1
  12.     INCREMENT BY 1
  13.     NO MINVALUE
  14.     NO MAXVALUE
  15.     CACHE 1;
  16.  
  17.  
  18. ALTER TABLE customer_customer_id_seq OWNER TO postgres;
  19.  
  20. SET default_tablespace = '';
  21.  
  22. SET default_with_oids = false;
  23.  
  24. --
  25. -- Name: customer; Type: TABLE; Schema: public; Owner: postgres
  26. --
  27.  
  28. CREATE TABLE customer (
  29.     customer_id integer DEFAULT nextval('customer_customer_id_seq'::regclass) NOT NULL,
  30.     store_id smallint NOT NULL,
  31.     first_name character varying(45) NOT NULL,
  32.     last_name character varying(45) NOT NULL,
  33.     email character varying(50),
  34.     address_id smallint NOT NULL,
  35.     activebool boolean DEFAULT true NOT NULL,
  36.     create_date date DEFAULT ('now'::text)::date NOT NULL,
  37.     last_update timestamp without time zone DEFAULT now(),
  38.     active integer
  39. );
  40.  
  41.  
  42. ALTER TABLE customer OWNER TO postgres;
  43.  
  44. --
  45. -- Name: actor_actor_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  46. --
  47.  
  48. CREATE SEQUENCE actor_actor_id_seq
  49.     START WITH 1
  50.     INCREMENT BY 1
  51.     NO MINVALUE
  52.     NO MAXVALUE
  53.     CACHE 1;
  54.  
  55.  
  56. ALTER TABLE actor_actor_id_seq OWNER TO postgres;
  57.  
  58. --
  59. -- Name: actor; Type: TABLE; Schema: public; Owner: postgres
  60. --
  61.  
  62. CREATE TABLE actor (
  63.     actor_id integer DEFAULT nextval('actor_actor_id_seq'::regclass) NOT NULL,
  64.     first_name character varying(45) NOT NULL,
  65.     last_name character varying(45) NOT NULL,
  66.     last_update timestamp without time zone DEFAULT now() NOT NULL
  67. );
  68.  
  69.  
  70. ALTER TABLE actor OWNER TO postgres;
  71.  
  72. --
  73. -- Name: category_category_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  74. --
  75.  
  76. CREATE SEQUENCE category_category_id_seq
  77.     START WITH 1
  78.     INCREMENT BY 1
  79.     NO MINVALUE
  80.     NO MAXVALUE
  81.     CACHE 1;
  82.  
  83.  
  84. ALTER TABLE category_category_id_seq OWNER TO postgres;
  85.  
  86. --
  87. -- Name: category; Type: TABLE; Schema: public; Owner: postgres
  88. --
  89.  
  90. CREATE TABLE category (
  91.     category_id integer DEFAULT nextval('category_category_id_seq'::regclass) NOT NULL,
  92.     name character varying(25) NOT NULL,
  93.     last_update timestamp without time zone DEFAULT now() NOT NULL
  94. );
  95.  
  96.  
  97. ALTER TABLE category OWNER TO postgres;
  98.  
  99. --
  100. -- Name: film_film_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  101. --
  102.  
  103. CREATE SEQUENCE film_film_id_seq
  104.     START WITH 1
  105.     INCREMENT BY 1
  106.     NO MINVALUE
  107.     NO MAXVALUE
  108.     CACHE 1;
  109.  
  110.  
  111. ALTER TABLE film_film_id_seq OWNER TO postgres;
  112.  
  113. --
  114. -- Name: film; Type: TABLE; Schema: public; Owner: postgres
  115. --
  116.  
  117. CREATE TABLE film (
  118.     film_id integer DEFAULT nextval('film_film_id_seq'::regclass) NOT NULL,
  119.     title character varying(255) NOT NULL,
  120.     description text,
  121.     release_year year,
  122.     language_id smallint NOT NULL,
  123.     rental_duration smallint DEFAULT 3 NOT NULL,
  124.     rental_rate numeric(4,2) DEFAULT 4.99 NOT NULL,
  125.     length smallint,
  126.     replacement_cost numeric(5,2) DEFAULT 19.99 NOT NULL,
  127.     rating mpaa_rating DEFAULT 'G'::mpaa_rating,
  128.     last_update timestamp without time zone DEFAULT now() NOT NULL,
  129.     special_features text[]
  130. );
  131.  
  132.  
  133. ALTER TABLE film OWNER TO postgres;
  134.  
  135. --
  136. -- Name: film_actor; Type: TABLE; Schema: public; Owner: postgres
  137. --
  138.  
  139. CREATE TABLE film_actor (
  140.     actor_id smallint NOT NULL,
  141.     film_id smallint NOT NULL,
  142.     last_update timestamp without time zone DEFAULT now() NOT NULL
  143. );
  144.  
  145.  
  146. ALTER TABLE film_actor OWNER TO postgres;
  147.  
  148. --
  149. -- Name: film_category; Type: TABLE; Schema: public; Owner: postgres
  150. --
  151.  
  152. CREATE TABLE film_category (
  153.     film_id smallint NOT NULL,
  154.     category_id smallint NOT NULL,
  155.     last_update timestamp without time zone DEFAULT now() NOT NULL
  156. );
  157.  
  158.  
  159. ALTER TABLE film_category OWNER TO postgres;
  160.  
  161. --
  162. -- Name: address_address_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  163. --
  164.  
  165. CREATE SEQUENCE address_address_id_seq
  166.     START WITH 1
  167.     INCREMENT BY 1
  168.     NO MINVALUE
  169.     NO MAXVALUE
  170.     CACHE 1;
  171.  
  172.  
  173. ALTER TABLE address_address_id_seq OWNER TO postgres;
  174.  
  175. --
  176. -- Name: address; Type: TABLE; Schema: public; Owner: postgres
  177. --
  178.  
  179. CREATE TABLE address (
  180.     address_id integer DEFAULT nextval('address_address_id_seq'::regclass) NOT NULL,
  181.     address character varying(50) NOT NULL,
  182.     address2 character varying(50),
  183.     district character varying(20) NOT NULL,
  184.     city_id smallint NOT NULL,
  185.     postal_code character varying(10),
  186.     phone character varying(20) NOT NULL,
  187.     last_update timestamp without time zone DEFAULT now() NOT NULL
  188. );
  189.  
  190.  
  191. ALTER TABLE address OWNER TO postgres;
  192.  
  193. --
  194. -- Name: city_city_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  195. --
  196.  
  197. CREATE SEQUENCE city_city_id_seq
  198.     START WITH 1
  199.     INCREMENT BY 1
  200.     NO MINVALUE
  201.     NO MAXVALUE
  202.     CACHE 1;
  203.  
  204.  
  205. ALTER TABLE city_city_id_seq OWNER TO postgres;
  206.  
  207. --
  208. -- Name: city; Type: TABLE; Schema: public; Owner: postgres
  209. --
  210.  
  211. CREATE TABLE city (
  212.     city_id integer DEFAULT nextval('city_city_id_seq'::regclass) NOT NULL,
  213.     city character varying(50) NOT NULL,
  214.     country_id smallint NOT NULL,
  215.     last_update timestamp without time zone DEFAULT now() NOT NULL
  216. );
  217.  
  218.  
  219. ALTER TABLE city OWNER TO postgres;
  220.  
  221. --
  222. -- Name: country_country_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  223. --
  224.  
  225. CREATE SEQUENCE country_country_id_seq
  226.     START WITH 1
  227.     INCREMENT BY 1
  228.     NO MINVALUE
  229.     NO MAXVALUE
  230.     CACHE 1;
  231.  
  232.  
  233. ALTER TABLE country_country_id_seq OWNER TO postgres;
  234.  
  235. --
  236. -- Name: country; Type: TABLE; Schema: public; Owner: postgres
  237. --
  238.  
  239. CREATE TABLE country (
  240.     country_id integer DEFAULT nextval('country_country_id_seq'::regclass) NOT NULL,
  241.     country character varying(50) NOT NULL,
  242.     last_update timestamp without time zone DEFAULT now() NOT NULL
  243. );
  244.  
  245.  
  246. ALTER TABLE country OWNER TO postgres;
  247.  
  248. --
  249. -- Name: inventory_inventory_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  250. --
  251.  
  252. CREATE SEQUENCE inventory_inventory_id_seq
  253.     START WITH 1
  254.     INCREMENT BY 1
  255.     NO MINVALUE
  256.     NO MAXVALUE
  257.     CACHE 1;
  258.  
  259.  
  260. ALTER TABLE inventory_inventory_id_seq OWNER TO postgres;
  261.  
  262. --
  263. -- Name: inventory; Type: TABLE; Schema: public; Owner: postgres
  264. --
  265.  
  266. CREATE TABLE inventory (
  267.     inventory_id integer DEFAULT nextval('inventory_inventory_id_seq'::regclass) NOT NULL,
  268.     film_id smallint NOT NULL,
  269.     store_id smallint NOT NULL,
  270.     last_update timestamp without time zone DEFAULT now() NOT NULL
  271. );
  272.  
  273.  
  274. ALTER TABLE inventory OWNER TO postgres;
  275.  
  276. --
  277. -- Name: language_language_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  278. --
  279.  
  280. CREATE SEQUENCE language_language_id_seq
  281.     START WITH 1
  282.     INCREMENT BY 1
  283.     NO MINVALUE
  284.     NO MAXVALUE
  285.     CACHE 1;
  286.  
  287.  
  288. ALTER TABLE language_language_id_seq OWNER TO postgres;
  289.  
  290. --
  291. -- Name: language; Type: TABLE; Schema: public; Owner: postgres
  292. --
  293.  
  294. CREATE TABLE language (
  295.     language_id integer DEFAULT nextval('language_language_id_seq'::regclass) NOT NULL,
  296.     name character(20) NOT NULL,
  297.     last_update timestamp without time zone DEFAULT now() NOT NULL
  298. );
  299.  
  300.  
  301. ALTER TABLE language OWNER TO postgres;
  302.  
  303. --
  304. -- Name: payment_payment_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  305. --
  306.  
  307. CREATE SEQUENCE payment_payment_id_seq
  308.     START WITH 1
  309.     INCREMENT BY 1
  310.     NO MINVALUE
  311.     NO MAXVALUE
  312.     CACHE 1;
  313.  
  314.  
  315. ALTER TABLE payment_payment_id_seq OWNER TO postgres;
  316.  
  317. --
  318. -- Name: payment; Type: TABLE; Schema: public; Owner: postgres
  319. --
  320.  
  321. CREATE TABLE payment (
  322.     payment_id integer DEFAULT nextval('payment_payment_id_seq'::regclass) NOT NULL,
  323.     customer_id smallint NOT NULL,
  324.     staff_id smallint NOT NULL,
  325.     rental_id integer NOT NULL,
  326.     amount numeric(5,2) NOT NULL,
  327.     payment_date timestamp without time zone NOT NULL
  328. );
  329.  
  330.  
  331. ALTER TABLE payment OWNER TO postgres;
  332.  
  333. --
  334. -- Name: rental_rental_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  335. --
  336.  
  337. CREATE SEQUENCE rental_rental_id_seq
  338.     START WITH 1
  339.     INCREMENT BY 1
  340.     NO MINVALUE
  341.     NO MAXVALUE
  342.     CACHE 1;
  343.  
  344.  
  345. ALTER TABLE rental_rental_id_seq OWNER TO postgres;
  346.  
  347. --
  348. -- Name: rental; Type: TABLE; Schema: public; Owner: postgres
  349. --
  350.  
  351. CREATE TABLE rental (
  352.     rental_id integer DEFAULT nextval('rental_rental_id_seq'::regclass) NOT NULL,
  353.     rental_date timestamp without time zone NOT NULL,
  354.     inventory_id integer NOT NULL,
  355.     customer_id smallint NOT NULL,
  356.     return_date timestamp without time zone,
  357.     staff_id smallint NOT NULL,
  358.     last_update timestamp without time zone DEFAULT now() NOT NULL
  359. );
  360.  
  361.  
  362. ALTER TABLE rental OWNER TO postgres;
  363.  
  364. --
  365. -- Name: staff_staff_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  366. --
  367.  
  368. CREATE SEQUENCE staff_staff_id_seq
  369.     START WITH 1
  370.     INCREMENT BY 1
  371.     NO MINVALUE
  372.     NO MAXVALUE
  373.     CACHE 1;
  374.  
  375.  
  376. ALTER TABLE staff_staff_id_seq OWNER TO postgres;
  377.  
  378. --
  379. -- Name: staff; Type: TABLE; Schema: public; Owner: postgres
  380. --
  381.  
  382. CREATE TABLE staff (
  383.     staff_id integer DEFAULT nextval('staff_staff_id_seq'::regclass) NOT NULL,
  384.     first_name character varying(45) NOT NULL,
  385.     last_name character varying(45) NOT NULL,
  386.     address_id smallint NOT NULL,
  387.     email character varying(50),
  388.     store_id smallint NOT NULL,
  389.     active boolean DEFAULT true NOT NULL,
  390.     username character varying(16) NOT NULL,
  391.     password character varying(40),
  392.     last_update timestamp without time zone DEFAULT now() NOT NULL,
  393.     picture bytea
  394. );
  395.  
  396.  
  397. ALTER TABLE staff OWNER TO postgres;
  398.  
  399. --
  400. -- Name: store_store_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  401. --
  402.  
  403. CREATE SEQUENCE store_store_id_seq
  404.     START WITH 1
  405.     INCREMENT BY 1
  406.     NO MINVALUE
  407.     NO MAXVALUE
  408.     CACHE 1;
  409.  
  410.  
  411. ALTER TABLE store_store_id_seq OWNER TO postgres;
  412.  
  413. --
  414. -- Name: store; Type: TABLE; Schema: public; Owner: postgres
  415. --
  416.  
  417. CREATE TABLE store (
  418.     store_id integer DEFAULT nextval('store_store_id_seq'::regclass) NOT NULL,
  419.     manager_staff_id smallint NOT NULL,
  420.     address_id smallint NOT NULL,
  421.     last_update timestamp without time zone DEFAULT now() NOT NULL
  422. );
  423.  
  424.  
  425. ALTER TABLE store OWNER TO postgres;
  426.  
  427. --
  428. -- Name: actor_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  429. --
  430.  
  431. ALTER TABLE ONLY actor
  432.     ADD CONSTRAINT actor_pkey PRIMARY KEY (actor_id);
  433.  
  434.  
  435. --
  436. -- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  437. --
  438.  
  439. ALTER TABLE ONLY address
  440.     ADD CONSTRAINT address_pkey PRIMARY KEY (address_id);
  441.  
  442.  
  443. --
  444. -- Name: category_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  445. --
  446.  
  447. ALTER TABLE ONLY category
  448.     ADD CONSTRAINT category_pkey PRIMARY KEY (category_id);
  449.  
  450.  
  451. --
  452. -- Name: city_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  453. --
  454.  
  455. ALTER TABLE ONLY city
  456.     ADD CONSTRAINT city_pkey PRIMARY KEY (city_id);
  457.  
  458.  
  459. --
  460. -- Name: country_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  461. --
  462.  
  463. ALTER TABLE ONLY country
  464.     ADD CONSTRAINT country_pkey PRIMARY KEY (country_id);
  465.  
  466.  
  467. --
  468. -- Name: customer_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  469. --
  470.  
  471. ALTER TABLE ONLY customer
  472.     ADD CONSTRAINT customer_pkey PRIMARY KEY (customer_id);
  473.  
  474.  
  475. --
  476. -- Name: film_actor_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  477. --
  478.  
  479. ALTER TABLE ONLY film_actor
  480.     ADD CONSTRAINT film_actor_pkey PRIMARY KEY (actor_id, film_id);
  481.  
  482.  
  483. --
  484. -- Name: film_category_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  485. --
  486.  
  487. ALTER TABLE ONLY film_category
  488.     ADD CONSTRAINT film_category_pkey PRIMARY KEY (film_id, category_id);
  489.  
  490.  
  491. --
  492. -- Name: film_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  493. --
  494.  
  495. ALTER TABLE ONLY film
  496.     ADD CONSTRAINT film_pkey PRIMARY KEY (film_id);
  497.  
  498.  
  499. --
  500. -- Name: inventory_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  501. --
  502.  
  503. ALTER TABLE ONLY inventory
  504.     ADD CONSTRAINT inventory_pkey PRIMARY KEY (inventory_id);
  505.  
  506.  
  507. --
  508. -- Name: language_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  509. --
  510.  
  511. ALTER TABLE ONLY language
  512.     ADD CONSTRAINT language_pkey PRIMARY KEY (language_id);
  513.  
  514.  
  515. --
  516. -- Name: payment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  517. --
  518.  
  519. ALTER TABLE ONLY payment
  520.     ADD CONSTRAINT payment_pkey PRIMARY KEY (payment_id);
  521.  
  522.  
  523. --
  524. -- Name: rental_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  525. --
  526.  
  527. ALTER TABLE ONLY rental
  528.     ADD CONSTRAINT rental_pkey PRIMARY KEY (rental_id);
  529.  
  530.  
  531. --
  532. -- Name: staff_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  533. --
  534.  
  535. ALTER TABLE ONLY staff
  536.     ADD CONSTRAINT staff_pkey PRIMARY KEY (staff_id);
  537.  
  538.  
  539. --
  540. -- Name: store_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  541. --
  542.  
  543. ALTER TABLE ONLY store
  544.     ADD CONSTRAINT store_pkey PRIMARY KEY (store_id);
  545.  
  546.  
  547.  
  548. --
  549. -- Name: idx_actor_last_name; Type: INDEX; Schema: public; Owner: postgres
  550. --
  551.  
  552. CREATE INDEX idx_actor_last_name ON actor USING btree (last_name);
  553.  
  554.  
  555. --
  556. -- Name: idx_fk_address_id; Type: INDEX; Schema: public; Owner: postgres
  557. --
  558.  
  559. CREATE INDEX idx_fk_address_id ON customer USING btree (address_id);
  560.  
  561.  
  562. --
  563. -- Name: idx_fk_city_id; Type: INDEX; Schema: public; Owner: postgres
  564. --
  565.  
  566. CREATE INDEX idx_fk_city_id ON address USING btree (city_id);
  567.  
  568.  
  569. --
  570. -- Name: idx_fk_country_id; Type: INDEX; Schema: public; Owner: postgres
  571. --
  572.  
  573. CREATE INDEX idx_fk_country_id ON city USING btree (country_id);
  574.  
  575.  
  576. --
  577. -- Name: idx_fk_customer_id; Type: INDEX; Schema: public; Owner: postgres
  578. --
  579.  
  580. CREATE INDEX idx_fk_customer_id ON payment USING btree (customer_id);
  581.  
  582.  
  583. --
  584. -- Name: idx_fk_film_id; Type: INDEX; Schema: public; Owner: postgres
  585. --
  586.  
  587. CREATE INDEX idx_fk_film_id ON film_actor USING btree (film_id);
  588.  
  589.  
  590. --
  591. -- Name: idx_fk_inventory_id; Type: INDEX; Schema: public; Owner: postgres
  592. --
  593.  
  594. CREATE INDEX idx_fk_inventory_id ON rental USING btree (inventory_id);
  595.  
  596.  
  597. --
  598. -- Name: idx_fk_language_id; Type: INDEX; Schema: public; Owner: postgres
  599. --
  600.  
  601. CREATE INDEX idx_fk_language_id ON film USING btree (language_id);
  602.  
  603.  
  604. --
  605. -- Name: idx_fk_rental_id; Type: INDEX; Schema: public; Owner: postgres
  606. --
  607.  
  608. CREATE INDEX idx_fk_rental_id ON payment USING btree (rental_id);
  609.  
  610.  
  611. --
  612. -- Name: idx_fk_staff_id; Type: INDEX; Schema: public; Owner: postgres
  613. --
  614.  
  615. CREATE INDEX idx_fk_staff_id ON payment USING btree (staff_id);
  616.  
  617.  
  618. --
  619. -- Name: idx_fk_store_id; Type: INDEX; Schema: public; Owner: postgres
  620. --
  621.  
  622. CREATE INDEX idx_fk_store_id ON customer USING btree (store_id);
  623.  
  624.  
  625. --
  626. -- Name: idx_last_name; Type: INDEX; Schema: public; Owner: postgres
  627. --
  628.  
  629. CREATE INDEX idx_last_name ON customer USING btree (last_name);
  630.  
  631.  
  632. --
  633. -- Name: idx_store_id_film_id; Type: INDEX; Schema: public; Owner: postgres
  634. --
  635.  
  636. CREATE INDEX idx_store_id_film_id ON inventory USING btree (store_id, film_id);
  637.  
  638.  
  639. --
  640. -- Name: idx_title; Type: INDEX; Schema: public; Owner: postgres
  641. --
  642.  
  643. CREATE INDEX idx_title ON film USING btree (title);
  644.  
  645.  
  646. --
  647. -- Name: idx_unq_manager_staff_id; Type: INDEX; Schema: public; Owner: postgres
  648. --
  649.  
  650. CREATE UNIQUE INDEX idx_unq_manager_staff_id ON store USING btree (manager_staff_id);
  651.  
  652.  
  653. --
  654. -- Name: idx_unq_rental_rental_date_inventory_id_customer_id; Type: INDEX; Schema: public; Owner: postgres
  655. --
  656.  
  657. CREATE UNIQUE INDEX idx_unq_rental_rental_date_inventory_id_customer_id ON rental USING btree (rental_date, inventory_id, customer_id);
  658.  
  659.  
  660.  
  661. --
  662. -- Name: customer_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  663. --
  664.  
  665. ALTER TABLE ONLY customer
  666.     ADD CONSTRAINT customer_address_id_fkey FOREIGN KEY (address_id) REFERENCES address(address_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  667.  
  668.  
  669. --
  670. -- Name: film_actor_actor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  671. --
  672.  
  673. ALTER TABLE ONLY film_actor
  674.     ADD CONSTRAINT film_actor_actor_id_fkey FOREIGN KEY (actor_id) REFERENCES actor(actor_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  675.  
  676.  
  677. --
  678. -- Name: film_actor_film_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  679. --
  680.  
  681. ALTER TABLE ONLY film_actor
  682.     ADD CONSTRAINT film_actor_film_id_fkey FOREIGN KEY (film_id) REFERENCES film(film_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  683.  
  684.  
  685. --
  686. -- Name: film_category_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  687. --
  688.  
  689. ALTER TABLE ONLY film_category
  690.     ADD CONSTRAINT film_category_category_id_fkey FOREIGN KEY (category_id) REFERENCES category(category_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  691.  
  692.  
  693. --
  694. -- Name: film_category_film_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  695. --
  696.  
  697. ALTER TABLE ONLY film_category
  698.     ADD CONSTRAINT film_category_film_id_fkey FOREIGN KEY (film_id) REFERENCES film(film_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  699.  
  700.  
  701. --
  702. -- Name: film_language_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  703. --
  704.  
  705. ALTER TABLE ONLY film
  706.     ADD CONSTRAINT film_language_id_fkey FOREIGN KEY (language_id) REFERENCES language(language_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  707.  
  708.  
  709. --
  710. -- Name: fk_address_city; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  711. --
  712.  
  713. ALTER TABLE ONLY address
  714.     ADD CONSTRAINT fk_address_city FOREIGN KEY (city_id) REFERENCES city(city_id);
  715.  
  716.  
  717. --
  718. -- Name: fk_city; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  719. --
  720.  
  721. ALTER TABLE ONLY city
  722.     ADD CONSTRAINT fk_city FOREIGN KEY (country_id) REFERENCES country(country_id);
  723.  
  724.  
  725. --
  726. -- Name: inventory_film_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  727. --
  728.  
  729. ALTER TABLE ONLY inventory
  730.     ADD CONSTRAINT inventory_film_id_fkey FOREIGN KEY (film_id) REFERENCES film(film_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  731.  
  732.  
  733. --
  734. -- Name: payment_customer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  735. --
  736.  
  737. ALTER TABLE ONLY payment
  738.     ADD CONSTRAINT payment_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  739.  
  740.  
  741. --
  742. -- Name: payment_rental_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  743. --
  744.  
  745. ALTER TABLE ONLY payment
  746.     ADD CONSTRAINT payment_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id) ON UPDATE CASCADE ON DELETE SET NULL;
  747.  
  748.  
  749. --
  750. -- Name: payment_staff_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  751. --
  752.  
  753. ALTER TABLE ONLY payment
  754.     ADD CONSTRAINT payment_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  755.  
  756.  
  757. --
  758. -- Name: rental_customer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  759. --
  760.  
  761. ALTER TABLE ONLY rental
  762.     ADD CONSTRAINT rental_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  763.  
  764.  
  765. --
  766. -- Name: rental_inventory_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  767. --
  768.  
  769. ALTER TABLE ONLY rental
  770.     ADD CONSTRAINT rental_inventory_id_fkey FOREIGN KEY (inventory_id) REFERENCES inventory(inventory_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  771.  
  772.  
  773. --
  774. -- Name: rental_staff_id_key; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  775. --
  776.  
  777. ALTER TABLE ONLY rental
  778.     ADD CONSTRAINT rental_staff_id_key FOREIGN KEY (staff_id) REFERENCES staff(staff_id);
  779.  
  780.  
  781. --
  782. -- Name: staff_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  783. --
  784.  
  785. ALTER TABLE ONLY staff
  786.     ADD CONSTRAINT staff_address_id_fkey FOREIGN KEY (address_id) REFERENCES address(address_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  787.  
  788.  
  789. --
  790. -- Name: store_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  791. --
  792.  
  793. ALTER TABLE ONLY store
  794.     ADD CONSTRAINT store_address_id_fkey FOREIGN KEY (address_id) REFERENCES address(address_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  795.  
  796.  
  797. --
  798. -- Name: store_manager_staff_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  799. --
  800.  
  801. ALTER TABLE ONLY store
  802.     ADD CONSTRAINT store_manager_staff_id_fkey FOREIGN KEY (manager_staff_id) REFERENCES staff(staff_id) ON UPDATE CASCADE ON DELETE RESTRICT;
  803.  
  804.  
  805. --
  806. -- Name: public; Type: ACL; Schema: -; Owner: postgres
  807. --
  808.  
  809. REVOKE ALL ON SCHEMA public FROM PUBLIC;
  810. REVOKE ALL ON SCHEMA public FROM postgres;
  811. GRANT ALL ON SCHEMA public TO postgres;
  812. GRANT ALL ON SCHEMA public TO PUBLIC;
  813.  
  814.  
  815. --
  816. -- PostgreSQL database dump complete
  817. --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement