1SET statement_timeout = 0; 2SET lock_timeout = 0; 3SET client_encoding = 'UTF8'; 4SET standard_conforming_strings = on; 5SELECT pg_catalog.set_config('search_path', '', false); 6SET check_function_bodies = false; 7SET xmloption = content; 8SET client_min_messages = warning; 9SET row_security = off; 10 11-- 12-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - 13-- 14 15CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; 16 17 18-- 19-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - 20-- 21 22COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; 23 24 25-- 26-- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: - 27-- 28 29CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public; 30 31 32-- 33-- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: - 34-- 35 36COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST'; 37 38 39-- 40-- Name: format_enum; Type: TYPE; Schema: public; Owner: - 41-- 42 43CREATE TYPE public.format_enum AS ENUM ( 44 'html', 45 'markdown', 46 'text' 47); 48 49 50-- 51-- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: - 52-- 53 54CREATE TYPE public.gpx_visibility_enum AS ENUM ( 55 'private', 56 'public', 57 'trackable', 58 'identifiable' 59); 60 61 62-- 63-- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: - 64-- 65 66CREATE TYPE public.issue_status_enum AS ENUM ( 67 'open', 68 'ignored', 69 'resolved' 70); 71 72 73-- 74-- Name: note_event_enum; Type: TYPE; Schema: public; Owner: - 75-- 76 77CREATE TYPE public.note_event_enum AS ENUM ( 78 'opened', 79 'closed', 80 'reopened', 81 'commented', 82 'hidden' 83); 84 85 86-- 87-- Name: note_status_enum; Type: TYPE; Schema: public; Owner: - 88-- 89 90CREATE TYPE public.note_status_enum AS ENUM ( 91 'open', 92 'closed', 93 'hidden' 94); 95 96 97-- 98-- Name: nwr_enum; Type: TYPE; Schema: public; Owner: - 99-- 100 101CREATE TYPE public.nwr_enum AS ENUM ( 102 'Node', 103 'Way', 104 'Relation' 105); 106 107 108-- 109-- Name: user_role_enum; Type: TYPE; Schema: public; Owner: - 110-- 111 112CREATE TYPE public.user_role_enum AS ENUM ( 113 'administrator', 114 'moderator' 115); 116 117 118-- 119-- Name: user_status_enum; Type: TYPE; Schema: public; Owner: - 120-- 121 122CREATE TYPE public.user_status_enum AS ENUM ( 123 'pending', 124 'active', 125 'confirmed', 126 'suspended', 127 'deleted' 128); 129 130 131-- 132-- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: - 133-- 134 135CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer 136 LANGUAGE plpgsql IMMUTABLE 137 AS $$ 138DECLARE 139 lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0; 140 lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0; 141 zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom; 142 pi CONSTANT DOUBLE PRECISION := 3.141592653589793; 143 r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0; 144 x int4; 145 y int4; 146BEGIN 147 -- straight port of the C code. see db/functions/maptile.c 148 x := floor((lon + 180.0) * zscale / 360.0); 149 y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0); 150 151 RETURN (x << zoom) | y; 152END; 153$$; 154 155 156-- 157-- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: - 158-- 159 160CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint 161 LANGUAGE plpgsql IMMUTABLE 162 AS $$ 163DECLARE 164 x int8; -- quantized x from lon, 165 y int8; -- quantized y from lat, 166BEGIN 167 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0); 168 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0); 169 170 -- these bit-masks are special numbers used in the bit interleaving algorithm. 171 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN 172 -- for the original algorithm and more details. 173 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF 174 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F 175 x := (x | (x << 2)) & 858993459; -- 0x33333333 176 x := (x | (x << 1)) & 1431655765; -- 0x55555555 177 178 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF 179 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F 180 y := (y | (y << 2)) & 858993459; -- 0x33333333 181 y := (y | (y << 1)) & 1431655765; -- 0x55555555 182 183 RETURN (x << 1) | y; 184END; 185$$; 186 187 188-- 189-- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: - 190-- 191 192CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer 193 LANGUAGE plpgsql STRICT 194 AS $$ 195DECLARE 196 tl bigint; 197 ti int; 198BEGIN 199 tl := t; 200 201 IF tl >= 2147483648 THEN 202 tl := tl - 4294967296; 203 END IF; 204 205 ti := tl; 206 207 RETURN ti; 208END; 209$$; 210 211 212SET default_tablespace = ''; 213 214SET default_with_oids = false; 215 216-- 217-- Name: acls; Type: TABLE; Schema: public; Owner: - 218-- 219 220CREATE TABLE public.acls ( 221 id bigint NOT NULL, 222 address inet, 223 k character varying NOT NULL, 224 v character varying, 225 domain character varying, 226 mx character varying 227); 228 229 230-- 231-- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: - 232-- 233 234CREATE SEQUENCE public.acls_id_seq 235 START WITH 1 236 INCREMENT BY 1 237 NO MINVALUE 238 NO MAXVALUE 239 CACHE 1; 240 241 242-- 243-- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 244-- 245 246ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id; 247 248 249-- 250-- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: - 251-- 252 253CREATE TABLE public.active_storage_attachments ( 254 id bigint NOT NULL, 255 name character varying NOT NULL, 256 record_type character varying NOT NULL, 257 record_id bigint NOT NULL, 258 blob_id bigint NOT NULL, 259 created_at timestamp without time zone NOT NULL 260); 261 262 263-- 264-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: - 265-- 266 267CREATE SEQUENCE public.active_storage_attachments_id_seq 268 START WITH 1 269 INCREMENT BY 1 270 NO MINVALUE 271 NO MAXVALUE 272 CACHE 1; 273 274 275-- 276-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 277-- 278 279ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id; 280 281 282-- 283-- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: - 284-- 285 286CREATE TABLE public.active_storage_blobs ( 287 id bigint NOT NULL, 288 key character varying NOT NULL, 289 filename character varying NOT NULL, 290 content_type character varying, 291 metadata text, 292 byte_size bigint NOT NULL, 293 checksum character varying NOT NULL, 294 created_at timestamp without time zone NOT NULL 295); 296 297 298-- 299-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - 300-- 301 302CREATE SEQUENCE public.active_storage_blobs_id_seq 303 START WITH 1 304 INCREMENT BY 1 305 NO MINVALUE 306 NO MAXVALUE 307 CACHE 1; 308 309 310-- 311-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 312-- 313 314ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id; 315 316 317-- 318-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - 319-- 320 321CREATE TABLE public.ar_internal_metadata ( 322 key character varying NOT NULL, 323 value character varying, 324 created_at timestamp(6) without time zone NOT NULL, 325 updated_at timestamp(6) without time zone NOT NULL 326); 327 328 329-- 330-- Name: changeset_comments; Type: TABLE; Schema: public; Owner: - 331-- 332 333CREATE TABLE public.changeset_comments ( 334 id integer NOT NULL, 335 changeset_id bigint NOT NULL, 336 author_id bigint NOT NULL, 337 body text NOT NULL, 338 created_at timestamp without time zone NOT NULL, 339 visible boolean NOT NULL 340); 341 342 343-- 344-- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - 345-- 346 347CREATE SEQUENCE public.changeset_comments_id_seq 348 START WITH 1 349 INCREMENT BY 1 350 NO MINVALUE 351 NO MAXVALUE 352 CACHE 1; 353 354 355-- 356-- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 357-- 358 359ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id; 360 361 362-- 363-- Name: changeset_tags; Type: TABLE; Schema: public; Owner: - 364-- 365 366CREATE TABLE public.changeset_tags ( 367 changeset_id bigint NOT NULL, 368 k character varying DEFAULT ''::character varying NOT NULL, 369 v character varying DEFAULT ''::character varying NOT NULL 370); 371 372 373-- 374-- Name: changesets; Type: TABLE; Schema: public; Owner: - 375-- 376 377CREATE TABLE public.changesets ( 378 id bigint NOT NULL, 379 user_id bigint NOT NULL, 380 created_at timestamp without time zone NOT NULL, 381 min_lat integer, 382 max_lat integer, 383 min_lon integer, 384 max_lon integer, 385 closed_at timestamp without time zone NOT NULL, 386 num_changes integer DEFAULT 0 NOT NULL 387); 388 389 390-- 391-- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: - 392-- 393 394CREATE SEQUENCE public.changesets_id_seq 395 START WITH 1 396 INCREMENT BY 1 397 NO MINVALUE 398 NO MAXVALUE 399 CACHE 1; 400 401 402-- 403-- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 404-- 405 406ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id; 407 408 409-- 410-- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: - 411-- 412 413CREATE TABLE public.changesets_subscribers ( 414 subscriber_id bigint NOT NULL, 415 changeset_id bigint NOT NULL 416); 417 418 419-- 420-- Name: client_applications; Type: TABLE; Schema: public; Owner: - 421-- 422 423CREATE TABLE public.client_applications ( 424 id integer NOT NULL, 425 name character varying, 426 url character varying, 427 support_url character varying, 428 callback_url character varying, 429 key character varying(50), 430 secret character varying(50), 431 user_id integer, 432 created_at timestamp without time zone, 433 updated_at timestamp without time zone, 434 allow_read_prefs boolean DEFAULT false NOT NULL, 435 allow_write_prefs boolean DEFAULT false NOT NULL, 436 allow_write_diary boolean DEFAULT false NOT NULL, 437 allow_write_api boolean DEFAULT false NOT NULL, 438 allow_read_gpx boolean DEFAULT false NOT NULL, 439 allow_write_gpx boolean DEFAULT false NOT NULL, 440 allow_write_notes boolean DEFAULT false NOT NULL 441); 442 443 444-- 445-- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: - 446-- 447 448CREATE SEQUENCE public.client_applications_id_seq 449 START WITH 1 450 INCREMENT BY 1 451 NO MINVALUE 452 NO MAXVALUE 453 CACHE 1; 454 455 456-- 457-- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 458-- 459 460ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id; 461 462 463-- 464-- Name: current_node_tags; Type: TABLE; Schema: public; Owner: - 465-- 466 467CREATE TABLE public.current_node_tags ( 468 node_id bigint NOT NULL, 469 k character varying DEFAULT ''::character varying NOT NULL, 470 v character varying DEFAULT ''::character varying NOT NULL 471); 472 473 474-- 475-- Name: current_nodes; Type: TABLE; Schema: public; Owner: - 476-- 477 478CREATE TABLE public.current_nodes ( 479 id bigint NOT NULL, 480 latitude integer NOT NULL, 481 longitude integer NOT NULL, 482 changeset_id bigint NOT NULL, 483 visible boolean NOT NULL, 484 "timestamp" timestamp without time zone NOT NULL, 485 tile bigint NOT NULL, 486 version bigint NOT NULL 487); 488 489 490-- 491-- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: - 492-- 493 494CREATE SEQUENCE public.current_nodes_id_seq 495 START WITH 1 496 INCREMENT BY 1 497 NO MINVALUE 498 NO MAXVALUE 499 CACHE 1; 500 501 502-- 503-- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 504-- 505 506ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id; 507 508 509-- 510-- Name: current_relation_members; Type: TABLE; Schema: public; Owner: - 511-- 512 513CREATE TABLE public.current_relation_members ( 514 relation_id bigint NOT NULL, 515 member_type public.nwr_enum NOT NULL, 516 member_id bigint NOT NULL, 517 member_role character varying NOT NULL, 518 sequence_id integer DEFAULT 0 NOT NULL 519); 520 521 522-- 523-- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: - 524-- 525 526CREATE TABLE public.current_relation_tags ( 527 relation_id bigint NOT NULL, 528 k character varying DEFAULT ''::character varying NOT NULL, 529 v character varying DEFAULT ''::character varying NOT NULL 530); 531 532 533-- 534-- Name: current_relations; Type: TABLE; Schema: public; Owner: - 535-- 536 537CREATE TABLE public.current_relations ( 538 id bigint NOT NULL, 539 changeset_id bigint NOT NULL, 540 "timestamp" timestamp without time zone NOT NULL, 541 visible boolean NOT NULL, 542 version bigint NOT NULL 543); 544 545 546-- 547-- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: - 548-- 549 550CREATE SEQUENCE public.current_relations_id_seq 551 START WITH 1 552 INCREMENT BY 1 553 NO MINVALUE 554 NO MAXVALUE 555 CACHE 1; 556 557 558-- 559-- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 560-- 561 562ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id; 563 564 565-- 566-- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: - 567-- 568 569CREATE TABLE public.current_way_nodes ( 570 way_id bigint NOT NULL, 571 node_id bigint NOT NULL, 572 sequence_id bigint NOT NULL 573); 574 575 576-- 577-- Name: current_way_tags; Type: TABLE; Schema: public; Owner: - 578-- 579 580CREATE TABLE public.current_way_tags ( 581 way_id bigint NOT NULL, 582 k character varying DEFAULT ''::character varying NOT NULL, 583 v character varying DEFAULT ''::character varying NOT NULL 584); 585 586 587-- 588-- Name: current_ways; Type: TABLE; Schema: public; Owner: - 589-- 590 591CREATE TABLE public.current_ways ( 592 id bigint NOT NULL, 593 changeset_id bigint NOT NULL, 594 "timestamp" timestamp without time zone NOT NULL, 595 visible boolean NOT NULL, 596 version bigint NOT NULL 597); 598 599 600-- 601-- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: - 602-- 603 604CREATE SEQUENCE public.current_ways_id_seq 605 START WITH 1 606 INCREMENT BY 1 607 NO MINVALUE 608 NO MAXVALUE 609 CACHE 1; 610 611 612-- 613-- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 614-- 615 616ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id; 617 618 619-- 620-- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: - 621-- 622 623CREATE TABLE public.delayed_jobs ( 624 id bigint NOT NULL, 625 priority integer DEFAULT 0 NOT NULL, 626 attempts integer DEFAULT 0 NOT NULL, 627 handler text NOT NULL, 628 last_error text, 629 run_at timestamp without time zone, 630 locked_at timestamp without time zone, 631 failed_at timestamp without time zone, 632 locked_by character varying, 633 queue character varying, 634 created_at timestamp without time zone, 635 updated_at timestamp without time zone 636); 637 638 639-- 640-- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - 641-- 642 643CREATE SEQUENCE public.delayed_jobs_id_seq 644 START WITH 1 645 INCREMENT BY 1 646 NO MINVALUE 647 NO MAXVALUE 648 CACHE 1; 649 650 651-- 652-- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 653-- 654 655ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id; 656 657 658-- 659-- Name: diary_comments; Type: TABLE; Schema: public; Owner: - 660-- 661 662CREATE TABLE public.diary_comments ( 663 id bigint NOT NULL, 664 diary_entry_id bigint NOT NULL, 665 user_id bigint NOT NULL, 666 body text NOT NULL, 667 created_at timestamp without time zone NOT NULL, 668 updated_at timestamp without time zone NOT NULL, 669 visible boolean DEFAULT true NOT NULL, 670 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL 671); 672 673 674-- 675-- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - 676-- 677 678CREATE SEQUENCE public.diary_comments_id_seq 679 START WITH 1 680 INCREMENT BY 1 681 NO MINVALUE 682 NO MAXVALUE 683 CACHE 1; 684 685 686-- 687-- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 688-- 689 690ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id; 691 692 693-- 694-- Name: diary_entries; Type: TABLE; Schema: public; Owner: - 695-- 696 697CREATE TABLE public.diary_entries ( 698 id bigint NOT NULL, 699 user_id bigint NOT NULL, 700 title character varying NOT NULL, 701 body text NOT NULL, 702 created_at timestamp without time zone NOT NULL, 703 updated_at timestamp without time zone NOT NULL, 704 latitude double precision, 705 longitude double precision, 706 language_code character varying DEFAULT 'en'::character varying NOT NULL, 707 visible boolean DEFAULT true NOT NULL, 708 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL 709); 710 711 712-- 713-- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: - 714-- 715 716CREATE SEQUENCE public.diary_entries_id_seq 717 START WITH 1 718 INCREMENT BY 1 719 NO MINVALUE 720 NO MAXVALUE 721 CACHE 1; 722 723 724-- 725-- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 726-- 727 728ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id; 729 730 731-- 732-- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: - 733-- 734 735CREATE TABLE public.diary_entry_subscriptions ( 736 user_id bigint NOT NULL, 737 diary_entry_id bigint NOT NULL 738); 739 740 741-- 742-- Name: friends; Type: TABLE; Schema: public; Owner: - 743-- 744 745CREATE TABLE public.friends ( 746 id bigint NOT NULL, 747 user_id bigint NOT NULL, 748 friend_user_id bigint NOT NULL 749); 750 751 752-- 753-- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: - 754-- 755 756CREATE SEQUENCE public.friends_id_seq 757 START WITH 1 758 INCREMENT BY 1 759 NO MINVALUE 760 NO MAXVALUE 761 CACHE 1; 762 763 764-- 765-- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 766-- 767 768ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id; 769 770 771-- 772-- Name: gps_points; Type: TABLE; Schema: public; Owner: - 773-- 774 775CREATE TABLE public.gps_points ( 776 altitude double precision, 777 trackid integer NOT NULL, 778 latitude integer NOT NULL, 779 longitude integer NOT NULL, 780 gpx_id bigint NOT NULL, 781 "timestamp" timestamp without time zone, 782 tile bigint 783); 784 785 786-- 787-- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: - 788-- 789 790CREATE TABLE public.gpx_file_tags ( 791 gpx_id bigint DEFAULT 0 NOT NULL, 792 tag character varying NOT NULL, 793 id bigint NOT NULL 794); 795 796 797-- 798-- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - 799-- 800 801CREATE SEQUENCE public.gpx_file_tags_id_seq 802 START WITH 1 803 INCREMENT BY 1 804 NO MINVALUE 805 NO MAXVALUE 806 CACHE 1; 807 808 809-- 810-- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 811-- 812 813ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id; 814 815 816-- 817-- Name: gpx_files; Type: TABLE; Schema: public; Owner: - 818-- 819 820CREATE TABLE public.gpx_files ( 821 id bigint NOT NULL, 822 user_id bigint NOT NULL, 823 visible boolean DEFAULT true NOT NULL, 824 name character varying DEFAULT ''::character varying NOT NULL, 825 size bigint, 826 latitude double precision, 827 longitude double precision, 828 "timestamp" timestamp without time zone NOT NULL, 829 description character varying DEFAULT ''::character varying NOT NULL, 830 inserted boolean NOT NULL, 831 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL 832); 833 834 835-- 836-- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: - 837-- 838 839CREATE SEQUENCE public.gpx_files_id_seq 840 START WITH 1 841 INCREMENT BY 1 842 NO MINVALUE 843 NO MAXVALUE 844 CACHE 1; 845 846 847-- 848-- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 849-- 850 851ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id; 852 853 854-- 855-- Name: issue_comments; Type: TABLE; Schema: public; Owner: - 856-- 857 858CREATE TABLE public.issue_comments ( 859 id integer NOT NULL, 860 issue_id integer NOT NULL, 861 user_id integer NOT NULL, 862 body text NOT NULL, 863 created_at timestamp without time zone NOT NULL, 864 updated_at timestamp without time zone NOT NULL 865); 866 867 868-- 869-- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - 870-- 871 872CREATE SEQUENCE public.issue_comments_id_seq 873 START WITH 1 874 INCREMENT BY 1 875 NO MINVALUE 876 NO MAXVALUE 877 CACHE 1; 878 879 880-- 881-- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 882-- 883 884ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id; 885 886 887-- 888-- Name: issues; Type: TABLE; Schema: public; Owner: - 889-- 890 891CREATE TABLE public.issues ( 892 id integer NOT NULL, 893 reportable_type character varying NOT NULL, 894 reportable_id integer NOT NULL, 895 reported_user_id integer, 896 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL, 897 assigned_role public.user_role_enum NOT NULL, 898 resolved_at timestamp without time zone, 899 resolved_by integer, 900 updated_by integer, 901 reports_count integer DEFAULT 0, 902 created_at timestamp without time zone NOT NULL, 903 updated_at timestamp without time zone NOT NULL 904); 905 906 907-- 908-- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: - 909-- 910 911CREATE SEQUENCE public.issues_id_seq 912 START WITH 1 913 INCREMENT BY 1 914 NO MINVALUE 915 NO MAXVALUE 916 CACHE 1; 917 918 919-- 920-- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 921-- 922 923ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id; 924 925 926-- 927-- Name: languages; Type: TABLE; Schema: public; Owner: - 928-- 929 930CREATE TABLE public.languages ( 931 code character varying NOT NULL, 932 english_name character varying NOT NULL, 933 native_name character varying 934); 935 936 937-- 938-- Name: messages; Type: TABLE; Schema: public; Owner: - 939-- 940 941CREATE TABLE public.messages ( 942 id bigint NOT NULL, 943 from_user_id bigint NOT NULL, 944 title character varying NOT NULL, 945 body text NOT NULL, 946 sent_on timestamp without time zone NOT NULL, 947 message_read boolean DEFAULT false NOT NULL, 948 to_user_id bigint NOT NULL, 949 to_user_visible boolean DEFAULT true NOT NULL, 950 from_user_visible boolean DEFAULT true NOT NULL, 951 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL 952); 953 954 955-- 956-- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: - 957-- 958 959CREATE SEQUENCE public.messages_id_seq 960 START WITH 1 961 INCREMENT BY 1 962 NO MINVALUE 963 NO MAXVALUE 964 CACHE 1; 965 966 967-- 968-- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 969-- 970 971ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id; 972 973 974-- 975-- Name: node_tags; Type: TABLE; Schema: public; Owner: - 976-- 977 978CREATE TABLE public.node_tags ( 979 node_id bigint NOT NULL, 980 version bigint NOT NULL, 981 k character varying DEFAULT ''::character varying NOT NULL, 982 v character varying DEFAULT ''::character varying NOT NULL 983); 984 985 986-- 987-- Name: nodes; Type: TABLE; Schema: public; Owner: - 988-- 989 990CREATE TABLE public.nodes ( 991 node_id bigint NOT NULL, 992 latitude integer NOT NULL, 993 longitude integer NOT NULL, 994 changeset_id bigint NOT NULL, 995 visible boolean NOT NULL, 996 "timestamp" timestamp without time zone NOT NULL, 997 tile bigint NOT NULL, 998 version bigint NOT NULL, 999 redaction_id integer 1000); 1001 1002 1003-- 1004-- Name: note_comments; Type: TABLE; Schema: public; Owner: - 1005-- 1006 1007CREATE TABLE public.note_comments ( 1008 id bigint NOT NULL, 1009 note_id bigint NOT NULL, 1010 visible boolean NOT NULL, 1011 created_at timestamp without time zone NOT NULL, 1012 author_ip inet, 1013 author_id bigint, 1014 body text, 1015 event public.note_event_enum 1016); 1017 1018 1019-- 1020-- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1021-- 1022 1023CREATE SEQUENCE public.note_comments_id_seq 1024 START WITH 1 1025 INCREMENT BY 1 1026 NO MINVALUE 1027 NO MAXVALUE 1028 CACHE 1; 1029 1030 1031-- 1032-- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1033-- 1034 1035ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id; 1036 1037 1038-- 1039-- Name: notes; Type: TABLE; Schema: public; Owner: - 1040-- 1041 1042CREATE TABLE public.notes ( 1043 id bigint NOT NULL, 1044 latitude integer NOT NULL, 1045 longitude integer NOT NULL, 1046 tile bigint NOT NULL, 1047 updated_at timestamp without time zone NOT NULL, 1048 created_at timestamp without time zone NOT NULL, 1049 status public.note_status_enum NOT NULL, 1050 closed_at timestamp without time zone 1051); 1052 1053 1054-- 1055-- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1056-- 1057 1058CREATE SEQUENCE public.notes_id_seq 1059 START WITH 1 1060 INCREMENT BY 1 1061 NO MINVALUE 1062 NO MAXVALUE 1063 CACHE 1; 1064 1065 1066-- 1067-- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1068-- 1069 1070ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id; 1071 1072 1073-- 1074-- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: - 1075-- 1076 1077CREATE TABLE public.oauth_nonces ( 1078 id integer NOT NULL, 1079 nonce character varying, 1080 "timestamp" integer, 1081 created_at timestamp without time zone, 1082 updated_at timestamp without time zone 1083); 1084 1085 1086-- 1087-- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1088-- 1089 1090CREATE SEQUENCE public.oauth_nonces_id_seq 1091 START WITH 1 1092 INCREMENT BY 1 1093 NO MINVALUE 1094 NO MAXVALUE 1095 CACHE 1; 1096 1097 1098-- 1099-- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1100-- 1101 1102ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id; 1103 1104 1105-- 1106-- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: - 1107-- 1108 1109CREATE TABLE public.oauth_tokens ( 1110 id integer NOT NULL, 1111 user_id integer, 1112 type character varying(20), 1113 client_application_id integer, 1114 token character varying(50), 1115 secret character varying(50), 1116 authorized_at timestamp without time zone, 1117 invalidated_at timestamp without time zone, 1118 created_at timestamp without time zone, 1119 updated_at timestamp without time zone, 1120 allow_read_prefs boolean DEFAULT false NOT NULL, 1121 allow_write_prefs boolean DEFAULT false NOT NULL, 1122 allow_write_diary boolean DEFAULT false NOT NULL, 1123 allow_write_api boolean DEFAULT false NOT NULL, 1124 allow_read_gpx boolean DEFAULT false NOT NULL, 1125 allow_write_gpx boolean DEFAULT false NOT NULL, 1126 callback_url character varying, 1127 verifier character varying(20), 1128 scope character varying, 1129 valid_to timestamp without time zone, 1130 allow_write_notes boolean DEFAULT false NOT NULL 1131); 1132 1133 1134-- 1135-- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1136-- 1137 1138CREATE SEQUENCE public.oauth_tokens_id_seq 1139 START WITH 1 1140 INCREMENT BY 1 1141 NO MINVALUE 1142 NO MAXVALUE 1143 CACHE 1; 1144 1145 1146-- 1147-- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1148-- 1149 1150ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id; 1151 1152 1153-- 1154-- Name: redactions; Type: TABLE; Schema: public; Owner: - 1155-- 1156 1157CREATE TABLE public.redactions ( 1158 id integer NOT NULL, 1159 title character varying, 1160 description text, 1161 created_at timestamp without time zone, 1162 updated_at timestamp without time zone, 1163 user_id bigint NOT NULL, 1164 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL 1165); 1166 1167 1168-- 1169-- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1170-- 1171 1172CREATE SEQUENCE public.redactions_id_seq 1173 START WITH 1 1174 INCREMENT BY 1 1175 NO MINVALUE 1176 NO MAXVALUE 1177 CACHE 1; 1178 1179 1180-- 1181-- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1182-- 1183 1184ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id; 1185 1186 1187-- 1188-- Name: relation_members; Type: TABLE; Schema: public; Owner: - 1189-- 1190 1191CREATE TABLE public.relation_members ( 1192 relation_id bigint DEFAULT 0 NOT NULL, 1193 member_type public.nwr_enum NOT NULL, 1194 member_id bigint NOT NULL, 1195 member_role character varying NOT NULL, 1196 version bigint DEFAULT 0 NOT NULL, 1197 sequence_id integer DEFAULT 0 NOT NULL 1198); 1199 1200 1201-- 1202-- Name: relation_tags; Type: TABLE; Schema: public; Owner: - 1203-- 1204 1205CREATE TABLE public.relation_tags ( 1206 relation_id bigint DEFAULT 0 NOT NULL, 1207 k character varying DEFAULT ''::character varying NOT NULL, 1208 v character varying DEFAULT ''::character varying NOT NULL, 1209 version bigint NOT NULL 1210); 1211 1212 1213-- 1214-- Name: relations; Type: TABLE; Schema: public; Owner: - 1215-- 1216 1217CREATE TABLE public.relations ( 1218 relation_id bigint DEFAULT 0 NOT NULL, 1219 changeset_id bigint NOT NULL, 1220 "timestamp" timestamp without time zone NOT NULL, 1221 version bigint NOT NULL, 1222 visible boolean DEFAULT true NOT NULL, 1223 redaction_id integer 1224); 1225 1226 1227-- 1228-- Name: reports; Type: TABLE; Schema: public; Owner: - 1229-- 1230 1231CREATE TABLE public.reports ( 1232 id integer NOT NULL, 1233 issue_id integer NOT NULL, 1234 user_id integer NOT NULL, 1235 details text NOT NULL, 1236 category character varying NOT NULL, 1237 created_at timestamp without time zone NOT NULL, 1238 updated_at timestamp without time zone NOT NULL 1239); 1240 1241 1242-- 1243-- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1244-- 1245 1246CREATE SEQUENCE public.reports_id_seq 1247 START WITH 1 1248 INCREMENT BY 1 1249 NO MINVALUE 1250 NO MAXVALUE 1251 CACHE 1; 1252 1253 1254-- 1255-- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1256-- 1257 1258ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id; 1259 1260 1261-- 1262-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - 1263-- 1264 1265CREATE TABLE public.schema_migrations ( 1266 version character varying NOT NULL 1267); 1268 1269 1270-- 1271-- Name: user_blocks; Type: TABLE; Schema: public; Owner: - 1272-- 1273 1274CREATE TABLE public.user_blocks ( 1275 id integer NOT NULL, 1276 user_id bigint NOT NULL, 1277 creator_id bigint NOT NULL, 1278 reason text NOT NULL, 1279 ends_at timestamp without time zone NOT NULL, 1280 needs_view boolean DEFAULT false NOT NULL, 1281 revoker_id bigint, 1282 created_at timestamp without time zone, 1283 updated_at timestamp without time zone, 1284 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL 1285); 1286 1287 1288-- 1289-- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1290-- 1291 1292CREATE SEQUENCE public.user_blocks_id_seq 1293 START WITH 1 1294 INCREMENT BY 1 1295 NO MINVALUE 1296 NO MAXVALUE 1297 CACHE 1; 1298 1299 1300-- 1301-- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1302-- 1303 1304ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id; 1305 1306 1307-- 1308-- Name: user_preferences; Type: TABLE; Schema: public; Owner: - 1309-- 1310 1311CREATE TABLE public.user_preferences ( 1312 user_id bigint NOT NULL, 1313 k character varying NOT NULL, 1314 v character varying NOT NULL 1315); 1316 1317 1318-- 1319-- Name: user_roles; Type: TABLE; Schema: public; Owner: - 1320-- 1321 1322CREATE TABLE public.user_roles ( 1323 id integer NOT NULL, 1324 user_id bigint NOT NULL, 1325 role public.user_role_enum NOT NULL, 1326 created_at timestamp without time zone, 1327 updated_at timestamp without time zone, 1328 granter_id bigint NOT NULL 1329); 1330 1331 1332-- 1333-- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1334-- 1335 1336CREATE SEQUENCE public.user_roles_id_seq 1337 START WITH 1 1338 INCREMENT BY 1 1339 NO MINVALUE 1340 NO MAXVALUE 1341 CACHE 1; 1342 1343 1344-- 1345-- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1346-- 1347 1348ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id; 1349 1350 1351-- 1352-- Name: user_tokens; Type: TABLE; Schema: public; Owner: - 1353-- 1354 1355CREATE TABLE public.user_tokens ( 1356 id bigint NOT NULL, 1357 user_id bigint NOT NULL, 1358 token character varying NOT NULL, 1359 expiry timestamp without time zone NOT NULL, 1360 referer text 1361); 1362 1363 1364-- 1365-- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1366-- 1367 1368CREATE SEQUENCE public.user_tokens_id_seq 1369 START WITH 1 1370 INCREMENT BY 1 1371 NO MINVALUE 1372 NO MAXVALUE 1373 CACHE 1; 1374 1375 1376-- 1377-- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1378-- 1379 1380ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id; 1381 1382 1383-- 1384-- Name: users; Type: TABLE; Schema: public; Owner: - 1385-- 1386 1387CREATE TABLE public.users ( 1388 email character varying NOT NULL, 1389 id bigint NOT NULL, 1390 pass_crypt character varying NOT NULL, 1391 creation_time timestamp without time zone NOT NULL, 1392 display_name character varying DEFAULT ''::character varying NOT NULL, 1393 data_public boolean DEFAULT false NOT NULL, 1394 description text DEFAULT ''::text NOT NULL, 1395 home_lat double precision, 1396 home_lon double precision, 1397 home_zoom smallint DEFAULT 3, 1398 pass_salt character varying, 1399 email_valid boolean DEFAULT false NOT NULL, 1400 new_email character varying, 1401 creation_ip character varying, 1402 languages character varying, 1403 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL, 1404 terms_agreed timestamp without time zone, 1405 consider_pd boolean DEFAULT false NOT NULL, 1406 auth_uid character varying, 1407 preferred_editor character varying, 1408 terms_seen boolean DEFAULT false NOT NULL, 1409 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL, 1410 changesets_count integer DEFAULT 0 NOT NULL, 1411 traces_count integer DEFAULT 0 NOT NULL, 1412 diary_entries_count integer DEFAULT 0 NOT NULL, 1413 image_use_gravatar boolean DEFAULT false NOT NULL, 1414 auth_provider character varying, 1415 home_tile bigint, 1416 tou_agreed timestamp without time zone 1417); 1418 1419 1420-- 1421-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - 1422-- 1423 1424CREATE SEQUENCE public.users_id_seq 1425 START WITH 1 1426 INCREMENT BY 1 1427 NO MINVALUE 1428 NO MAXVALUE 1429 CACHE 1; 1430 1431 1432-- 1433-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - 1434-- 1435 1436ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; 1437 1438 1439-- 1440-- Name: way_nodes; Type: TABLE; Schema: public; Owner: - 1441-- 1442 1443CREATE TABLE public.way_nodes ( 1444 way_id bigint NOT NULL, 1445 node_id bigint NOT NULL, 1446 version bigint NOT NULL, 1447 sequence_id bigint NOT NULL 1448); 1449 1450 1451-- 1452-- Name: way_tags; Type: TABLE; Schema: public; Owner: - 1453-- 1454 1455CREATE TABLE public.way_tags ( 1456 way_id bigint DEFAULT 0 NOT NULL, 1457 k character varying NOT NULL, 1458 v character varying NOT NULL, 1459 version bigint NOT NULL 1460); 1461 1462 1463-- 1464-- Name: ways; Type: TABLE; Schema: public; Owner: - 1465-- 1466 1467CREATE TABLE public.ways ( 1468 way_id bigint DEFAULT 0 NOT NULL, 1469 changeset_id bigint NOT NULL, 1470 "timestamp" timestamp without time zone NOT NULL, 1471 version bigint NOT NULL, 1472 visible boolean DEFAULT true NOT NULL, 1473 redaction_id integer 1474); 1475 1476 1477-- 1478-- Name: acls id; Type: DEFAULT; Schema: public; Owner: - 1479-- 1480 1481ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass); 1482 1483 1484-- 1485-- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: - 1486-- 1487 1488ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass); 1489 1490 1491-- 1492-- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: - 1493-- 1494 1495ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass); 1496 1497 1498-- 1499-- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: - 1500-- 1501 1502ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass); 1503 1504 1505-- 1506-- Name: changesets id; Type: DEFAULT; Schema: public; Owner: - 1507-- 1508 1509ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass); 1510 1511 1512-- 1513-- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: - 1514-- 1515 1516ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass); 1517 1518 1519-- 1520-- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: - 1521-- 1522 1523ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass); 1524 1525 1526-- 1527-- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: - 1528-- 1529 1530ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass); 1531 1532 1533-- 1534-- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: - 1535-- 1536 1537ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass); 1538 1539 1540-- 1541-- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: - 1542-- 1543 1544ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass); 1545 1546 1547-- 1548-- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: - 1549-- 1550 1551ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass); 1552 1553 1554-- 1555-- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: - 1556-- 1557 1558ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass); 1559 1560 1561-- 1562-- Name: friends id; Type: DEFAULT; Schema: public; Owner: - 1563-- 1564 1565ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass); 1566 1567 1568-- 1569-- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: - 1570-- 1571 1572ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass); 1573 1574 1575-- 1576-- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: - 1577-- 1578 1579ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass); 1580 1581 1582-- 1583-- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: - 1584-- 1585 1586ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass); 1587 1588 1589-- 1590-- Name: issues id; Type: DEFAULT; Schema: public; Owner: - 1591-- 1592 1593ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass); 1594 1595 1596-- 1597-- Name: messages id; Type: DEFAULT; Schema: public; Owner: - 1598-- 1599 1600ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass); 1601 1602 1603-- 1604-- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: - 1605-- 1606 1607ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass); 1608 1609 1610-- 1611-- Name: notes id; Type: DEFAULT; Schema: public; Owner: - 1612-- 1613 1614ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass); 1615 1616 1617-- 1618-- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: - 1619-- 1620 1621ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass); 1622 1623 1624-- 1625-- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: - 1626-- 1627 1628ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass); 1629 1630 1631-- 1632-- Name: redactions id; Type: DEFAULT; Schema: public; Owner: - 1633-- 1634 1635ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass); 1636 1637 1638-- 1639-- Name: reports id; Type: DEFAULT; Schema: public; Owner: - 1640-- 1641 1642ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass); 1643 1644 1645-- 1646-- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: - 1647-- 1648 1649ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass); 1650 1651 1652-- 1653-- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: - 1654-- 1655 1656ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass); 1657 1658 1659-- 1660-- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: - 1661-- 1662 1663ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass); 1664 1665 1666-- 1667-- Name: users id; Type: DEFAULT; Schema: public; Owner: - 1668-- 1669 1670ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); 1671 1672 1673-- 1674-- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1675-- 1676 1677ALTER TABLE ONLY public.acls 1678 ADD CONSTRAINT acls_pkey PRIMARY KEY (id); 1679 1680 1681-- 1682-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1683-- 1684 1685ALTER TABLE ONLY public.active_storage_attachments 1686 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); 1687 1688 1689-- 1690-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1691-- 1692 1693ALTER TABLE ONLY public.active_storage_blobs 1694 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); 1695 1696 1697-- 1698-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1699-- 1700 1701ALTER TABLE ONLY public.ar_internal_metadata 1702 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); 1703 1704 1705-- 1706-- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1707-- 1708 1709ALTER TABLE ONLY public.changeset_comments 1710 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id); 1711 1712 1713-- 1714-- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1715-- 1716 1717ALTER TABLE ONLY public.changesets 1718 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id); 1719 1720 1721-- 1722-- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1723-- 1724 1725ALTER TABLE ONLY public.client_applications 1726 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id); 1727 1728 1729-- 1730-- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1731-- 1732 1733ALTER TABLE ONLY public.current_node_tags 1734 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k); 1735 1736 1737-- 1738-- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: - 1739-- 1740 1741ALTER TABLE ONLY public.current_nodes 1742 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id); 1743 1744 1745-- 1746-- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1747-- 1748 1749ALTER TABLE ONLY public.current_relation_members 1750 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id); 1751 1752 1753-- 1754-- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1755-- 1756 1757ALTER TABLE ONLY public.current_relation_tags 1758 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k); 1759 1760 1761-- 1762-- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1763-- 1764 1765ALTER TABLE ONLY public.current_relations 1766 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id); 1767 1768 1769-- 1770-- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1771-- 1772 1773ALTER TABLE ONLY public.current_way_nodes 1774 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id); 1775 1776 1777-- 1778-- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1779-- 1780 1781ALTER TABLE ONLY public.current_way_tags 1782 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k); 1783 1784 1785-- 1786-- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1787-- 1788 1789ALTER TABLE ONLY public.current_ways 1790 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id); 1791 1792 1793-- 1794-- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1795-- 1796 1797ALTER TABLE ONLY public.delayed_jobs 1798 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id); 1799 1800 1801-- 1802-- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1803-- 1804 1805ALTER TABLE ONLY public.diary_comments 1806 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id); 1807 1808 1809-- 1810-- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1811-- 1812 1813ALTER TABLE ONLY public.diary_entries 1814 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id); 1815 1816 1817-- 1818-- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1819-- 1820 1821ALTER TABLE ONLY public.diary_entry_subscriptions 1822 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id); 1823 1824 1825-- 1826-- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1827-- 1828 1829ALTER TABLE ONLY public.friends 1830 ADD CONSTRAINT friends_pkey PRIMARY KEY (id); 1831 1832 1833-- 1834-- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1835-- 1836 1837ALTER TABLE ONLY public.gpx_file_tags 1838 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id); 1839 1840 1841-- 1842-- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1843-- 1844 1845ALTER TABLE ONLY public.gpx_files 1846 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id); 1847 1848 1849-- 1850-- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1851-- 1852 1853ALTER TABLE ONLY public.issue_comments 1854 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id); 1855 1856 1857-- 1858-- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1859-- 1860 1861ALTER TABLE ONLY public.issues 1862 ADD CONSTRAINT issues_pkey PRIMARY KEY (id); 1863 1864 1865-- 1866-- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1867-- 1868 1869ALTER TABLE ONLY public.languages 1870 ADD CONSTRAINT languages_pkey PRIMARY KEY (code); 1871 1872 1873-- 1874-- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1875-- 1876 1877ALTER TABLE ONLY public.messages 1878 ADD CONSTRAINT messages_pkey PRIMARY KEY (id); 1879 1880 1881-- 1882-- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1883-- 1884 1885ALTER TABLE ONLY public.node_tags 1886 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k); 1887 1888 1889-- 1890-- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1891-- 1892 1893ALTER TABLE ONLY public.nodes 1894 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version); 1895 1896 1897-- 1898-- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1899-- 1900 1901ALTER TABLE ONLY public.note_comments 1902 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id); 1903 1904 1905-- 1906-- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1907-- 1908 1909ALTER TABLE ONLY public.notes 1910 ADD CONSTRAINT notes_pkey PRIMARY KEY (id); 1911 1912 1913-- 1914-- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1915-- 1916 1917ALTER TABLE ONLY public.oauth_nonces 1918 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id); 1919 1920 1921-- 1922-- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1923-- 1924 1925ALTER TABLE ONLY public.oauth_tokens 1926 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id); 1927 1928 1929-- 1930-- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1931-- 1932 1933ALTER TABLE ONLY public.redactions 1934 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id); 1935 1936 1937-- 1938-- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1939-- 1940 1941ALTER TABLE ONLY public.relation_members 1942 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id); 1943 1944 1945-- 1946-- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1947-- 1948 1949ALTER TABLE ONLY public.relation_tags 1950 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k); 1951 1952 1953-- 1954-- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1955-- 1956 1957ALTER TABLE ONLY public.relations 1958 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version); 1959 1960 1961-- 1962-- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1963-- 1964 1965ALTER TABLE ONLY public.reports 1966 ADD CONSTRAINT reports_pkey PRIMARY KEY (id); 1967 1968 1969-- 1970-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1971-- 1972 1973ALTER TABLE ONLY public.schema_migrations 1974 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); 1975 1976 1977-- 1978-- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1979-- 1980 1981ALTER TABLE ONLY public.user_blocks 1982 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id); 1983 1984 1985-- 1986-- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1987-- 1988 1989ALTER TABLE ONLY public.user_preferences 1990 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k); 1991 1992 1993-- 1994-- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: - 1995-- 1996 1997ALTER TABLE ONLY public.user_roles 1998 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id); 1999 2000 2001-- 2002-- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - 2003-- 2004 2005ALTER TABLE ONLY public.user_tokens 2006 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id); 2007 2008 2009-- 2010-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - 2011-- 2012 2013ALTER TABLE ONLY public.users 2014 ADD CONSTRAINT users_pkey PRIMARY KEY (id); 2015 2016 2017-- 2018-- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: - 2019-- 2020 2021ALTER TABLE ONLY public.way_nodes 2022 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id); 2023 2024 2025-- 2026-- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - 2027-- 2028 2029ALTER TABLE ONLY public.way_tags 2030 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k); 2031 2032 2033-- 2034-- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: - 2035-- 2036 2037ALTER TABLE ONLY public.ways 2038 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version); 2039 2040 2041-- 2042-- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: - 2043-- 2044 2045CREATE INDEX acls_k_idx ON public.acls USING btree (k); 2046 2047 2048-- 2049-- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: - 2050-- 2051 2052CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id); 2053 2054 2055-- 2056-- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: - 2057-- 2058 2059CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon); 2060 2061 2062-- 2063-- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: - 2064-- 2065 2066CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at); 2067 2068 2069-- 2070-- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: - 2071-- 2072 2073CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at); 2074 2075 2076-- 2077-- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: - 2078-- 2079 2080CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at); 2081 2082 2083-- 2084-- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: - 2085-- 2086 2087CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id); 2088 2089 2090-- 2091-- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: - 2092-- 2093 2094CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile); 2095 2096 2097-- 2098-- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2099-- 2100 2101CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp"); 2102 2103 2104-- 2105-- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: - 2106-- 2107 2108CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id); 2109 2110 2111-- 2112-- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2113-- 2114 2115CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp"); 2116 2117 2118-- 2119-- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: - 2120-- 2121 2122CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id); 2123 2124 2125-- 2126-- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2127-- 2128 2129CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp"); 2130 2131 2132-- 2133-- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: - 2134-- 2135 2136CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at); 2137 2138 2139-- 2140-- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: - 2141-- 2142 2143CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at); 2144 2145 2146-- 2147-- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: - 2148-- 2149 2150CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id); 2151 2152 2153-- 2154-- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: - 2155-- 2156 2157CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at); 2158 2159 2160-- 2161-- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: - 2162-- 2163 2164CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at); 2165 2166 2167-- 2168-- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: - 2169-- 2170 2171CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at); 2172 2173 2174-- 2175-- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: - 2176-- 2177 2178CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id); 2179 2180 2181-- 2182-- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: - 2183-- 2184 2185CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id); 2186 2187 2188-- 2189-- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: - 2190-- 2191 2192CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag); 2193 2194 2195-- 2196-- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2197-- 2198 2199CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp"); 2200 2201 2202-- 2203-- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: - 2204-- 2205 2206CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id); 2207 2208 2209-- 2210-- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: - 2211-- 2212 2213CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility); 2214 2215 2216-- 2217-- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: - 2218-- 2219 2220CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops); 2221 2222 2223-- 2224-- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: - 2225-- 2226 2227CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain); 2228 2229 2230-- 2231-- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: - 2232-- 2233 2234CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx); 2235 2236 2237-- 2238-- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: - 2239-- 2240 2241CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id); 2242 2243 2244-- 2245-- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: - 2246-- 2247 2248CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id); 2249 2250 2251-- 2252-- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: - 2253-- 2254 2255CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key); 2256 2257 2258-- 2259-- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: - 2260-- 2261 2262CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at); 2263 2264 2265-- 2266-- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: - 2267-- 2268 2269CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id); 2270 2271 2272-- 2273-- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: - 2274-- 2275 2276CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id); 2277 2278 2279-- 2280-- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: - 2281-- 2282 2283CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key); 2284 2285 2286-- 2287-- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: - 2288-- 2289 2290CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id); 2291 2292 2293-- 2294-- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: - 2295-- 2296 2297CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id); 2298 2299 2300-- 2301-- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: - 2302-- 2303 2304CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id); 2305 2306 2307-- 2308-- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: - 2309-- 2310 2311CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id); 2312 2313 2314-- 2315-- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: - 2316-- 2317 2318CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role); 2319 2320 2321-- 2322-- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: - 2323-- 2324 2325CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id); 2326 2327 2328-- 2329-- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: - 2330-- 2331 2332CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id); 2333 2334 2335-- 2336-- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: - 2337-- 2338 2339CREATE INDEX index_issues_on_status ON public.issues USING btree (status); 2340 2341 2342-- 2343-- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: - 2344-- 2345 2346CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by); 2347 2348 2349-- 2350-- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: - 2351-- 2352 2353CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body)); 2354 2355 2356-- 2357-- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: - 2358-- 2359 2360CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at); 2361 2362 2363-- 2364-- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: - 2365-- 2366 2367CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp"); 2368 2369 2370-- 2371-- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: - 2372-- 2373 2374CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token); 2375 2376 2377-- 2378-- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: - 2379-- 2380 2381CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id); 2382 2383 2384-- 2385-- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: - 2386-- 2387 2388CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id); 2389 2390 2391-- 2392-- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: - 2393-- 2394 2395CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id); 2396 2397 2398-- 2399-- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: - 2400-- 2401 2402CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id); 2403 2404 2405-- 2406-- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: - 2407-- 2408 2409CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id); 2410 2411 2412-- 2413-- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: - 2414-- 2415 2416CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id); 2417 2418 2419-- 2420-- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: - 2421-- 2422 2423CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id); 2424 2425 2426-- 2427-- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: - 2428-- 2429 2430CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile); 2431 2432 2433-- 2434-- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2435-- 2436 2437CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp"); 2438 2439 2440-- 2441-- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: - 2442-- 2443 2444CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id); 2445 2446 2447-- 2448-- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: - 2449-- 2450 2451CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at); 2452 2453 2454-- 2455-- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: - 2456-- 2457 2458CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status); 2459 2460 2461-- 2462-- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: - 2463-- 2464 2465CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at); 2466 2467 2468-- 2469-- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: - 2470-- 2471 2472CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id); 2473 2474 2475-- 2476-- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: - 2477-- 2478 2479CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile); 2480 2481 2482-- 2483-- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: - 2484-- 2485 2486CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id); 2487 2488 2489-- 2490-- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: - 2491-- 2492 2493CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id); 2494 2495 2496-- 2497-- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2498-- 2499 2500CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp"); 2501 2502 2503-- 2504-- Name: user_id_idx; Type: INDEX; Schema: public; Owner: - 2505-- 2506 2507CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id); 2508 2509 2510-- 2511-- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: - 2512-- 2513 2514CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role); 2515 2516 2517-- 2518-- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: - 2519-- 2520 2521CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token); 2522 2523 2524-- 2525-- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: - 2526-- 2527 2528CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id); 2529 2530 2531-- 2532-- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: - 2533-- 2534 2535CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid); 2536 2537 2538-- 2539-- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: - 2540-- 2541 2542CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name); 2543 2544 2545-- 2546-- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: - 2547-- 2548 2549CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text)); 2550 2551 2552-- 2553-- Name: users_email_idx; Type: INDEX; Schema: public; Owner: - 2554-- 2555 2556CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email); 2557 2558 2559-- 2560-- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: - 2561-- 2562 2563CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text)); 2564 2565 2566-- 2567-- Name: users_home_idx; Type: INDEX; Schema: public; Owner: - 2568-- 2569 2570CREATE INDEX users_home_idx ON public.users USING btree (home_tile); 2571 2572 2573-- 2574-- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: - 2575-- 2576 2577CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id); 2578 2579 2580-- 2581-- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: - 2582-- 2583 2584CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id); 2585 2586 2587-- 2588-- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: - 2589-- 2590 2591CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp"); 2592 2593 2594-- 2595-- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2596-- 2597 2598ALTER TABLE ONLY public.changeset_comments 2599 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id); 2600 2601 2602-- 2603-- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2604-- 2605 2606ALTER TABLE ONLY public.changeset_comments 2607 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2608 2609 2610-- 2611-- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2612-- 2613 2614ALTER TABLE ONLY public.changeset_tags 2615 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2616 2617 2618-- 2619-- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2620-- 2621 2622ALTER TABLE ONLY public.changesets_subscribers 2623 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2624 2625 2626-- 2627-- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2628-- 2629 2630ALTER TABLE ONLY public.changesets_subscribers 2631 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id); 2632 2633 2634-- 2635-- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2636-- 2637 2638ALTER TABLE ONLY public.changesets 2639 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2640 2641 2642-- 2643-- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2644-- 2645 2646ALTER TABLE ONLY public.client_applications 2647 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2648 2649 2650-- 2651-- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2652-- 2653 2654ALTER TABLE ONLY public.current_node_tags 2655 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id); 2656 2657 2658-- 2659-- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2660-- 2661 2662ALTER TABLE ONLY public.current_nodes 2663 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2664 2665 2666-- 2667-- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2668-- 2669 2670ALTER TABLE ONLY public.current_relation_members 2671 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id); 2672 2673 2674-- 2675-- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2676-- 2677 2678ALTER TABLE ONLY public.current_relation_tags 2679 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id); 2680 2681 2682-- 2683-- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2684-- 2685 2686ALTER TABLE ONLY public.current_relations 2687 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2688 2689 2690-- 2691-- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2692-- 2693 2694ALTER TABLE ONLY public.current_way_nodes 2695 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id); 2696 2697 2698-- 2699-- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2700-- 2701 2702ALTER TABLE ONLY public.current_way_nodes 2703 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id); 2704 2705 2706-- 2707-- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2708-- 2709 2710ALTER TABLE ONLY public.current_way_tags 2711 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id); 2712 2713 2714-- 2715-- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2716-- 2717 2718ALTER TABLE ONLY public.current_ways 2719 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2720 2721 2722-- 2723-- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2724-- 2725 2726ALTER TABLE ONLY public.diary_comments 2727 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id); 2728 2729 2730-- 2731-- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2732-- 2733 2734ALTER TABLE ONLY public.diary_comments 2735 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2736 2737 2738-- 2739-- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2740-- 2741 2742ALTER TABLE ONLY public.diary_entries 2743 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code); 2744 2745 2746-- 2747-- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2748-- 2749 2750ALTER TABLE ONLY public.diary_entries 2751 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2752 2753 2754-- 2755-- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2756-- 2757 2758ALTER TABLE ONLY public.diary_entry_subscriptions 2759 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id); 2760 2761 2762-- 2763-- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2764-- 2765 2766ALTER TABLE ONLY public.diary_entry_subscriptions 2767 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2768 2769 2770-- 2771-- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: - 2772-- 2773 2774ALTER TABLE ONLY public.active_storage_attachments 2775 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id); 2776 2777 2778-- 2779-- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2780-- 2781 2782ALTER TABLE ONLY public.friends 2783 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id); 2784 2785 2786-- 2787-- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2788-- 2789 2790ALTER TABLE ONLY public.friends 2791 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2792 2793 2794-- 2795-- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2796-- 2797 2798ALTER TABLE ONLY public.gps_points 2799 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id); 2800 2801 2802-- 2803-- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2804-- 2805 2806ALTER TABLE ONLY public.gpx_file_tags 2807 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id); 2808 2809 2810-- 2811-- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2812-- 2813 2814ALTER TABLE ONLY public.gpx_files 2815 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2816 2817 2818-- 2819-- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2820-- 2821 2822ALTER TABLE ONLY public.issue_comments 2823 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id); 2824 2825 2826-- 2827-- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2828-- 2829 2830ALTER TABLE ONLY public.issue_comments 2831 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2832 2833 2834-- 2835-- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2836-- 2837 2838ALTER TABLE ONLY public.issues 2839 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id); 2840 2841 2842-- 2843-- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2844-- 2845 2846ALTER TABLE ONLY public.issues 2847 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id); 2848 2849 2850-- 2851-- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2852-- 2853 2854ALTER TABLE ONLY public.issues 2855 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id); 2856 2857 2858-- 2859-- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2860-- 2861 2862ALTER TABLE ONLY public.messages 2863 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id); 2864 2865 2866-- 2867-- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2868-- 2869 2870ALTER TABLE ONLY public.messages 2871 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id); 2872 2873 2874-- 2875-- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2876-- 2877 2878ALTER TABLE ONLY public.node_tags 2879 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version); 2880 2881 2882-- 2883-- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2884-- 2885 2886ALTER TABLE ONLY public.nodes 2887 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2888 2889 2890-- 2891-- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2892-- 2893 2894ALTER TABLE ONLY public.nodes 2895 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id); 2896 2897 2898-- 2899-- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2900-- 2901 2902ALTER TABLE ONLY public.note_comments 2903 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id); 2904 2905 2906-- 2907-- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2908-- 2909 2910ALTER TABLE ONLY public.note_comments 2911 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id); 2912 2913 2914-- 2915-- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2916-- 2917 2918ALTER TABLE ONLY public.oauth_tokens 2919 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id); 2920 2921 2922-- 2923-- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2924-- 2925 2926ALTER TABLE ONLY public.oauth_tokens 2927 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2928 2929 2930-- 2931-- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2932-- 2933 2934ALTER TABLE ONLY public.redactions 2935 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2936 2937 2938-- 2939-- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2940-- 2941 2942ALTER TABLE ONLY public.relation_members 2943 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version); 2944 2945 2946-- 2947-- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2948-- 2949 2950ALTER TABLE ONLY public.relation_tags 2951 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version); 2952 2953 2954-- 2955-- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2956-- 2957 2958ALTER TABLE ONLY public.relations 2959 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 2960 2961 2962-- 2963-- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2964-- 2965 2966ALTER TABLE ONLY public.relations 2967 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id); 2968 2969 2970-- 2971-- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2972-- 2973 2974ALTER TABLE ONLY public.reports 2975 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id); 2976 2977 2978-- 2979-- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2980-- 2981 2982ALTER TABLE ONLY public.reports 2983 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 2984 2985 2986-- 2987-- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2988-- 2989 2990ALTER TABLE ONLY public.user_blocks 2991 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id); 2992 2993 2994-- 2995-- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 2996-- 2997 2998ALTER TABLE ONLY public.user_blocks 2999 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id); 3000 3001 3002-- 3003-- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3004-- 3005 3006ALTER TABLE ONLY public.user_blocks 3007 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 3008 3009 3010-- 3011-- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3012-- 3013 3014ALTER TABLE ONLY public.user_preferences 3015 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 3016 3017 3018-- 3019-- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3020-- 3021 3022ALTER TABLE ONLY public.user_roles 3023 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id); 3024 3025 3026-- 3027-- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3028-- 3029 3030ALTER TABLE ONLY public.user_roles 3031 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 3032 3033 3034-- 3035-- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3036-- 3037 3038ALTER TABLE ONLY public.user_tokens 3039 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); 3040 3041 3042-- 3043-- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3044-- 3045 3046ALTER TABLE ONLY public.way_nodes 3047 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version); 3048 3049 3050-- 3051-- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3052-- 3053 3054ALTER TABLE ONLY public.way_tags 3055 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version); 3056 3057 3058-- 3059-- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3060-- 3061 3062ALTER TABLE ONLY public.ways 3063 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id); 3064 3065 3066-- 3067-- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - 3068-- 3069 3070ALTER TABLE ONLY public.ways 3071 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id); 3072 3073 3074-- 3075-- PostgreSQL database dump complete 3076-- 3077 3078SET search_path TO "$user", public; 3079 3080INSERT INTO "schema_migrations" (version) VALUES 3081('1'), 3082('10'), 3083('11'), 3084('12'), 3085('13'), 3086('14'), 3087('15'), 3088('16'), 3089('17'), 3090('18'), 3091('19'), 3092('2'), 3093('20'), 3094('20100513171259'), 3095('20100516124737'), 3096('20100910084426'), 3097('20101114011429'), 3098('20110322001319'), 3099('20110508145337'), 3100('20110521142405'), 3101('20110925112722'), 3102('20111116184519'), 3103('20111212183945'), 3104('20120123184321'), 3105('20120208122334'), 3106('20120208194454'), 3107('20120214210114'), 3108('20120219161649'), 3109('20120318201948'), 3110('20120328090602'), 3111('20120404205604'), 3112('20120808231205'), 3113('20121005195010'), 3114('20121012044047'), 3115('20121119165817'), 3116('20121202155309'), 3117('20121203124841'), 3118('20130328184137'), 3119('20131212124700'), 3120('20140115192822'), 3121('20140117185510'), 3122('20140210003018'), 3123('20140507110937'), 3124('20140519141742'), 3125('20150110152606'), 3126('20150111192335'), 3127('20150222101847'), 3128('20150818224516'), 3129('20160822153055'), 3130('20161002153425'), 3131('20161011010929'), 3132('20170222134109'), 3133('20180204153242'), 3134('20181020114000'), 3135('20181031113522'), 3136('20190518115041'), 3137('20190623093642'), 3138('20190702193519'), 3139('20190716173946'), 3140('20191120140058'), 3141('21'), 3142('22'), 3143('23'), 3144('24'), 3145('25'), 3146('26'), 3147('27'), 3148('28'), 3149('29'), 3150('3'), 3151('30'), 3152('31'), 3153('32'), 3154('33'), 3155('34'), 3156('35'), 3157('36'), 3158('37'), 3159('38'), 3160('39'), 3161('4'), 3162('40'), 3163('41'), 3164('42'), 3165('43'), 3166('44'), 3167('45'), 3168('46'), 3169('47'), 3170('48'), 3171('49'), 3172('5'), 3173('50'), 3174('51'), 3175('52'), 3176('53'), 3177('54'), 3178('55'), 3179('56'), 3180('57'), 3181('6'), 3182('7'), 3183('8'), 3184('9'); 3185 3186 3187