Advertisement
VladSmirN

dump.sql

Oct 16th, 2022 (edited)
3,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- PostgreSQL database dump
  3. --
  4.  
  5. -- Dumped from database version 14.5
  6. -- Dumped by pg_dump version 14.5
  7.  
  8. SET statement_timeout = 0;
  9. SET lock_timeout = 0;
  10. SET idle_in_transaction_session_timeout = 0;
  11. SET client_encoding = 'UTF8';
  12. SET standard_conforming_strings = on;
  13. SELECT pg_catalog.set_config('search_path', '', false);
  14. SET check_function_bodies = false;
  15. SET xmloption = content;
  16. SET client_min_messages = warning;
  17. SET row_security = off;
  18.  
  19. --
  20. -- Name: database_name; Type: DATABASE; Schema: -; Owner: postgres
  21. --
  22.  
  23. CREATE DATABASE database_name WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'Russian_Russia.1251';
  24.  
  25.  
  26. ALTER DATABASE database_name OWNER TO postgres;
  27.  
  28. \connect database_name
  29.  
  30. SET statement_timeout = 0;
  31. SET lock_timeout = 0;
  32. SET idle_in_transaction_session_timeout = 0;
  33. SET client_encoding = 'UTF8';
  34. SET standard_conforming_strings = on;
  35. SELECT pg_catalog.set_config('search_path', '', false);
  36. SET check_function_bodies = false;
  37. SET xmloption = content;
  38. SET client_min_messages = warning;
  39. SET row_security = off;
  40.  
  41. --
  42. -- Name: schema; Type: SCHEMA; Schema: -; Owner: postgres
  43. --
  44.  
  45. CREATE SCHEMA schema;
  46.  
  47.  
  48. ALTER SCHEMA schema OWNER TO postgres;
  49.  
  50. SET default_tablespace = '';
  51.  
  52. SET default_table_access_method = heap;
  53.  
  54. --
  55. -- Name: galaxy; Type: TABLE; Schema: schema; Owner: postgres
  56. --
  57.  
  58. CREATE TABLE schema.galaxy (
  59.     size integer,
  60.     class text,
  61.     name text,
  62.     id_galaxy uuid DEFAULT gen_random_uuid() NOT NULL
  63. );
  64.  
  65.  
  66. ALTER TABLE schema.galaxy OWNER TO postgres;
  67.  
  68. --
  69. -- Name: planet; Type: TABLE; Schema: schema; Owner: postgres
  70. --
  71.  
  72. CREATE TABLE schema.planet (
  73.     name text,
  74.     id_planet uuid DEFAULT gen_random_uuid() NOT NULL,
  75.     id_system uuid NOT NULL,
  76.     radius integer
  77. );
  78.  
  79.  
  80. ALTER TABLE schema.planet OWNER TO postgres;
  81.  
  82. --
  83. -- Name: system; Type: TABLE; Schema: schema; Owner: postgres
  84. --
  85.  
  86. CREATE TABLE schema.system (
  87.     name text,
  88.     id_system uuid DEFAULT gen_random_uuid() NOT NULL,
  89.     id_galaxy uuid NOT NULL
  90. );
  91.  
  92.  
  93. ALTER TABLE schema.system OWNER TO postgres;
  94.  
  95. --
  96. -- Data for Name: galaxy; Type: TABLE DATA; Schema: schema; Owner: postgres
  97. --
  98.  
  99. COPY schema.galaxy (size, class, name, id_galaxy) FROM stdin;
  100. 16  spiral  Milky Way   c3ccdb16-3886-46dd-a680-e4e71b254b61
  101. \.
  102.  
  103.  
  104. --
  105. -- Data for Name: planet; Type: TABLE DATA; Schema: schema; Owner: postgres
  106. --
  107.  
  108. COPY schema.planet (name, id_planet, id_system, radius) FROM stdin;
  109. Earth   e4c32a15-f29b-417d-905f-f99e33825d0a    80ac4fe6-05f0-47ba-a1fd-6a4f7c7b2208    6371000
  110. Venus   37a5c663-55c3-4e64-af96-7d74dc00d969    80ac4fe6-05f0-47ba-a1fd-6a4f7c7b2208    6051000
  111. Mars    869ea851-43f2-483c-9d5e-816925a6a199    80ac4fe6-05f0-47ba-a1fd-6a4f7c7b2208    3389000
  112. \.
  113.  
  114.  
  115. --
  116. -- Data for Name: system; Type: TABLE DATA; Schema: schema; Owner: postgres
  117. --
  118.  
  119. COPY schema.system (name, id_system, id_galaxy) FROM stdin;
  120. solar system    80ac4fe6-05f0-47ba-a1fd-6a4f7c7b2208    c3ccdb16-3886-46dd-a680-e4e71b254b61
  121. \.
  122.  
  123.  
  124. --
  125. -- Name: galaxy galaxy_key; Type: CONSTRAINT; Schema: schema; Owner: postgres
  126. --
  127.  
  128. ALTER TABLE ONLY schema.galaxy
  129.     ADD CONSTRAINT galaxy_key PRIMARY KEY (id_galaxy);
  130.  
  131.  
  132. --
  133. -- Name: planet id_planet; Type: CONSTRAINT; Schema: schema; Owner: postgres
  134. --
  135.  
  136. ALTER TABLE ONLY schema.planet
  137.     ADD CONSTRAINT id_planet PRIMARY KEY (id_planet);
  138.  
  139.  
  140. --
  141. -- Name: system key_system; Type: CONSTRAINT; Schema: schema; Owner: postgres
  142. --
  143.  
  144. ALTER TABLE ONLY schema.system
  145.     ADD CONSTRAINT key_system PRIMARY KEY (id_system);
  146.  
  147.  
  148. --
  149. -- Name: system foreign_key_galaxy; Type: FK CONSTRAINT; Schema: schema; Owner: postgres
  150. --
  151.  
  152. ALTER TABLE ONLY schema.system
  153.     ADD CONSTRAINT foreign_key_galaxy FOREIGN KEY (id_galaxy) REFERENCES schema.galaxy(id_galaxy);
  154.  
  155.  
  156. --
  157. -- Name: planet foreign_key_system; Type: FK CONSTRAINT; Schema: schema; Owner: postgres
  158. --
  159.  
  160. ALTER TABLE ONLY schema.planet
  161.     ADD CONSTRAINT foreign_key_system FOREIGN KEY (id_system) REFERENCES schema.system(id_system);
  162.  
  163.  
  164. --
  165. -- PostgreSQL database dump complete
  166. --
  167.  
  168.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement