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

Updated default values in the database #1596

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

Sujanadh
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Describe this PR

This PR updates the fmtm base database schema by adding default values wherever necessary at the database level instead of defining them using sqlalchemy.

Screenshots

SQL query to insert data in the user table without mentioning other fields where default values are set.
image

Result
image
Here, role, is_email_verified, is_expert , mapping_level , tasks_mapped, tasks_validated are auto-populated with default values.

Alternative Approaches Considered

Did you attempt any other approaches that are not documented in code?

Review Guide

Notes for the reviewer. How to test this change?

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@Sujanadh Sujanadh requested review from nrjadkry and spwoodcock June 24, 2024 07:57
@Sujanadh Sujanadh self-assigned this Jun 24, 2024
@github-actions github-actions bot added backend Related to backend code migration Contains a DB migration labels Jun 24, 2024
Copy link
Member

@spwoodcock spwoodcock left a comment

Choose a reason for hiding this comment

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

This is excellent, but will only apply to a newly created db.

We probably need a migration file with a load of ALTER TABLE commands to update the field defaults + a revert migration would be good too!

@Sujanadh
Copy link
Collaborator Author

Sujanadh commented Jul 2, 2024

  • Added migration file to update the existing tables to set their respective default values and to revert them.

@spwoodcock spwoodcock merged commit 4a2b022 into development Jul 3, 2024
5 checks passed
@spwoodcock spwoodcock deleted the feat/update-database-schema branch July 3, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code migration Contains a DB migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants