Skip to content

Commit

Permalink
feat: add geometrylog migration in fmtm base schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Sujanadh committed Dec 31, 2024
1 parent a48a9d3 commit 65fc6de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/migrations/002-create-geometry-log.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CREATE TABLE geometrylog (
task_id int
);

ALTER TABLE geometrylog OWNER TO fmtm;

-- Indexes for efficient querying
CREATE INDEX idx_geometrylog ON geometrylog USING gist (geom);

Expand Down
14 changes: 14 additions & 0 deletions src/backend/migrations/init/fmtm_base_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ ALTER TABLE public.submission_photos_id_seq OWNER TO fmtm;
ALTER SEQUENCE public.submission_photos_id_seq
OWNED BY public.submission_photos.id;

CREATE TABLE geometrylog (
id SERIAL PRIMARY KEY,
geom GEOMETRY NOT NULL,
status geomstatus,
project_id int,
task_id int
);
ALTER TABLE geometrylog OWNER TO fmtm;

-- nextval for primary keys (autoincrement)

ALTER TABLE ONLY public.organisations ALTER COLUMN id SET DEFAULT nextval(
Expand Down Expand Up @@ -458,6 +467,9 @@ ADD CONSTRAINT xlsforms_title_key UNIQUE (title);
ALTER TABLE ONLY public.submission_photos
ADD CONSTRAINT submission_photos_pkey PRIMARY KEY (id);

ALTER TABLE ONLY public.idx_geometrylog
ADD CONSTRAINT geometrylog_pkey PRIMARY KEY (id);

-- Indexing

CREATE INDEX idx_projects_outline ON public.projects USING gist (outline);
Expand Down Expand Up @@ -504,6 +516,8 @@ CREATE INDEX idx_entities_task_id
ON public.odk_entities USING btree (
entity_id, task_id
);
CREATE INDEX idx_geometrylog
ON geometrylog USING gist (geom);

-- Foreign keys

Expand Down

0 comments on commit 65fc6de

Please sign in to comment.