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

Change how we run migrations or initialize the database on a fresh installs #132

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

MelissaAutumn
Copy link
Member

@MelissaAutumn MelissaAutumn commented Oct 2, 2023

Fixes #119

This was a much bigger change than I expected. Most of it was due to how the aws deployment works, but it should be a-okay now.

There were some issues in one of the migration scripts as well, it was trying to drop columns that didn't exist. I uh, commented out the problem parts.

On the front-end side I discovered that if we declare a route like @get('/') the frontend must include the slash at the end, otherwise fastapi will redirect, which causes issues to the nginx rewrite config. I couldn't find a good solution other than to just add slashes at the end of some of these calls.

Changes:

  • BREAKING: Added appointment module folder in src.

  • BREAKING: alembic.ini should now be placed in the backend root folder. You will need to grab a fresh copy as there's been additional changes.

  • Added a super simple cli interface handled by main.py

  • Adjusted main.py to bootstrap either a fast api server or a cli interface.

  • Added a update-db command that is installed when pip install this module.

  • The update-db command will initialize a fresh database or run migrations, resolving most of our database woes.

  • New folder structure more closely matches the deployed folder structure for easier deployments.

  • Local docker now only mounts the src folder

  • Commented out some non-existent columns/constraints in a recent migration

  • Added missing trailing slash to the frontend for schedule/

  • Added sentry support to migrations

  • Adjusted code-referenced folder locations as required

@MelissaAutumn MelissaAutumn force-pushed the features/119-clean-up-migration-process branch 2 times, most recently from 797089e to 6bfa74f Compare October 2, 2023 22:52
@MelissaAutumn MelissaAutumn force-pushed the features/119-clean-up-migration-process branch from 2c8cf93 to e7ba925 Compare October 3, 2023 20:27
@MelissaAutumn MelissaAutumn self-assigned this Oct 3, 2023
…119)

- BREAKING: Added `appointment` module folder in `src`.
- BREAKING: alembic.ini should now be placed in the backend root folder. You will need to grab a fresh copy as there's been additional changes.

- Added a super simple cli interface handled by main.py
- Adjusted main.py to bootstrap either a fast api server or a cli interface.
- Added a `update-db` command that is installed when pip install this module.
- The `update-db` command will initialize a fresh database or run migrations, resolving most of our database woes.
- New folder structure more closely matches the deployed folder structure for easier deployments.
- Local docker now only mounts the `src` folder
- Commented out some non-existent columns/constraints in a recent migration
- Added missing trailing slash to the frontend for `schedule/`
- Added sentry support to migrations
- Adjusted code-referenced folder locations as required
Copy link
Contributor

@radishmouse radishmouse left a comment

Choose a reason for hiding this comment

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

Changes look 👍 to me!

Checked out your branch and was able to run successfully with docker compose up --build. Can confirm the new update_db.py script works for me (i.e., saw the message "Database already initialized, running migrations" in the terminal).

@MelissaAutumn
Copy link
Member Author

Neat, gonna merge it then. @devmount you might still want to get a look at it, since it's a big structure change 😅

@MelissaAutumn MelissaAutumn merged commit ff0dd5c into main Oct 3, 2023
Copy link
Collaborator

@devmount devmount left a comment

Choose a reason for hiding this comment

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

Hi @MelissaAutumn and @radishmouse, sorry I couldn't do a review earlier. First: Thanks Mel for this heavy PR done in such a short time 😮👏🏻 I've gone through the changes and completely reinstalled the application locally for testing:

  • Installed Appointment via docker-compose without issues
  • Ran update-db without issues
    image
  • Appointment and Schedule creation in the frontend worked after relogin

So this is really great work, thank you!

One question: do we have to call all API endpoints with a trailing slash in the frontend?

@devmount devmount deleted the features/119-clean-up-migration-process branch October 4, 2023 10:15
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.

Determine when/how to clean up migrations
3 participants