Skip to content

create schema in container automatically#275

Merged
jenhagg merged 1 commit intodevelopfrom
jon/initdb
Aug 31, 2020
Merged

create schema in container automatically#275
jenhagg merged 1 commit intodevelopfrom
jon/initdb

Conversation

@jenhagg
Copy link
Copy Markdown
Collaborator

@jenhagg jenhagg commented Aug 28, 2020

Purpose

Simplify local integration tests by automating schema creation in local db.

What it does

Add schema.sql to git, and mount it in the local db container. Postgres will automatically run the scripts in /docker-entrypoint-initdb.d which eliminates the need to any manual db management in this case.

To test this, I removed the existing containers (docker-compose -f stack.yml down and docker container prune) then recreated them and logged in using psql to verify.

Time to review

5 min

@jenhagg jenhagg self-assigned this Aug 28, 2020
@rouille
Copy link
Copy Markdown
Collaborator

rouille commented Aug 28, 2020

@kasparm and @BainanXia, can look at this PR? I think you have already everything set up on your machine or the server. This should be not much work to checkout the branch and run the test.

Copy link
Copy Markdown
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests passed. Tables for testing purpose are created automatically once the the container is up. Thanks.

Copy link
Copy Markdown
Contributor

@kasparm kasparm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests passed!

@jenhagg jenhagg merged commit 7fc5984 into develop Aug 31, 2020
@jenhagg jenhagg deleted the jon/initdb branch August 31, 2020 17:26
@ahurli ahurli mentioned this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants