X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/fc1c8d60a4bb9cc8d3942c954bed4b66f8e9c557..4c4150e0d0dc43c0468388956728d8ffc43e6c9c:/db/structure.sql diff --git a/db/structure.sql b/db/structure.sql index 63aa17353..939799c0a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -107,39 +107,6 @@ CREATE TYPE public.user_status_enum AS ENUM ( 'deleted' ); - --- --- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint - LANGUAGE plpgsql IMMUTABLE - AS $$ -DECLARE - x int8; -- quantized x from lon, - y int8; -- quantized y from lat, -BEGIN - x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0); - y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0); - - -- these bit-masks are special numbers used in the bit interleaving algorithm. - -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN - -- for the original algorithm and more details. - x := (x | (x << 8)) & 16711935; -- 0x00FF00FF - x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F - x := (x | (x << 2)) & 858993459; -- 0x33333333 - x := (x | (x << 1)) & 1431655765; -- 0x55555555 - - y := (y | (y << 8)) & 16711935; -- 0x00FF00FF - y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F - y := (y | (y << 2)) & 858993459; -- 0x33333333 - y := (y | (y << 1)) & 1431655765; -- 0x55555555 - - RETURN (x << 1) | y; -END; -$$; - - SET default_tablespace = ''; SET default_table_access_method = heap; @@ -753,7 +720,7 @@ CREATE TABLE public.gps_points ( -- CREATE TABLE public.gpx_file_tags ( - gpx_id bigint DEFAULT 0 NOT NULL, + gpx_id bigint NOT NULL, tag character varying NOT NULL, id bigint NOT NULL ); @@ -1185,6 +1152,36 @@ CREATE SEQUENCE public.oauth_nonces_id_seq ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id; +-- +-- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.oauth_openid_requests ( + id bigint NOT NULL, + access_grant_id bigint NOT NULL, + nonce character varying NOT NULL +); + + +-- +-- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.oauth_openid_requests_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id; + + -- -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: - -- @@ -1274,7 +1271,7 @@ ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id; -- CREATE TABLE public.relation_members ( - relation_id bigint DEFAULT 0 NOT NULL, + relation_id bigint NOT NULL, member_type public.nwr_enum NOT NULL, member_id bigint NOT NULL, member_role character varying NOT NULL, @@ -1288,7 +1285,7 @@ CREATE TABLE public.relation_members ( -- CREATE TABLE public.relation_tags ( - relation_id bigint DEFAULT 0 NOT NULL, + relation_id bigint NOT NULL, k character varying DEFAULT ''::character varying NOT NULL, v character varying DEFAULT ''::character varying NOT NULL, version bigint NOT NULL @@ -1300,7 +1297,7 @@ CREATE TABLE public.relation_tags ( -- CREATE TABLE public.relations ( - relation_id bigint DEFAULT 0 NOT NULL, + relation_id bigint NOT NULL, changeset_id bigint NOT NULL, "timestamp" timestamp without time zone NOT NULL, version bigint NOT NULL, @@ -1541,7 +1538,7 @@ CREATE TABLE public.way_nodes ( -- CREATE TABLE public.way_tags ( - way_id bigint DEFAULT 0 NOT NULL, + way_id bigint NOT NULL, k character varying NOT NULL, v character varying NOT NULL, version bigint NOT NULL @@ -1553,7 +1550,7 @@ CREATE TABLE public.way_tags ( -- CREATE TABLE public.ways ( - way_id bigint DEFAULT 0 NOT NULL, + way_id bigint NOT NULL, changeset_id bigint NOT NULL, "timestamp" timestamp without time zone NOT NULL, version bigint NOT NULL, @@ -1737,6 +1734,13 @@ ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval(' ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass); +-- +-- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass); + + -- -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: - -- @@ -1834,6 +1838,14 @@ ALTER TABLE ONLY public.changeset_comments ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id); +-- +-- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.changeset_tags + ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k); + + -- -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2066,6 +2078,14 @@ ALTER TABLE ONLY public.oauth_nonces ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id); +-- +-- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oauth_openid_requests + ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id); + + -- -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2193,13 +2213,6 @@ ALTER TABLE ONLY public.ways CREATE INDEX acls_k_idx ON public.acls USING btree (k); --- --- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id); - - -- -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: - -- @@ -2403,6 +2416,13 @@ CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_b CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest); +-- +-- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at); + + -- -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: - -- @@ -2599,6 +2619,13 @@ CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp"); +-- +-- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id); + + -- -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: - -- @@ -3015,6 +3042,14 @@ ALTER TABLE ONLY public.oauth_access_tokens ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID; +-- +-- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oauth_openid_requests + ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE; + + -- -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -3427,6 +3462,12 @@ INSERT INTO "schema_migrations" (version) VALUES ('20210511104518'), ('20211216185316'), ('20220201183346'), +('20220223140543'), +('20230816135800'), +('20230825162137'), +('20230830115219'), +('20230830115220'), +('20231007141103'), ('21'), ('22'), ('23'), @@ -3471,5 +3512,3 @@ INSERT INTO "schema_migrations" (version) VALUES ('7'), ('8'), ('9'); - -