Skip to content

[$30] Use existent env variable during DB migration #634

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

Open
maxceem opened this issue Nov 22, 2021 · 5 comments
Open

[$30] Use existent env variable during DB migration #634

maxceem opened this issue Nov 22, 2021 · 5 comments
Assignees
Labels

Comments

@maxceem
Copy link
Contributor

maxceem commented Nov 22, 2021

We have a migration command which migrate DB: npm run migrate. Underneath it calls built-in sequelize command https://sequelize.org/master/manual/migrations.html.

At the moment when we run this script on DEV or PROD we have to pass several environment variables DB_USERNAME, DB_PASSWORD, DB_NAME and DB_HOST. Though we already have env variable which defines DB connection settings using env variable DATABASE_URL with the value which looks like postgres://postgres:postgres@localhost:5432/postgres.

We don't want to provide separate values DB_USERNAME, DB_PASSWORD, DB_NAME and DB_HOST instead, we would like to update this config so it:

  • don't use DB_USERNAME, DB_PASSWORD, DB_NAME and DB_HOST anymore

  • parses the value inside DATABASE_URL and split it into value required by the sequelize:

    image

  • It should be done for all envs: development, test, production

    • keep default values for development and test environments, but not for production
  • make sure that migration script works only by setting DATABASE_URL

@maxceem maxceem changed the title Use existent env variable during DB migration [$30] Use existent env variable during DB migration Nov 22, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Nov 22, 2021

@yoution feel free to pick up if you like.

@maxceem maxceem added the CF label Nov 22, 2021
@yoution
Copy link
Contributor

yoution commented Nov 22, 2021

@maxceem please assign to me

yoution added a commit to yoution/taas-apis that referenced this issue Nov 23, 2021
maxceem added a commit that referenced this issue Nov 23, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Nov 23, 2021

Challenge https://www.topcoder.com/challenges/00fdb431-2c2c-47ac-ac30-f42d8b5b7e79 has been created for this ticket.

This is an automated message for maxceem via Topcoder X

@maxceem
Copy link
Contributor Author

maxceem commented Nov 23, 2021

Challenge https://www.topcoder.com/challenges/00fdb431-2c2c-47ac-ac30-f42d8b5b7e79 has been assigned to yoution.

This is an automated message for maxceem via Topcoder X

@maxceem
Copy link
Contributor Author

maxceem commented Nov 23, 2021

Payment task has been updated: https://www.topcoder.com/challenges/00fdb431-2c2c-47ac-ac30-f42d8b5b7e79
Payments Complete
Winner: yoution
Copilot: maxceem
Challenge 00fdb431-2c2c-47ac-ac30-f42d8b5b7e79 has been paid and closed.

This is an automated message for maxceem via Topcoder X

@maxceem maxceem reopened this Nov 23, 2021
@maxceem maxceem added the Skip QA QA for this task cannot be done or not needed label Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants