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

Document Database Setup and Migrations #2994

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

gbirke
Copy link
Member

@gbirke gbirke commented Oct 7, 2024

How to integrate a database change from a bounded context in the Fundraising Application

The Fundraising Application has two different database environments:

- The **local development environment**. We're running a MariaDB database in a Docker container for local user and acceptance testing. We are using an in-memory SQLite database for running unit tests. This makes running the tests fast and allows for a clear separation between interactive testing and automated testing.
- The **server environment** has a dedicated database server with two databases (test and production) that our test and production web servers connect to. The Fundraising App and the Fundraising Operation Center both share the same production or testing database.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- The **server environment** has a dedicated database server with two databases (test and production) that our test and production web servers connect to. The Fundraising App and the Fundraising Operation Center both share the same production or testing database.
- The **server environment** is running on a dedicated database server with two databases (test and production) that our test and production web servers connect to. The Fundraising App and the Fundraising Operation Center both share the same production or testing database.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, maybe "consists of" or just "uses"? Pinging @Abban for a comment

Copy link
Member

Choose a reason for hiding this comment

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

"Consists of" is good

If you're getting errors from the application after the containers are up, check if the database tables exist by running the following command:

```shell
docker compose exec database mysql -u fundraising -p"INSECURE PASSWORD" fundraising -e "SHOW TABLES"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
docker compose exec database mysql -u fundraising -p"INSECURE PASSWORD" fundraising -e "SHOW TABLES"
docker compose exec database mysql -u fundraising -p "INSECURE PASSWORD" fundraising -e "SHOW TABLES"

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, this is one of the pecularities of the MySQL client: if you specify -p something it will interpret that as "ask for a password and use parameter 'something'". If its -psomething it will interpret that as "Use password 'something'". And sometimes will give a warning about that practice because that command can then end up in the bash history, revealing the password.

2. Run CI and fix failing tests.
3. Run the database migration on the *old* version of the database schema
4. User-test the changed database (to check if the migrated database is correct)
5. Re-generate SQL for the local environment.
Copy link
Contributor

Choose a reason for hiding this comment

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

does this point refer to ### Regenerating the local SQL ? Maybe we could link there or add the command here as well

@moiikana moiikana self-requested a review October 8, 2024 14:44
Copy link
Contributor

@moiikana moiikana left a comment

Choose a reason for hiding this comment

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

see comments above for suggestions/change requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants