mentorship-backend
mentorship-backend copied to clipboard
Dev: Add initial migration and Running migration instruction to README
Description
Initiate migration script and add running migration script to README
Fixes #996
Type of Change:
- Code
- Documentation
Code/Quality Assurance Only
- This change requires a documentation update (software upgrade on readme file)
- New feature (non-breaking change which adds functionality pre-approved by mentors)
How Has This Been Tested?
- On initiation of migration script/when contributors running migration script for the first time
Confirmed that alembic version was added to the local db and the initial version was created under
migrations > versions
folder before running initial migration
after running initial migration
- if contributor missed migration version updates
The local db will be updated one version at a time accordingly
from initial to second revision
from second to third revision
-
When you are making changes by adding attribute/s to an existing db model
-
When you are making changes by ALTERING EXISTING ATTRIBUTES inside an existing db model Example case: User table Changes:
- renaming column
name
tofull_name
- change password_hash field length from 100 to unspecified
- renaming column

IMPORTANT Noticed that the auto-generated alembic script IS NOT CORRECT!!.
You MUST MODIFY the script to reflect the intended schema changes. Once you're done, you can run flask db upgrade

before alteration
After alteration (with data successfully preserved)
Checklist:
- [ ] My PR follows the style guidelines of this project
- [ ] I have performed a self-review of my own code or materials
- [ ] I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] Any dependent changes have been merged
- [ ] Update Postman API at /docs folder
- [ ] Update Swagger documentation and the exported file at /docs folder
- [ ] Update requirements.txt
Code/Quality Assurance Only
- [ ] My changes generate no new warnings
- [ ] My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been published in downstream modules
ADDITIONAL NOTE NA
Codecov Report
Merging #1133 (21ec10c) into develop (d717c93) will not change coverage. The diff coverage is
100.00%
.
:exclamation: Current head 21ec10c differs from pull request most recent head d0acedd. Consider uploading reports for the commit d0acedd to get more accurate results
@@ Coverage Diff @@
## develop #1133 +/- ##
========================================
Coverage 92.95% 92.95%
========================================
Files 38 38
Lines 2073 2073
========================================
Hits 1927 1927
Misses 146 146
Impacted Files | Coverage Δ | |
---|---|---|
run.py | 96.15% <100.00%> (ø) |
@isabelcosta, @epicadk, @vj-codes, this PR is now ready for a review. Look forward to your feedback 😉.