Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up local databases #8

Open
adesca opened this issue Jun 25, 2019 · 1 comment
Open

Setting up local databases #8

adesca opened this issue Jun 25, 2019 · 1 comment
Assignees
Labels
Can be done in parallel This task can be done without depending on tasks that are before it

Comments

@adesca
Copy link
Contributor

adesca commented Jun 25, 2019

AS Sam
I SHOULD be able to run a local docker instance with Postgres and postgis
THAT uses the existing invisible institute schema

AS Sam
WHEN I USE the local docker instance
I SHOULD SEE data dumped from invisible institutes database

Refer here for details:
Docker: https://hub.docker.com/r/mdillon/postgis/

Postgres with Docker tutorial: https://webcache.googleusercontent.com/search?q=cache:zAx4MWZ9GHEJ:https://hackernoon.com/dont-install-postgres-docker-pull-postgres-bee20e200198+&cd=1&hl=en&ct=clnk&gl=us

Invisible institute schema: https://paper.dropbox.com/doc/CPDP-Schema-Documentation-jiOJTlxkx2L99s9ycJqj3

Schema cleaned of extraneous database functions: https://docs.google.com/spreadsheets/d/1f83CcUdcyt-1kRnzkm_v0_rSJ0w3hfgd5TRBSlayFvQ/edit?usp=sharing

@adesca adesca added the Can be done in parallel This task can be done without depending on tasks that are before it label Jun 25, 2019
@dtoakley dtoakley self-assigned this Jun 26, 2019
@dtoakley
Copy link
Contributor

dtoakley commented Jun 27, 2019

This is just a proof of concept for now, but here's a branch that's working for me locally: #24

You need to have the /data/postgis_init.sql file in order for it to run. This is based on the data dump (https://www.dropbox.com/s/riixbrze6apmcrn/cpdp-apr-5-2019.sql?dl=0), however with the following changes to it:

  1. Remove SELECT pg_catalog.set_config('search_path', '', false);
  2. Add in:
--
-- Create Postgis Extension
--

CREATE EXTENSION postgis;

--
-- Create required roles
--

CREATE USER numeracy;
CREATE USER notebook;
CREATE USER civis;
  1. Remove:
-- Name: data_attachmentfile data_attachmentfile_last_updated_by_id_061dfbf8_fk_auth_user_id; Type: FK CONSTRAINT; Schema: public; Owner: cpdb
--

ALTER TABLE ONLY public.data_attachmentfile
    ADD CONSTRAINT data_attachmentfile_last_updated_by_id_061dfbf8_fk_auth_user_id FOREIGN KEY (last_updated_by_id) REFERENCES public.auth_user(id) DEFERRABLE INITIALLY DEFERRED;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can be done in parallel This task can be done without depending on tasks that are before it
Projects
None yet
Development

No branches or pull requests

2 participants