Skip to content

Add init_db.sh script for database initialization and migration#241

Closed
Abdulrahman-Elfeky wants to merge 1 commit intorust-lang:mainfrom
Abdulrahman-Elfeky:main
Closed

Add init_db.sh script for database initialization and migration#241
Abdulrahman-Elfeky wants to merge 1 commit intorust-lang:mainfrom
Abdulrahman-Elfeky:main

Conversation

@Abdulrahman-Elfeky
Copy link
Copy Markdown

How it works?

  • Runs the existing init_db function
  • Applies database migrations using sqlx-cli
  • Uses environment variables for configuration [POSTGRES_USER, ..... ,SKIP_DOCKER=1]
  • Ensures safe execution
  • Requires psql and sqlx-cli to be installed
  • Make sure to run chmod +x scripts/init_db.sh before executing the script

@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Mar 21, 2025

Hi! Could you please provide a bit more info, what's the motivation for this? Do you think that the instructions in https://github.com/rust-lang/bors/blob/main/docs/development.md are too complicated and we should have a script for initing the DB? It's kind of hard to predict what environment people have, such scripts will necessarily not work for some people, so I usually rather provide more atomic commands that people can mix & match.

The linker development guide could probably be rewritten to be clearer on what to do if you want to develop on bors though. Maybe that would be better than the script? :)

@Abdulrahman-Elfeky
Copy link
Copy Markdown
Author

U broke my heart 💔😅
I was just setting the environment to start contributing, and yeah, I found that development docs can be simpler.

@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Jan 21, 2026

I think that a better approach would be to use something like just (https://github.com/casey/just), or a simple xtask (https://github.com/matklad/cargo-xtask/) script, to provide more targeted commands, such as "Reset the .sqlx directory" (I do this relatively often and currently it requires copy-pasting three Bash commands out of the docs/development.md file). I think that would be more useful than a single bash script that does everything in one go.

So I'm going to close this, but if you'd like to experiment with the justfile or something similar, I'd be happy to review that. Thank you for the PR anyway!

@Kobzol Kobzol closed this Jan 21, 2026
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.

2 participants