sharix_open_schema.sql 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691
  1. --
  2. -- PostgreSQL database dump
  3. --
  4. -- Dumped from database version 12.7
  5. -- Dumped by pg_dump version 12.7
  6. SET statement_timeout = 0;
  7. SET lock_timeout = 0;
  8. SET idle_in_transaction_session_timeout = 0;
  9. SET client_encoding = 'UTF8';
  10. SET standard_conforming_strings = on;
  11. SELECT pg_catalog.set_config('search_path', '', false);
  12. SET check_function_bodies = false;
  13. SET xmloption = content;
  14. SET client_min_messages = warning;
  15. SET row_security = off;
  16. SET default_tablespace = '';
  17. SET default_table_access_method = heap;
  18. --
  19. -- Name: cars_log; Type: TABLE; Schema: public; Owner: postgres
  20. --
  21. CREATE TABLE public.cars_log (
  22. id integer NOT NULL,
  23. resource_id integer NOT NULL,
  24. time_log_created timestamp with time zone NOT NULL,
  25. operation character(1) NOT NULL,
  26. user_id integer NOT NULL
  27. );
  28. ALTER TABLE public.cars_log OWNER TO postgres;
  29. --
  30. -- Name: cars_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  31. --
  32. CREATE SEQUENCE public.cars_log_id_seq
  33. AS integer
  34. START WITH 1
  35. INCREMENT BY 1
  36. NO MINVALUE
  37. NO MAXVALUE
  38. CACHE 1;
  39. ALTER TABLE public.cars_log_id_seq OWNER TO postgres;
  40. --
  41. -- Name: cars_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  42. --
  43. ALTER SEQUENCE public.cars_log_id_seq OWNED BY public.cars_log.id;
  44. --
  45. -- Name: client; Type: TABLE; Schema: public; Owner: postgres
  46. --
  47. CREATE TABLE public.client (
  48. id integer NOT NULL,
  49. user_id integer NOT NULL,
  50. requirements name NOT NULL,
  51. status character(1) DEFAULT 'A'::bpchar,
  52. ticket_status integer,
  53. id_metaservice integer NOT NULL,
  54. is_global character(1) NOT NULL,
  55. is_visible character(1) NOT NULL
  56. );
  57. ALTER TABLE public.client OWNER TO postgres;
  58. --
  59. -- Name: client_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  60. --
  61. CREATE SEQUENCE public.client_id_seq
  62. AS integer
  63. START WITH 1
  64. INCREMENT BY 1
  65. NO MINVALUE
  66. NO MAXVALUE
  67. CACHE 1;
  68. ALTER TABLE public.client_id_seq OWNER TO postgres;
  69. --
  70. -- Name: client_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  71. --
  72. ALTER SEQUENCE public.client_id_seq OWNED BY public.client.id;
  73. --
  74. -- Name: company; Type: TABLE; Schema: public; Owner: postgres
  75. --
  76. CREATE TABLE public.company (
  77. id integer NOT NULL,
  78. legal_name character varying(255) NOT NULL,
  79. repr_id integer NOT NULL,
  80. kpp character varying(9) NOT NULL,
  81. ogrn character varying(13) NOT NULL,
  82. bank_name character varying(255) NOT NULL,
  83. bik character varying(9) NOT NULL,
  84. ks integer NOT NULL,
  85. rs integer NOT NULL,
  86. address character varying(255) NOT NULL,
  87. id_metaservice integer,
  88. is_global character(1) NOT NULL,
  89. is_visible character(1) NOT NULL,
  90. requirements name,
  91. status character(1) DEFAULT 'A'::bpchar,
  92. ticket_status integer
  93. );
  94. ALTER TABLE public.company OWNER TO postgres;
  95. --
  96. -- Name: company_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  97. --
  98. CREATE SEQUENCE public.company_id_seq
  99. AS integer
  100. START WITH 1
  101. INCREMENT BY 1
  102. NO MINVALUE
  103. NO MAXVALUE
  104. CACHE 1;
  105. ALTER TABLE public.company_id_seq OWNER TO postgres;
  106. --
  107. -- Name: company_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  108. --
  109. ALTER SEQUENCE public.company_id_seq OWNED BY public.company.id;
  110. --
  111. -- Name: current_cars; Type: TABLE; Schema: public; Owner: postgres
  112. --
  113. CREATE TABLE public.current_cars (
  114. id integer NOT NULL,
  115. resource_id integer NOT NULL,
  116. user_id integer NOT NULL,
  117. order_status character(1),
  118. order_id character(1),
  119. current_token name NOT NULL,
  120. doors_output character(1) NOT NULL,
  121. engine_input character(1) NOT NULL,
  122. central_lock_input character(1) NOT NULL,
  123. ignition_input character(1) NOT NULL,
  124. doors_input character(1) NOT NULL,
  125. input4 name,
  126. controller_status character(1) NOT NULL,
  127. signal_gsm integer NOT NULL,
  128. operator_gsm name NOT NULL,
  129. signal_gps integer NOT NULL,
  130. location character varying(30),
  131. speed real NOT NULL,
  132. direction character(1) NOT NULL,
  133. address name NOT NULL,
  134. battery_level integer NOT NULL,
  135. board_voltage numeric(3,1) NOT NULL
  136. );
  137. ALTER TABLE public.current_cars OWNER TO postgres;
  138. --
  139. -- Name: current_cars_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  140. --
  141. CREATE SEQUENCE public.current_cars_id_seq
  142. AS integer
  143. START WITH 1
  144. INCREMENT BY 1
  145. NO MINVALUE
  146. NO MAXVALUE
  147. CACHE 1;
  148. ALTER TABLE public.current_cars_id_seq OWNER TO postgres;
  149. --
  150. -- Name: current_cars_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  151. --
  152. ALTER SEQUENCE public.current_cars_id_seq OWNED BY public.current_cars.id;
  153. --
  154. -- Name: current_orders; Type: TABLE; Schema: public; Owner: postgres
  155. --
  156. CREATE TABLE public.current_orders (
  157. id integer NOT NULL,
  158. service_id integer NOT NULL,
  159. service_type_id integer NOT NULL,
  160. state integer NOT NULL,
  161. id_metaservice integer NOT NULL,
  162. time_created timestamp with time zone NOT NULL,
  163. time_placed timestamp with time zone NOT NULL,
  164. time_start timestamp with time zone NOT NULL,
  165. time_finish_predicted timestamp with time zone NOT NULL,
  166. time_finish_real timestamp with time zone NOT NULL,
  167. provider_id integer NOT NULL,
  168. receiver_id integer NOT NULL,
  169. client_id integer NOT NULL,
  170. predicted_price money NOT NULL,
  171. real_price money NOT NULL,
  172. is_global character(1) NOT NULL,
  173. is_visible character(1) NOT NULL
  174. );
  175. ALTER TABLE public.current_orders OWNER TO postgres;
  176. --
  177. -- Name: current_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  178. --
  179. CREATE SEQUENCE public.current_orders_id_seq
  180. AS integer
  181. START WITH 1
  182. INCREMENT BY 1
  183. NO MINVALUE
  184. NO MAXVALUE
  185. CACHE 1;
  186. ALTER TABLE public.current_orders_id_seq OWNER TO postgres;
  187. --
  188. -- Name: current_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  189. --
  190. ALTER SEQUENCE public.current_orders_id_seq OWNED BY public.current_orders.id;
  191. --
  192. -- Name: current_resources; Type: TABLE; Schema: public; Owner: postgres
  193. --
  194. CREATE TABLE public.current_resources (
  195. id integer NOT NULL,
  196. resource_id integer NOT NULL,
  197. operation text NOT NULL,
  198. user_id integer NOT NULL,
  199. current_token text NOT NULL,
  200. state integer NOT NULL
  201. );
  202. ALTER TABLE public.current_resources OWNER TO postgres;
  203. --
  204. -- Name: current_resources_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  205. --
  206. CREATE SEQUENCE public.current_resources_id_seq
  207. AS integer
  208. START WITH 1
  209. INCREMENT BY 1
  210. NO MINVALUE
  211. NO MAXVALUE
  212. CACHE 1;
  213. ALTER TABLE public.current_resources_id_seq OWNER TO postgres;
  214. --
  215. -- Name: current_resources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  216. --
  217. ALTER SEQUENCE public.current_resources_id_seq OWNED BY public.current_resources.id;
  218. --
  219. -- Name: current_timetable; Type: TABLE; Schema: public; Owner: postgres
  220. --
  221. CREATE TABLE public.current_timetable (
  222. id integer NOT NULL,
  223. order_id integer NOT NULL,
  224. service_type_id integer NOT NULL,
  225. provider_id integer NOT NULL,
  226. resource_id integer NOT NULL,
  227. time_start_predicted timestamp with time zone,
  228. time_finished_predicted timestamp with time zone,
  229. gap integer
  230. );
  231. ALTER TABLE public.current_timetable OWNER TO postgres;
  232. --
  233. -- Name: current_timetable_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  234. --
  235. CREATE SEQUENCE public.current_timetable_id_seq
  236. AS integer
  237. START WITH 1
  238. INCREMENT BY 1
  239. NO MINVALUE
  240. NO MAXVALUE
  241. CACHE 1;
  242. ALTER TABLE public.current_timetable_id_seq OWNER TO postgres;
  243. --
  244. -- Name: current_timetable_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  245. --
  246. ALTER SEQUENCE public.current_timetable_id_seq OWNED BY public.current_timetable.id;
  247. --
  248. -- Name: document; Type: TABLE; Schema: public; Owner: postgres
  249. --
  250. CREATE TABLE public.document (
  251. id integer NOT NULL,
  252. id_metaservice integer NOT NULL,
  253. doctype character varying(2) NOT NULL,
  254. expire_date date NOT NULL,
  255. datalink name,
  256. user_id integer NOT NULL,
  257. company_id integer,
  258. is_global character(1) NOT NULL,
  259. is_visible character(1) NOT NULL,
  260. check_level character(1),
  261. check_by integer,
  262. check_date timestamp with time zone,
  263. status character(1),
  264. ticket_status integer
  265. );
  266. ALTER TABLE public.document OWNER TO postgres;
  267. --
  268. -- Name: document_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  269. --
  270. CREATE SEQUENCE public.document_id_seq
  271. AS integer
  272. START WITH 1
  273. INCREMENT BY 1
  274. NO MINVALUE
  275. NO MAXVALUE
  276. CACHE 1;
  277. ALTER TABLE public.document_id_seq OWNER TO postgres;
  278. --
  279. -- Name: document_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  280. --
  281. ALTER SEQUENCE public.document_id_seq OWNED BY public.document.id;
  282. --
  283. -- Name: metaservice; Type: TABLE; Schema: public; Owner: postgres
  284. --
  285. CREATE TABLE public.metaservice (
  286. id integer NOT NULL,
  287. metaservicename text NOT NULL,
  288. legalname text NOT NULL,
  289. representative integer NOT NULL
  290. );
  291. ALTER TABLE public.metaservice OWNER TO postgres;
  292. --
  293. -- Name: metaservice_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  294. --
  295. CREATE SEQUENCE public.metaservice_id_seq
  296. AS integer
  297. START WITH 1
  298. INCREMENT BY 1
  299. NO MINVALUE
  300. NO MAXVALUE
  301. CACHE 1;
  302. ALTER TABLE public.metaservice_id_seq OWNER TO postgres;
  303. --
  304. -- Name: metaservice_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  305. --
  306. ALTER SEQUENCE public.metaservice_id_seq OWNED BY public.metaservice.id;
  307. --
  308. -- Name: metauser; Type: TABLE; Schema: public; Owner: postgres
  309. --
  310. CREATE TABLE public.metauser (
  311. id integer NOT NULL,
  312. email text NOT NULL,
  313. name text NOT NULL,
  314. surname text NOT NULL,
  315. phone text NOT NULL,
  316. password text NOT NULL
  317. );
  318. ALTER TABLE public.metauser OWNER TO postgres;
  319. --
  320. -- Name: metauser_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  321. --
  322. CREATE SEQUENCE public.metauser_id_seq
  323. AS integer
  324. START WITH 1
  325. INCREMENT BY 1
  326. NO MINVALUE
  327. NO MAXVALUE
  328. CACHE 1;
  329. ALTER TABLE public.metauser_id_seq OWNER TO postgres;
  330. --
  331. -- Name: metauser_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  332. --
  333. ALTER SEQUENCE public.metauser_id_seq OWNED BY public.metauser.id;
  334. --
  335. -- Name: order_list_log; Type: TABLE; Schema: public; Owner: postgres
  336. --
  337. CREATE TABLE public.order_list_log (
  338. id integer NOT NULL,
  339. payment_transaction_id integer NOT NULL,
  340. service_id integer NOT NULL,
  341. service_type_id integer NOT NULL,
  342. time_placed timestamp with time zone NOT NULL,
  343. time_start timestamp with time zone NOT NULL,
  344. time_finish_predicted timestamp with time zone,
  345. time_finish_real timestamp with time zone NOT NULL,
  346. order_place_start character varying(255) NOT NULL,
  347. order_place_predicted character varying(255) NOT NULL,
  348. order_place_real character varying(255) NOT NULL,
  349. price money NOT NULL,
  350. provider integer NOT NULL,
  351. receiver integer NOT NULL,
  352. client integer NOT NULL
  353. );
  354. ALTER TABLE public.order_list_log OWNER TO postgres;
  355. --
  356. -- Name: order_list_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  357. --
  358. CREATE SEQUENCE public.order_list_log_id_seq
  359. AS integer
  360. START WITH 1
  361. INCREMENT BY 1
  362. NO MINVALUE
  363. NO MAXVALUE
  364. CACHE 1;
  365. ALTER TABLE public.order_list_log_id_seq OWNER TO postgres;
  366. --
  367. -- Name: order_list_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  368. --
  369. ALTER SEQUENCE public.order_list_log_id_seq OWNED BY public.order_list_log.id;
  370. --
  371. -- Name: orders; Type: TABLE; Schema: public; Owner: postgres
  372. --
  373. CREATE TABLE public.orders (
  374. id integer NOT NULL,
  375. service_id integer NOT NULL,
  376. service_type_id integer NOT NULL,
  377. state integer NOT NULL,
  378. id_metaservice integer NOT NULL,
  379. time_created timestamp with time zone NOT NULL,
  380. time_placed timestamp with time zone NOT NULL,
  381. time_start timestamp with time zone NOT NULL,
  382. time_finish_predicted timestamp with time zone NOT NULL,
  383. time_finish_real timestamp with time zone NOT NULL,
  384. provider_id integer NOT NULL,
  385. receiver_id integer NOT NULL,
  386. client_id integer NOT NULL,
  387. predicted_price numeric(10,2) NOT NULL,
  388. real_price numeric(10,2) NOT NULL,
  389. is_global character(1) NOT NULL,
  390. is_visible character(1) NOT NULL
  391. );
  392. ALTER TABLE public.orders OWNER TO postgres;
  393. --
  394. -- Name: orders_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  395. --
  396. CREATE SEQUENCE public.orders_id_seq
  397. AS integer
  398. START WITH 1
  399. INCREMENT BY 1
  400. NO MINVALUE
  401. NO MAXVALUE
  402. CACHE 1;
  403. ALTER TABLE public.orders_id_seq OWNER TO postgres;
  404. --
  405. -- Name: orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  406. --
  407. ALTER SEQUENCE public.orders_id_seq OWNED BY public.orders.id;
  408. --
  409. -- Name: permissions; Type: TABLE; Schema: public; Owner: postgres
  410. --
  411. CREATE TABLE public.permissions (
  412. id integer NOT NULL,
  413. id_metaservice integer NOT NULL,
  414. id_permission integer NOT NULL,
  415. user_id integer NOT NULL,
  416. is_global character(1) NOT NULL,
  417. is_visible character(1) NOT NULL,
  418. check_level character(1),
  419. check_by integer,
  420. check_date timestamp with time zone NOT NULL,
  421. status character(1),
  422. ticket_status integer
  423. );
  424. ALTER TABLE public.permissions OWNER TO postgres;
  425. --
  426. -- Name: permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  427. --
  428. CREATE SEQUENCE public.permissions_id_seq
  429. AS integer
  430. START WITH 1
  431. INCREMENT BY 1
  432. NO MINVALUE
  433. NO MAXVALUE
  434. CACHE 1;
  435. ALTER TABLE public.permissions_id_seq OWNER TO postgres;
  436. --
  437. -- Name: permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  438. --
  439. ALTER SEQUENCE public.permissions_id_seq OWNED BY public.permissions.id;
  440. --
  441. -- Name: provider; Type: TABLE; Schema: public; Owner: postgres
  442. --
  443. CREATE TABLE public.provider (
  444. id integer NOT NULL,
  445. type integer NOT NULL,
  446. id_company integer NOT NULL,
  447. user_id integer NOT NULL,
  448. requirements name NOT NULL,
  449. status character(1) DEFAULT 'A'::bpchar,
  450. ticket_status integer,
  451. id_metaservice integer NOT NULL,
  452. is_global character(1) NOT NULL,
  453. is_visible character(1) NOT NULL,
  454. location_type name NOT NULL,
  455. default_location name NOT NULL
  456. );
  457. ALTER TABLE public.provider OWNER TO postgres;
  458. --
  459. -- Name: provider_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  460. --
  461. CREATE SEQUENCE public.provider_id_seq
  462. AS integer
  463. START WITH 1
  464. INCREMENT BY 1
  465. NO MINVALUE
  466. NO MAXVALUE
  467. CACHE 1;
  468. ALTER TABLE public.provider_id_seq OWNER TO postgres;
  469. --
  470. -- Name: provider_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  471. --
  472. ALTER SEQUENCE public.provider_id_seq OWNED BY public.provider.id;
  473. --
  474. -- Name: relationship; Type: TABLE; Schema: public; Owner: postgres
  475. --
  476. CREATE TABLE public.relationship (
  477. id integer NOT NULL,
  478. user_id_who integer NOT NULL,
  479. user_id_whom integer NOT NULL,
  480. neg_type character(1) NOT NULL,
  481. id_metaservice integer,
  482. is_global character(1) NOT NULL,
  483. is_visible character(1) NOT NULL,
  484. requirements name,
  485. status character(1) DEFAULT 'A'::bpchar,
  486. ticket_status integer
  487. );
  488. ALTER TABLE public.relationship OWNER TO postgres;
  489. --
  490. -- Name: relationship_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  491. --
  492. CREATE SEQUENCE public.relationship_id_seq
  493. AS integer
  494. START WITH 1
  495. INCREMENT BY 1
  496. NO MINVALUE
  497. NO MAXVALUE
  498. CACHE 1;
  499. ALTER TABLE public.relationship_id_seq OWNER TO postgres;
  500. --
  501. -- Name: relationship_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  502. --
  503. ALTER SEQUENCE public.relationship_id_seq OWNED BY public.relationship.id;
  504. --
  505. -- Name: resource; Type: TABLE; Schema: public; Owner: postgres
  506. --
  507. CREATE TABLE public.resource (
  508. id integer NOT NULL,
  509. type_id integer NOT NULL,
  510. user_id integer NOT NULL,
  511. requirements name NOT NULL,
  512. status character(1) DEFAULT 'A'::bpchar,
  513. ticket_status integer,
  514. id_metaservice integer NOT NULL,
  515. is_global character(1) NOT NULL,
  516. is_visible character(1) NOT NULL
  517. );
  518. ALTER TABLE public.resource OWNER TO postgres;
  519. --
  520. -- Name: resource_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  521. --
  522. CREATE SEQUENCE public.resource_id_seq
  523. AS integer
  524. START WITH 1
  525. INCREMENT BY 1
  526. NO MINVALUE
  527. NO MAXVALUE
  528. CACHE 1;
  529. ALTER TABLE public.resource_id_seq OWNER TO postgres;
  530. --
  531. -- Name: resource_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  532. --
  533. ALTER SEQUENCE public.resource_id_seq OWNED BY public.resource.id;
  534. --
  535. -- Name: resource_log; Type: TABLE; Schema: public; Owner: postgres
  536. --
  537. CREATE TABLE public.resource_log (
  538. id integer NOT NULL,
  539. resource_id integer NOT NULL,
  540. operation text,
  541. user_id integer
  542. );
  543. ALTER TABLE public.resource_log OWNER TO postgres;
  544. --
  545. -- Name: resource_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  546. --
  547. CREATE SEQUENCE public.resource_log_id_seq
  548. AS integer
  549. START WITH 1
  550. INCREMENT BY 1
  551. NO MINVALUE
  552. NO MAXVALUE
  553. CACHE 1;
  554. ALTER TABLE public.resource_log_id_seq OWNER TO postgres;
  555. --
  556. -- Name: resource_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  557. --
  558. ALTER SEQUENCE public.resource_log_id_seq OWNED BY public.resource_log.id;
  559. --
  560. -- Name: service; Type: TABLE; Schema: public; Owner: postgres
  561. --
  562. CREATE TABLE public.service (
  563. id integer NOT NULL,
  564. servicetype_id integer NOT NULL,
  565. id_provider integer NOT NULL,
  566. resourse_id integer NOT NULL,
  567. price_alg character varying(255) NOT NULL,
  568. price_km money NOT NULL,
  569. price_min money NOT NULL,
  570. price_amount money NOT NULL,
  571. id_metaservice integer,
  572. is_global character(1) NOT NULL,
  573. is_visible character(1) NOT NULL,
  574. requirements name,
  575. status character(1) DEFAULT 'A'::bpchar,
  576. ticket_status integer
  577. );
  578. ALTER TABLE public.service OWNER TO postgres;
  579. --
  580. -- Name: service_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  581. --
  582. CREATE SEQUENCE public.service_id_seq
  583. AS integer
  584. START WITH 1
  585. INCREMENT BY 1
  586. NO MINVALUE
  587. NO MAXVALUE
  588. CACHE 1;
  589. ALTER TABLE public.service_id_seq OWNER TO postgres;
  590. --
  591. -- Name: service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  592. --
  593. ALTER SEQUENCE public.service_id_seq OWNED BY public.service.id;
  594. --
  595. -- Name: servicetype; Type: TABLE; Schema: public; Owner: postgres
  596. --
  597. CREATE TABLE public.servicetype (
  598. id integer NOT NULL,
  599. caption character varying(255) NOT NULL,
  600. description text NOT NULL,
  601. pricetype integer NOT NULL,
  602. id_metaservice integer,
  603. is_global character(1) NOT NULL,
  604. is_visible character(1) NOT NULL,
  605. requirements name,
  606. status character(1) DEFAULT 'A'::bpchar,
  607. ticket_status integer
  608. );
  609. ALTER TABLE public.servicetype OWNER TO postgres;
  610. --
  611. -- Name: servicetype_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  612. --
  613. CREATE SEQUENCE public.servicetype_id_seq
  614. AS integer
  615. START WITH 1
  616. INCREMENT BY 1
  617. NO MINVALUE
  618. NO MAXVALUE
  619. CACHE 1;
  620. ALTER TABLE public.servicetype_id_seq OWNER TO postgres;
  621. --
  622. -- Name: servicetype_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  623. --
  624. ALTER SEQUENCE public.servicetype_id_seq OWNED BY public.servicetype.id;
  625. --
  626. -- Name: tickets; Type: TABLE; Schema: public; Owner: postgres
  627. --
  628. CREATE TABLE public.tickets (
  629. id integer NOT NULL,
  630. id_reporter integer NOT NULL,
  631. id_asignee integer,
  632. time_created timestamp with time zone NOT NULL,
  633. time_assigned timestamp with time zone,
  634. time_changed timestamp with time zone,
  635. time_closed timestamp with time zone,
  636. status character(1) NOT NULL,
  637. description text
  638. );
  639. ALTER TABLE public.tickets OWNER TO postgres;
  640. --
  641. -- Name: tickets_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  642. --
  643. CREATE SEQUENCE public.tickets_id_seq
  644. AS integer
  645. START WITH 1
  646. INCREMENT BY 1
  647. NO MINVALUE
  648. NO MAXVALUE
  649. CACHE 1;
  650. ALTER TABLE public.tickets_id_seq OWNER TO postgres;
  651. --
  652. -- Name: tickets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  653. --
  654. ALTER SEQUENCE public.tickets_id_seq OWNED BY public.tickets.id;
  655. --
  656. -- Name: user_to_metaservice; Type: TABLE; Schema: public; Owner: postgres
  657. --
  658. CREATE TABLE public.user_to_metaservice (
  659. id integer NOT NULL,
  660. user_id integer NOT NULL,
  661. id_metaservice integer NOT NULL,
  662. is_active character(1) NOT NULL,
  663. status character(1) NOT NULL
  664. );
  665. ALTER TABLE public.user_to_metaservice OWNER TO postgres;
  666. --
  667. -- Name: user_to_metaservice_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  668. --
  669. CREATE SEQUENCE public.user_to_metaservice_id_seq
  670. AS integer
  671. START WITH 1
  672. INCREMENT BY 1
  673. NO MINVALUE
  674. NO MAXVALUE
  675. CACHE 1;
  676. ALTER TABLE public.user_to_metaservice_id_seq OWNER TO postgres;
  677. --
  678. -- Name: user_to_metaservice_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  679. --
  680. ALTER SEQUENCE public.user_to_metaservice_id_seq OWNED BY public.user_to_metaservice.id;
  681. --
  682. -- Name: cars_log id; Type: DEFAULT; Schema: public; Owner: postgres
  683. --
  684. ALTER TABLE ONLY public.cars_log ALTER COLUMN id SET DEFAULT nextval('public.cars_log_id_seq'::regclass);
  685. --
  686. -- Name: client id; Type: DEFAULT; Schema: public; Owner: postgres
  687. --
  688. ALTER TABLE ONLY public.client ALTER COLUMN id SET DEFAULT nextval('public.client_id_seq'::regclass);
  689. --
  690. -- Name: company id; Type: DEFAULT; Schema: public; Owner: postgres
  691. --
  692. ALTER TABLE ONLY public.company ALTER COLUMN id SET DEFAULT nextval('public.company_id_seq'::regclass);
  693. --
  694. -- Name: current_cars id; Type: DEFAULT; Schema: public; Owner: postgres
  695. --
  696. ALTER TABLE ONLY public.current_cars ALTER COLUMN id SET DEFAULT nextval('public.current_cars_id_seq'::regclass);
  697. --
  698. -- Name: current_orders id; Type: DEFAULT; Schema: public; Owner: postgres
  699. --
  700. ALTER TABLE ONLY public.current_orders ALTER COLUMN id SET DEFAULT nextval('public.current_orders_id_seq'::regclass);
  701. --
  702. -- Name: current_resources id; Type: DEFAULT; Schema: public; Owner: postgres
  703. --
  704. ALTER TABLE ONLY public.current_resources ALTER COLUMN id SET DEFAULT nextval('public.current_resources_id_seq'::regclass);
  705. --
  706. -- Name: current_timetable id; Type: DEFAULT; Schema: public; Owner: postgres
  707. --
  708. ALTER TABLE ONLY public.current_timetable ALTER COLUMN id SET DEFAULT nextval('public.current_timetable_id_seq'::regclass);
  709. --
  710. -- Name: document id; Type: DEFAULT; Schema: public; Owner: postgres
  711. --
  712. ALTER TABLE ONLY public.document ALTER COLUMN id SET DEFAULT nextval('public.document_id_seq'::regclass);
  713. --
  714. -- Name: metaservice id; Type: DEFAULT; Schema: public; Owner: postgres
  715. --
  716. ALTER TABLE ONLY public.metaservice ALTER COLUMN id SET DEFAULT nextval('public.metaservice_id_seq'::regclass);
  717. --
  718. -- Name: metauser id; Type: DEFAULT; Schema: public; Owner: postgres
  719. --
  720. ALTER TABLE ONLY public.metauser ALTER COLUMN id SET DEFAULT nextval('public.metauser_id_seq'::regclass);
  721. --
  722. -- Name: order_list_log id; Type: DEFAULT; Schema: public; Owner: postgres
  723. --
  724. ALTER TABLE ONLY public.order_list_log ALTER COLUMN id SET DEFAULT nextval('public.order_list_log_id_seq'::regclass);
  725. --
  726. -- Name: orders id; Type: DEFAULT; Schema: public; Owner: postgres
  727. --
  728. ALTER TABLE ONLY public.orders ALTER COLUMN id SET DEFAULT nextval('public.orders_id_seq'::regclass);
  729. --
  730. -- Name: permissions id; Type: DEFAULT; Schema: public; Owner: postgres
  731. --
  732. ALTER TABLE ONLY public.permissions ALTER COLUMN id SET DEFAULT nextval('public.permissions_id_seq'::regclass);
  733. --
  734. -- Name: provider id; Type: DEFAULT; Schema: public; Owner: postgres
  735. --
  736. ALTER TABLE ONLY public.provider ALTER COLUMN id SET DEFAULT nextval('public.provider_id_seq'::regclass);
  737. --
  738. -- Name: relationship id; Type: DEFAULT; Schema: public; Owner: postgres
  739. --
  740. ALTER TABLE ONLY public.relationship ALTER COLUMN id SET DEFAULT nextval('public.relationship_id_seq'::regclass);
  741. --
  742. -- Name: resource id; Type: DEFAULT; Schema: public; Owner: postgres
  743. --
  744. ALTER TABLE ONLY public.resource ALTER COLUMN id SET DEFAULT nextval('public.resource_id_seq'::regclass);
  745. --
  746. -- Name: resource_log id; Type: DEFAULT; Schema: public; Owner: postgres
  747. --
  748. ALTER TABLE ONLY public.resource_log ALTER COLUMN id SET DEFAULT nextval('public.resource_log_id_seq'::regclass);
  749. --
  750. -- Name: service id; Type: DEFAULT; Schema: public; Owner: postgres
  751. --
  752. ALTER TABLE ONLY public.service ALTER COLUMN id SET DEFAULT nextval('public.service_id_seq'::regclass);
  753. --
  754. -- Name: servicetype id; Type: DEFAULT; Schema: public; Owner: postgres
  755. --
  756. ALTER TABLE ONLY public.servicetype ALTER COLUMN id SET DEFAULT nextval('public.servicetype_id_seq'::regclass);
  757. --
  758. -- Name: tickets id; Type: DEFAULT; Schema: public; Owner: postgres
  759. --
  760. ALTER TABLE ONLY public.tickets ALTER COLUMN id SET DEFAULT nextval('public.tickets_id_seq'::regclass);
  761. --
  762. -- Name: user_to_metaservice id; Type: DEFAULT; Schema: public; Owner: postgres
  763. --
  764. ALTER TABLE ONLY public.user_to_metaservice ALTER COLUMN id SET DEFAULT nextval('public.user_to_metaservice_id_seq'::regclass);
  765. --
  766. -- Name: cars_log cars_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  767. --
  768. ALTER TABLE ONLY public.cars_log
  769. ADD CONSTRAINT cars_log_pkey PRIMARY KEY (id);
  770. --
  771. -- Name: client client_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  772. --
  773. ALTER TABLE ONLY public.client
  774. ADD CONSTRAINT client_pkey PRIMARY KEY (id);
  775. --
  776. -- Name: company company_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  777. --
  778. ALTER TABLE ONLY public.company
  779. ADD CONSTRAINT company_pkey PRIMARY KEY (id);
  780. --
  781. -- Name: current_cars current_cars_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  782. --
  783. ALTER TABLE ONLY public.current_cars
  784. ADD CONSTRAINT current_cars_pkey PRIMARY KEY (id);
  785. --
  786. -- Name: current_orders current_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  787. --
  788. ALTER TABLE ONLY public.current_orders
  789. ADD CONSTRAINT current_orders_pkey PRIMARY KEY (id);
  790. --
  791. -- Name: current_resources current_resources_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  792. --
  793. ALTER TABLE ONLY public.current_resources
  794. ADD CONSTRAINT current_resources_pkey PRIMARY KEY (id);
  795. --
  796. -- Name: current_timetable current_timetable_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  797. --
  798. ALTER TABLE ONLY public.current_timetable
  799. ADD CONSTRAINT current_timetable_pkey PRIMARY KEY (id);
  800. --
  801. -- Name: document document_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  802. --
  803. ALTER TABLE ONLY public.document
  804. ADD CONSTRAINT document_pkey PRIMARY KEY (id);
  805. --
  806. -- Name: metaservice metaservice_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  807. --
  808. ALTER TABLE ONLY public.metaservice
  809. ADD CONSTRAINT metaservice_pkey PRIMARY KEY (id);
  810. --
  811. -- Name: metauser metauser_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
  812. --
  813. ALTER TABLE ONLY public.metauser
  814. ADD CONSTRAINT metauser_email_key UNIQUE (email);
  815. --
  816. -- Name: metauser metauser_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  817. --
  818. ALTER TABLE ONLY public.metauser
  819. ADD CONSTRAINT metauser_pkey PRIMARY KEY (id);
  820. --
  821. -- Name: order_list_log order_list_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  822. --
  823. ALTER TABLE ONLY public.order_list_log
  824. ADD CONSTRAINT order_list_log_pkey PRIMARY KEY (id);
  825. --
  826. -- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  827. --
  828. ALTER TABLE ONLY public.orders
  829. ADD CONSTRAINT orders_pkey PRIMARY KEY (id);
  830. --
  831. -- Name: permissions permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  832. --
  833. ALTER TABLE ONLY public.permissions
  834. ADD CONSTRAINT permissions_pkey PRIMARY KEY (id);
  835. --
  836. -- Name: provider provider_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  837. --
  838. ALTER TABLE ONLY public.provider
  839. ADD CONSTRAINT provider_pkey PRIMARY KEY (id);
  840. --
  841. -- Name: relationship relationship_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  842. --
  843. ALTER TABLE ONLY public.relationship
  844. ADD CONSTRAINT relationship_pkey PRIMARY KEY (id);
  845. --
  846. -- Name: resource_log resource_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  847. --
  848. ALTER TABLE ONLY public.resource_log
  849. ADD CONSTRAINT resource_log_pkey PRIMARY KEY (id);
  850. --
  851. -- Name: resource resource_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  852. --
  853. ALTER TABLE ONLY public.resource
  854. ADD CONSTRAINT resource_pkey PRIMARY KEY (id);
  855. --
  856. -- Name: service service_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  857. --
  858. ALTER TABLE ONLY public.service
  859. ADD CONSTRAINT service_pkey PRIMARY KEY (id);
  860. --
  861. -- Name: servicetype servicetype_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  862. --
  863. ALTER TABLE ONLY public.servicetype
  864. ADD CONSTRAINT servicetype_pkey PRIMARY KEY (id);
  865. --
  866. -- Name: tickets tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  867. --
  868. ALTER TABLE ONLY public.tickets
  869. ADD CONSTRAINT tickets_pkey PRIMARY KEY (id);
  870. --
  871. -- Name: user_to_metaservice user_to_metaservice_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  872. --
  873. ALTER TABLE ONLY public.user_to_metaservice
  874. ADD CONSTRAINT user_to_metaservice_pkey PRIMARY KEY (id);
  875. --
  876. -- Name: client client_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  877. --
  878. ALTER TABLE ONLY public.client
  879. ADD CONSTRAINT client_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  880. --
  881. -- Name: client client_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  882. --
  883. ALTER TABLE ONLY public.client
  884. ADD CONSTRAINT client_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  885. --
  886. -- Name: client client_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  887. --
  888. ALTER TABLE ONLY public.client
  889. ADD CONSTRAINT client_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  890. --
  891. -- Name: company company_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  892. --
  893. ALTER TABLE ONLY public.company
  894. ADD CONSTRAINT company_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  895. --
  896. -- Name: company company_repr_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  897. --
  898. ALTER TABLE ONLY public.company
  899. ADD CONSTRAINT company_repr_id_fkey FOREIGN KEY (repr_id) REFERENCES public.metauser(id);
  900. --
  901. -- Name: company company_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  902. --
  903. ALTER TABLE ONLY public.company
  904. ADD CONSTRAINT company_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  905. --
  906. -- Name: current_orders current_orders_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  907. --
  908. ALTER TABLE ONLY public.current_orders
  909. ADD CONSTRAINT current_orders_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.client(id);
  910. --
  911. -- Name: current_orders current_orders_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  912. --
  913. ALTER TABLE ONLY public.current_orders
  914. ADD CONSTRAINT current_orders_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  915. --
  916. -- Name: current_orders current_orders_provider_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  917. --
  918. ALTER TABLE ONLY public.current_orders
  919. ADD CONSTRAINT current_orders_provider_id_fkey FOREIGN KEY (provider_id) REFERENCES public.provider(id);
  920. --
  921. -- Name: current_orders current_orders_receiver_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  922. --
  923. ALTER TABLE ONLY public.current_orders
  924. ADD CONSTRAINT current_orders_receiver_id_fkey FOREIGN KEY (receiver_id) REFERENCES public.metauser(id);
  925. --
  926. -- Name: current_orders current_orders_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  927. --
  928. ALTER TABLE ONLY public.current_orders
  929. ADD CONSTRAINT current_orders_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.service(id);
  930. --
  931. -- Name: current_orders current_orders_service_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  932. --
  933. ALTER TABLE ONLY public.current_orders
  934. ADD CONSTRAINT current_orders_service_type_id_fkey FOREIGN KEY (service_type_id) REFERENCES public.servicetype(id);
  935. --
  936. -- Name: current_resources current_resources_resource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  937. --
  938. ALTER TABLE ONLY public.current_resources
  939. ADD CONSTRAINT current_resources_resource_id_fkey FOREIGN KEY (resource_id) REFERENCES public.resource(id);
  940. --
  941. -- Name: current_resources current_resources_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  942. --
  943. ALTER TABLE ONLY public.current_resources
  944. ADD CONSTRAINT current_resources_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  945. --
  946. -- Name: current_timetable current_timetable_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  947. --
  948. ALTER TABLE ONLY public.current_timetable
  949. ADD CONSTRAINT current_timetable_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.current_orders(id);
  950. --
  951. -- Name: current_timetable current_timetable_provider_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  952. --
  953. ALTER TABLE ONLY public.current_timetable
  954. ADD CONSTRAINT current_timetable_provider_id_fkey FOREIGN KEY (provider_id) REFERENCES public.provider(id);
  955. --
  956. -- Name: current_timetable current_timetable_resource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  957. --
  958. ALTER TABLE ONLY public.current_timetable
  959. ADD CONSTRAINT current_timetable_resource_id_fkey FOREIGN KEY (resource_id) REFERENCES public.resource(id);
  960. --
  961. -- Name: current_timetable current_timetable_service_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  962. --
  963. ALTER TABLE ONLY public.current_timetable
  964. ADD CONSTRAINT current_timetable_service_type_id_fkey FOREIGN KEY (service_type_id) REFERENCES public.servicetype(id);
  965. --
  966. -- Name: document document_check_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  967. --
  968. ALTER TABLE ONLY public.document
  969. ADD CONSTRAINT document_check_by_fkey FOREIGN KEY (check_by) REFERENCES public.metauser(id);
  970. --
  971. -- Name: document document_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  972. --
  973. ALTER TABLE ONLY public.document
  974. ADD CONSTRAINT document_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.company(id);
  975. --
  976. -- Name: document document_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  977. --
  978. ALTER TABLE ONLY public.document
  979. ADD CONSTRAINT document_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  980. --
  981. -- Name: document document_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  982. --
  983. ALTER TABLE ONLY public.document
  984. ADD CONSTRAINT document_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  985. --
  986. -- Name: document document_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  987. --
  988. ALTER TABLE ONLY public.document
  989. ADD CONSTRAINT document_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  990. --
  991. -- Name: metaservice metaservice_representative_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  992. --
  993. ALTER TABLE ONLY public.metaservice
  994. ADD CONSTRAINT metaservice_representative_fkey FOREIGN KEY (representative) REFERENCES public.metauser(id);
  995. --
  996. -- Name: order_list_log order_list_log_client_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  997. --
  998. ALTER TABLE ONLY public.order_list_log
  999. ADD CONSTRAINT order_list_log_client_fkey FOREIGN KEY (client) REFERENCES public.client(id);
  1000. --
  1001. -- Name: order_list_log order_list_log_provider_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1002. --
  1003. ALTER TABLE ONLY public.order_list_log
  1004. ADD CONSTRAINT order_list_log_provider_fkey FOREIGN KEY (provider) REFERENCES public.provider(id);
  1005. --
  1006. -- Name: order_list_log order_list_log_receiver_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1007. --
  1008. ALTER TABLE ONLY public.order_list_log
  1009. ADD CONSTRAINT order_list_log_receiver_fkey FOREIGN KEY (receiver) REFERENCES public.metauser(id);
  1010. --
  1011. -- Name: order_list_log order_list_log_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1012. --
  1013. ALTER TABLE ONLY public.order_list_log
  1014. ADD CONSTRAINT order_list_log_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.service(id);
  1015. --
  1016. -- Name: order_list_log order_list_log_service_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1017. --
  1018. ALTER TABLE ONLY public.order_list_log
  1019. ADD CONSTRAINT order_list_log_service_type_id_fkey FOREIGN KEY (service_type_id) REFERENCES public.servicetype(id);
  1020. --
  1021. -- Name: permissions permissions_check_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1022. --
  1023. ALTER TABLE ONLY public.permissions
  1024. ADD CONSTRAINT permissions_check_by_fkey FOREIGN KEY (check_by) REFERENCES public.metauser(id);
  1025. --
  1026. -- Name: permissions permissions_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1027. --
  1028. ALTER TABLE ONLY public.permissions
  1029. ADD CONSTRAINT permissions_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1030. --
  1031. -- Name: permissions permissions_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1032. --
  1033. ALTER TABLE ONLY public.permissions
  1034. ADD CONSTRAINT permissions_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  1035. --
  1036. -- Name: permissions permissions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1037. --
  1038. ALTER TABLE ONLY public.permissions
  1039. ADD CONSTRAINT permissions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  1040. --
  1041. -- Name: provider provider_id_company_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1042. --
  1043. ALTER TABLE ONLY public.provider
  1044. ADD CONSTRAINT provider_id_company_fkey FOREIGN KEY (id_company) REFERENCES public.company(id);
  1045. --
  1046. -- Name: provider provider_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1047. --
  1048. ALTER TABLE ONLY public.provider
  1049. ADD CONSTRAINT provider_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1050. --
  1051. -- Name: provider provider_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1052. --
  1053. ALTER TABLE ONLY public.provider
  1054. ADD CONSTRAINT provider_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  1055. --
  1056. -- Name: provider provider_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1057. --
  1058. ALTER TABLE ONLY public.provider
  1059. ADD CONSTRAINT provider_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  1060. --
  1061. -- Name: relationship relationship_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1062. --
  1063. ALTER TABLE ONLY public.relationship
  1064. ADD CONSTRAINT relationship_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1065. --
  1066. -- Name: relationship relationship_user_id_who_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1067. --
  1068. ALTER TABLE ONLY public.relationship
  1069. ADD CONSTRAINT relationship_user_id_who_fkey FOREIGN KEY (user_id_who) REFERENCES public.metauser(id);
  1070. --
  1071. -- Name: relationship relationship_user_id_whom_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1072. --
  1073. ALTER TABLE ONLY public.relationship
  1074. ADD CONSTRAINT relationship_user_id_whom_fkey FOREIGN KEY (user_id_whom) REFERENCES public.metauser(id);
  1075. --
  1076. -- Name: resource resource_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1077. --
  1078. ALTER TABLE ONLY public.resource
  1079. ADD CONSTRAINT resource_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1080. --
  1081. -- Name: resource_log resource_log_resource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1082. --
  1083. ALTER TABLE ONLY public.resource_log
  1084. ADD CONSTRAINT resource_log_resource_id_fkey FOREIGN KEY (resource_id) REFERENCES public.resource(id);
  1085. --
  1086. -- Name: resource_log resource_log_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1087. --
  1088. ALTER TABLE ONLY public.resource_log
  1089. ADD CONSTRAINT resource_log_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  1090. --
  1091. -- Name: resource resource_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1092. --
  1093. ALTER TABLE ONLY public.resource
  1094. ADD CONSTRAINT resource_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  1095. --
  1096. -- Name: resource resource_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1097. --
  1098. ALTER TABLE ONLY public.resource
  1099. ADD CONSTRAINT resource_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  1100. --
  1101. -- Name: service service_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1102. --
  1103. ALTER TABLE ONLY public.service
  1104. ADD CONSTRAINT service_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1105. --
  1106. -- Name: service service_id_provider_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1107. --
  1108. ALTER TABLE ONLY public.service
  1109. ADD CONSTRAINT service_id_provider_fkey FOREIGN KEY (id_provider) REFERENCES public.provider(id);
  1110. --
  1111. -- Name: service service_resourse_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1112. --
  1113. ALTER TABLE ONLY public.service
  1114. ADD CONSTRAINT service_resourse_id_fkey FOREIGN KEY (resourse_id) REFERENCES public.resource(id);
  1115. --
  1116. -- Name: service service_servicetype_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1117. --
  1118. ALTER TABLE ONLY public.service
  1119. ADD CONSTRAINT service_servicetype_id_fkey FOREIGN KEY (servicetype_id) REFERENCES public.servicetype(id);
  1120. --
  1121. -- Name: service service_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1122. --
  1123. ALTER TABLE ONLY public.service
  1124. ADD CONSTRAINT service_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  1125. --
  1126. -- Name: servicetype servicetype_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1127. --
  1128. ALTER TABLE ONLY public.servicetype
  1129. ADD CONSTRAINT servicetype_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1130. --
  1131. -- Name: servicetype servicetype_ticket_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1132. --
  1133. ALTER TABLE ONLY public.servicetype
  1134. ADD CONSTRAINT servicetype_ticket_status_fkey FOREIGN KEY (ticket_status) REFERENCES public.tickets(id);
  1135. --
  1136. -- Name: tickets tickets_id_asignee_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1137. --
  1138. ALTER TABLE ONLY public.tickets
  1139. ADD CONSTRAINT tickets_id_asignee_fkey FOREIGN KEY (id_asignee) REFERENCES public.metauser(id);
  1140. --
  1141. -- Name: tickets tickets_id_reporter_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1142. --
  1143. ALTER TABLE ONLY public.tickets
  1144. ADD CONSTRAINT tickets_id_reporter_fkey FOREIGN KEY (id_reporter) REFERENCES public.metauser(id);
  1145. --
  1146. -- Name: user_to_metaservice user_to_metaservice_id_metaservice_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1147. --
  1148. ALTER TABLE ONLY public.user_to_metaservice
  1149. ADD CONSTRAINT user_to_metaservice_id_metaservice_fkey FOREIGN KEY (id_metaservice) REFERENCES public.metaservice(id);
  1150. --
  1151. -- Name: user_to_metaservice user_to_metaservice_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  1152. --
  1153. ALTER TABLE ONLY public.user_to_metaservice
  1154. ADD CONSTRAINT user_to_metaservice_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.metauser(id);
  1155. --
  1156. -- PostgreSQL database dump complete
  1157. --