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

fix(postgres): postgres setup #3092

Merged
merged 2 commits into from
Aug 13, 2021

Conversation

jensenity
Copy link

@jensenity jensenity commented Aug 13, 2021

This PR fixes the error in the init.sql. Postgres SQL doesn't support CREATE DATABASE IF NOT EXISTS, so I have added a psql shell script in the init.sh to check whether there's the database we want, if not create database datahub. And also some minor changes in the sql file. Such as we can use the TEMP table syntax when we create a temp table.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@@ -6,6 +6,6 @@ COPY docker/postgres-setup/init.sql /init.sql
COPY docker/postgres-setup/init.sh /init.sh
RUN chmod 755 init.sh

ENV DATAHUB_DB_NAME="datahub"
ENV DATAHUB_DB_NAME=$POSTGRES_DATABASENAME
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a separate env variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just use DATAHUB_DB_NAME ?

Copy link
Author

Choose a reason for hiding this comment

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

I guess we don't need it. Initial intention is for the users to be able set their own database name through the env. But if it's unnecessary, we can remove it!

Copy link
Contributor

Choose a reason for hiding this comment

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

So DATAHUB_DB_NAME already does that. Here it seems like it's always set to "datahub" but it does use the appropriate db name during setup.(This is the case for mysql-setup, where I tested with different db names)

Copy link
Author

Choose a reason for hiding this comment

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

true...dbeec80

Copy link
Contributor

@shirshanka shirshanka left a comment

Choose a reason for hiding this comment

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

LGTM

@shirshanka shirshanka merged commit 48b3d7a into datahub-project:master Aug 13, 2021
rahulbsw pushed a commit to rahulbsw/datahub that referenced this pull request Sep 2, 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.

3 participants