Version 2.1.0
Migration Guide for Version 2.1.0 🚀¶
Version 2.1.0 introduces significant changes to the database schema. Before upgrading, please review the changes below and follow the recommended steps to ensure a smooth migration.
Changes in Version 2.1.0:¶
-
New Fields:
- A non-nullable
staff_memberfield has been added to theappointmentrequestmodel. - The
created_atandupdated_atfields have been added to theconfigmodel. - A
background_colorfield has been added to theservicemodel.
- A non-nullable
-
Field Modifications:
- The
phonefield in theappointmentmodel has been modified to be non-nullable.
- The
-
New Models:
- Three new models have been introduced:
StaffMember,DayOff, andWorkingHours.
- Three new models have been introduced:
Recommended Migration Steps:¶
-
Backup: Before attempting to migrate, make sure to backup your current database. This will allow you to restore the previous state in case anything goes wrong.
-
Review New Fields:
- Ensure that there are no rows in the
appointmentrequesttable with a NULLstaff_member. - Ensure that the
phonefield in all rows of theappointmenttable is not NULL. If there are any, you may need to manually update them or set a default value.
- Ensure that there are no rows in the
-
Run Migrations:
- After reviewing and making necessary data adjustments, run the migrations using the
command:
python manage.py migrate appointment.
- After reviewing and making necessary data adjustments, run the migrations using the
command:
-
Post-Migration Checks:
- Verify that all new fields and models have been correctly added to the database.
- Check the application functionality related to the modified models to ensure data integrity and correct behavior.
If You Mistakenly Upgraded Without Preparations:¶
-
Restore Backup: If you have a backup of your database, restore it to revert to the previous state before the migration attempt.
-
Manual Field Adjustments: If you don't have a backup:
- When prompted about the
staff_memberfield, you can set a default value by selecting option 1 and inputtingNone. - For the
created_atandupdated_atfields, set the default value totimezone.now. - For the
phonefield in theappointmentmodel, set a default value by selecting option 1 and inputting an empty string"".
- When prompted about the
-
Retry Migration: After making the necessary adjustments, you can then attempt the migration again using the command:
python manage.py migrate appointment.
Important Notes 📝:¶
-
The migration process described above has the potential to disrupt your application if not executed correctly. Ensure thorough testing before deploying these changes to a live environment.
-
Make sure to read the error messages during migration. They provide valuable insights into potential issues and how to address them.