api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

blog_pgsql.sql 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. --
  2. -- PostgreSQL database dump
  3. --
  4. SET statement_timeout = 0;
  5. SET client_encoding = 'UTF8';
  6. SET standard_conforming_strings = on;
  7. SET check_function_bodies = false;
  8. SET client_min_messages = warning;
  9. SET search_path = public, pg_catalog;
  10. SET default_tablespace = '';
  11. SET default_with_oids = false;
  12. --
  13. -- Drop everything
  14. --
  15. DROP TABLE IF EXISTS categories CASCADE;
  16. DROP TABLE IF EXISTS comments CASCADE;
  17. DROP TABLE IF EXISTS post_tags CASCADE;
  18. DROP TABLE IF EXISTS posts CASCADE;
  19. DROP TABLE IF EXISTS tags CASCADE;
  20. DROP TABLE IF EXISTS users CASCADE;
  21. DROP TABLE IF EXISTS countries CASCADE;
  22. DROP TABLE IF EXISTS events CASCADE;
  23. DROP VIEW IF EXISTS tag_usage;
  24. DROP TABLE IF EXISTS products CASCADE;
  25. DROP TABLE IF EXISTS barcodes CASCADE;
  26. DROP TABLE IF EXISTS barcodes2 CASCADE;
  27. DROP TABLE IF EXISTS "kunsthåndværk" CASCADE;
  28. DROP TABLE IF EXISTS invisibles CASCADE;
  29. DROP TABLE IF EXISTS nopk CASCADE;
  30. --
  31. -- Name: categories; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  32. --
  33. CREATE TABLE categories (
  34. id serial NOT NULL,
  35. name character varying(255) NOT NULL,
  36. icon bytea
  37. );
  38. --
  39. -- Name: comments; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  40. --
  41. CREATE TABLE comments (
  42. id bigserial NOT NULL,
  43. post_id integer NOT NULL,
  44. message character varying(255) NOT NULL,
  45. category_id integer NOT NULL
  46. );
  47. --
  48. -- Name: post_tags; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  49. --
  50. CREATE TABLE post_tags (
  51. id serial NOT NULL,
  52. post_id integer NOT NULL,
  53. tag_id integer NOT NULL
  54. );
  55. --
  56. -- Name: posts; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  57. --
  58. CREATE TABLE posts (
  59. id serial NOT NULL,
  60. user_id integer NOT NULL,
  61. category_id integer NOT NULL,
  62. content character varying(255) NOT NULL
  63. );
  64. --
  65. -- Name: tags; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  66. --
  67. CREATE TABLE tags (
  68. id serial NOT NULL,
  69. name character varying(255) NOT NULL,
  70. is_important boolean NOT NULL
  71. );
  72. --
  73. -- Name: users; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  74. --
  75. CREATE TABLE users (
  76. id serial NOT NULL,
  77. username character varying(255) NOT NULL,
  78. password character varying(255) NOT NULL,
  79. location geometry
  80. );
  81. --
  82. -- Name: countries; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  83. --
  84. CREATE TABLE countries (
  85. id serial NOT NULL,
  86. name character varying(255) NOT NULL,
  87. shape geometry NOT NULL
  88. );
  89. --
  90. -- Name: events; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  91. --
  92. CREATE TABLE events (
  93. id serial NOT NULL,
  94. name character varying(255) NOT NULL,
  95. datetime timestamp,
  96. visitors bigint
  97. );
  98. --
  99. -- Name: tag_usage; Type: VIEW; Schema: public; Owner: postgres; Tablespace:
  100. --
  101. CREATE VIEW "tag_usage" AS select "tags"."id" as "id", "name", count("name") AS "count" from "tags", "post_tags" where "tags"."id" = "post_tags"."tag_id" group by "tags"."id", "name" order by "count" desc, "name";
  102. --
  103. -- Name: products; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  104. --
  105. CREATE TABLE products (
  106. id serial NOT NULL,
  107. name character varying(255) NOT NULL,
  108. price decimal(10,2) NOT NULL,
  109. properties jsonb NOT NULL,
  110. created_at timestamp NOT NULL,
  111. deleted_at timestamp NULL
  112. );
  113. --
  114. -- Name: barcodes; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  115. --
  116. CREATE TABLE barcodes (
  117. id serial NOT NULL,
  118. product_id integer NOT NULL,
  119. hex character varying(255) NOT NULL,
  120. bin bytea NOT NULL,
  121. ip_address character varying(15)
  122. );
  123. --
  124. -- Name: kunsthåndværk; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  125. --
  126. CREATE TABLE "kunsthåndværk" (
  127. id character varying(36) NOT NULL,
  128. "Umlauts ä_ö_ü-COUNT" integer NOT NULL,
  129. user_id integer NOT NULL,
  130. invisible character varying(36),
  131. invisible_id character varying(36)
  132. );
  133. --
  134. -- Name: invisibles; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  135. --
  136. CREATE TABLE "invisibles" (
  137. id character varying(36) NOT NULL
  138. );
  139. --
  140. -- Name: nopk; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
  141. --
  142. CREATE TABLE "nopk" (
  143. id character varying(36) NOT NULL
  144. );
  145. --
  146. -- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: postgres
  147. --
  148. INSERT INTO "categories" ("name", "icon") VALUES
  149. ('announcement', NULL),
  150. ('article', NULL),
  151. ('comment', NULL);
  152. --
  153. -- Data for Name: comments; Type: TABLE DATA; Schema: public; Owner: postgres
  154. --
  155. INSERT INTO "comments" ("post_id", "message", "category_id") VALUES
  156. (1, 'great', 3),
  157. (1, 'fantastic', 3),
  158. (2, 'thank you', 3),
  159. (2, 'awesome', 3);
  160. --
  161. -- Data for Name: post_tags; Type: TABLE DATA; Schema: public; Owner: postgres
  162. --
  163. INSERT INTO "post_tags" ("post_id", "tag_id") VALUES
  164. (1, 1),
  165. (1, 2),
  166. (2, 1),
  167. (2, 2);
  168. --
  169. -- Data for Name: posts; Type: TABLE DATA; Schema: public; Owner: postgres
  170. --
  171. INSERT INTO "posts" ("user_id", "category_id", "content") VALUES
  172. (1, 1, 'blog started'),
  173. (1, 2, 'It works!');
  174. --
  175. -- Data for Name: tags; Type: TABLE DATA; Schema: public; Owner: postgres
  176. --
  177. INSERT INTO "tags" ("name", "is_important") VALUES
  178. ('funny', false),
  179. ('important', true);
  180. --
  181. -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
  182. --
  183. INSERT INTO "users" ("username", "password", "location") VALUES
  184. ('user1', 'pass1', NULL),
  185. ('user2', '$2y$10$cg7/nswxVZ0cmVIsMB/pVOh1OfcHScBJGq7Xu4KF9dFEQgRZ8HWe.', NULL);
  186. --
  187. -- Data for Name: countries; Type: TABLE DATA; Schema: public; Owner: postgres
  188. --
  189. INSERT INTO "countries" ("name", "shape") VALUES
  190. ('Left', ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
  191. ('Right', ST_GeomFromText('POLYGON ((70 10, 80 40, 60 40, 50 20, 70 10))')),
  192. ('Point', ST_GeomFromText('POINT (30 10)')),
  193. ('Line', ST_GeomFromText('LINESTRING (30 10, 10 30, 40 40)')),
  194. ('Poly1', ST_GeomFromText('POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))')),
  195. ('Poly2', ST_GeomFromText('POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))')),
  196. ('Mpoint', ST_GeomFromText('MULTIPOINT (10 40, 40 30, 20 20, 30 10)')),
  197. ('Mline', ST_GeomFromText('MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))')),
  198. ('Mpoly1', ST_GeomFromText('MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))')),
  199. ('Mpoly2', ST_GeomFromText('MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)))')),
  200. ('Gcoll', ST_GeomFromText('GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))'));
  201. --
  202. -- Data for Name: events; Type: TABLE DATA; Schema: public; Owner: postgres
  203. --
  204. INSERT INTO "events" ("name", "datetime", "visitors") VALUES
  205. ('Launch', '2016-01-01 13:01:01', 0);
  206. --
  207. -- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: postgres
  208. --
  209. INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
  210. ('Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
  211. --
  212. -- Data for Name: barcodes; Type: TABLE DATA; Schema: public; Owner: postgres
  213. --
  214. INSERT INTO "barcodes" ("product_id", "hex", "bin", "ip_address") VALUES
  215. (1, '00ff01', E'\\x00ff01', '127.0.0.1');
  216. --
  217. -- Data for Name: kunsthåndværk; Type: TABLE DATA; Schema: public; Owner: postgres
  218. --
  219. INSERT INTO "kunsthåndværk" ("id", "Umlauts ä_ö_ü-COUNT", "user_id", "invisible", "invisible_id") VALUES
  220. ('e42c77c6-06a4-4502-816c-d112c7142e6d', 1, 1, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d'),
  221. ('e31ecfe6-591f-4660-9fbd-1a232083037f', 2, 2, NULL, 'e42c77c6-06a4-4502-816c-d112c7142e6d');
  222. --
  223. -- Data for Name: invisibles; Type: TABLE DATA; Schema: public; Owner: postgres
  224. --
  225. INSERT INTO "invisibles" ("id") VALUES
  226. ('e42c77c6-06a4-4502-816c-d112c7142e6d');
  227. --
  228. -- Data for Name: nopk; Type: TABLE DATA; Schema: public; Owner: postgres
  229. --
  230. INSERT INTO "nopk" ("id") VALUES
  231. ('e42c77c6-06a4-4502-816c-d112c7142e6d');
  232. --
  233. -- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  234. --
  235. ALTER TABLE ONLY categories
  236. ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
  237. --
  238. -- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  239. --
  240. ALTER TABLE ONLY comments
  241. ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
  242. --
  243. -- Name: post_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  244. --
  245. ALTER TABLE ONLY post_tags
  246. ADD CONSTRAINT post_tags_pkey PRIMARY KEY (id);
  247. --
  248. -- Name: post_tags_post_id_tag_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  249. --
  250. ALTER TABLE ONLY post_tags
  251. ADD CONSTRAINT post_tags_post_id_tag_id_key UNIQUE (post_id, tag_id);
  252. --
  253. -- Name: posts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  254. --
  255. ALTER TABLE ONLY posts
  256. ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
  257. --
  258. -- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  259. --
  260. ALTER TABLE ONLY tags
  261. ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
  262. --
  263. -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  264. --
  265. ALTER TABLE ONLY users
  266. ADD CONSTRAINT users_pkey PRIMARY KEY (id);
  267. --
  268. -- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  269. --
  270. ALTER TABLE ONLY countries
  271. ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
  272. --
  273. -- Name: events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  274. --
  275. ALTER TABLE ONLY events
  276. ADD CONSTRAINT events_pkey PRIMARY KEY (id);
  277. --
  278. -- Name: products_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  279. --
  280. ALTER TABLE ONLY products
  281. ADD CONSTRAINT products_pkey PRIMARY KEY (id);
  282. --
  283. -- Name: barcodes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  284. --
  285. ALTER TABLE ONLY barcodes
  286. ADD CONSTRAINT barcodes_pkey PRIMARY KEY (id);
  287. --
  288. -- Name: kunsthåndværk_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  289. --
  290. ALTER TABLE ONLY "kunsthåndværk"
  291. ADD CONSTRAINT "kunsthåndværk_pkey" PRIMARY KEY (id);
  292. --
  293. -- Name: invisibles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
  294. --
  295. ALTER TABLE ONLY "invisibles"
  296. ADD CONSTRAINT "invisibles_pkey" PRIMARY KEY (id);
  297. --
  298. -- Name: comments_post_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  299. --
  300. CREATE INDEX comments_post_id_idx ON comments USING btree (post_id);
  301. --
  302. -- Name: comments_category_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  303. --
  304. CREATE INDEX comments_category_id_idx ON comments USING btree (category_id);
  305. --
  306. -- Name: post_tags_post_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  307. --
  308. CREATE INDEX post_tags_post_id_idx ON post_tags USING btree (post_id);
  309. --
  310. -- Name: post_tags_tag_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  311. --
  312. CREATE INDEX post_tags_tag_id_idx ON post_tags USING btree (tag_id);
  313. --
  314. -- Name: posts_category_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  315. --
  316. CREATE INDEX posts_category_id_idx ON posts USING btree (category_id);
  317. --
  318. -- Name: posts_user_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  319. --
  320. CREATE INDEX posts_user_id_idx ON posts USING btree (user_id);
  321. --
  322. -- Name: barcodes_product_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  323. --
  324. CREATE INDEX barcodes_product_id_idx ON barcodes USING btree (product_id);
  325. --
  326. -- Name: kunsthåndværk_Umlauts ä_ö_ü-COUNT_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  327. --
  328. CREATE INDEX "kunsthåndværk_Umlauts ä_ö_ü-COUNT_idx" ON "kunsthåndværk" USING btree ("Umlauts ä_ö_ü-COUNT");
  329. --
  330. -- Name: kunsthåndværk_user_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  331. --
  332. CREATE INDEX "kunsthåndværk_user_id_idx" ON "kunsthåndværk" USING btree (user_id);
  333. --
  334. -- Name: kunsthåndværk_invisible_id_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
  335. --
  336. CREATE INDEX "kunsthåndværk_invisible_id_idx" ON "kunsthåndværk" USING btree (invisible_id);
  337. --
  338. -- Name: comments_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  339. --
  340. ALTER TABLE ONLY comments
  341. ADD CONSTRAINT comments_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
  342. --
  343. -- Name: comments_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  344. --
  345. ALTER TABLE ONLY comments
  346. ADD CONSTRAINT comments_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
  347. --
  348. -- Name: post_tags_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  349. --
  350. ALTER TABLE ONLY post_tags
  351. ADD CONSTRAINT post_tags_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id);
  352. --
  353. -- Name: post_tags_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  354. --
  355. ALTER TABLE ONLY post_tags
  356. ADD CONSTRAINT post_tags_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES tags(id);
  357. --
  358. -- Name: posts_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  359. --
  360. ALTER TABLE ONLY posts
  361. ADD CONSTRAINT posts_category_id_fkey FOREIGN KEY (category_id) REFERENCES categories(id);
  362. --
  363. -- Name: posts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  364. --
  365. ALTER TABLE ONLY posts
  366. ADD CONSTRAINT posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
  367. --
  368. -- Name: barcodes_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  369. --
  370. ALTER TABLE ONLY barcodes
  371. ADD CONSTRAINT barcodes_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id);
  372. --
  373. -- Name: kunsthåndværk_Umlauts ä_ö_ü-COUNT_uc; Type: UNIQUE CONSTRAINT; Schema: public; Owner: postgres
  374. --
  375. ALTER TABLE ONLY "kunsthåndværk"
  376. ADD CONSTRAINT "kunsthåndværk_Umlauts ä_ö_ü-COUNT_uc" UNIQUE ("Umlauts ä_ö_ü-COUNT");
  377. --
  378. -- Name: kunsthåndværk_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  379. --
  380. ALTER TABLE ONLY "kunsthåndværk"
  381. ADD CONSTRAINT "kunsthåndværk_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id);
  382. --
  383. -- Name: kunsthåndværk_invisible_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  384. --
  385. ALTER TABLE ONLY "kunsthåndværk"
  386. ADD CONSTRAINT "kunsthåndværk_invisible_id_fkey" FOREIGN KEY (invisible_id) REFERENCES invisibles(id);
  387. --
  388. -- PostgreSQL database dump complete
  389. --