Breaking changes for dev setup

3 views
Skip to first unread message

Pavish Kumar Ramani Gopal

unread,
Jan 12, 2024, 2:04:19 AMJan 12
to Mathesar Developers
Hello everyone,

This PR (#3390) resets Mathesar migration files. When it is merged, you'll have to reset your internal django DB. Here are the options you can follow to fix your dev setup:


Fresh state (Easy)
This method is the easiest, but will destroy all your data.
Pull all the latest changes from develop and then run the following:

docker compose -f docker-compose.yml -f docker-compose.dev.yml down -v

docker compose -f docker-compose.yml -f docker-compose.dev.yml up


This will remove all the Mathesar containers and volumes, and recreate them.


Retain user databases (Medium)
This method will preserve your dev test data (i.e. user databases), but will destroy all internal configurations like explorations, users, connections, table settings etc.,
  • Pull all the latest changes from develop. Make sure the changesets from the above PR are present.
  • Stop your docker containers:
    • docker compose -f docker-compose.yml -f docker-compose.dev.yml stop

  • Start the dev-db service:
    • docker compose -f docker-compose.yml -f docker-compose.dev.yml up dev-db

  • Open a shell into the `mathesar_dev_db` container and login to the postgres instance to a database different from `mathesar_django`:
    • docker exec -it mathesar_dev_db /bin/bash

    • psql -U mathesar

  • Drop and recreate the mathesar_django database:
    • drop database mathesar_django;

    • create database mathesar_django;

  • Start the dev-service:
    • docker compose -f docker-compose.yml -f docker-compose.dev.yml up dev-service



Retain user databases and internal configurations (Hard)
This method will preserve all your dev data. No guarantees, there are chances that you may encounter errors which will require debugging from your end. Ensure that you export any data important to you before attempting this.
  • Do not pull the latest changes containing the above PR from develop. Ensure that the changes from the above PR are not present in your local git branch.
  • Ensure that your local git branch contains the changesets at least upto this commit hash: `384f56490dd7b08860e13c55c1c079c11a312a5c`.
  • Open a shell into the `mathesar_service_dev` container.
    • docker exec -it mathesar_service_dev /bin/bash

  • Run the following:
    • python manage.py migrate --fake mathesar 0004

  • Run the following command, make sure it shows the expected output present below it:
    • python manage.py showmigrations mathesar

      mathesar

       [X] 0001_initial

       [X] 0002_datafile_type

       [X] 0003_datafile_max_level

       [X] 0004_shares

       [ ] 0005_datafile_sheet_name

       [ ] 0006_auto_20230906_0413

       [ ] 0007_auto_20230913_1912

       [ ] 0008_auto_20230921_1834

       [ ] 0005_user_display_language

       [ ] 0009_merge_20231025_1733

       [ ] 0010_remove_editable

       [ ] 0011_auto_20240103_2120

  • Pull all the latest changes from develop, make sure the changesets from the merged PR are present.
  • Run the following:
    • python manage.py migrate --fake mathesar 0005

  • Run the following command, make sure it shows the expected output present below it:
    • python manage.py showmigrations mathesar

      mathesar

       [X] 0001_initial

       [X] 0002_datafile_type

       [X] 0003_datafile_max_level

       [X] 0004_shares

       [X] 0005_release_0_1_4

  • Note: This method only resets the migration history within django and does not actually perform any migration. This should be fine since the file `0005_release_0_1_4` only cleans up and consolidates changes from the previous set of migration files.

-- Pavish

Sean Colsen

unread,
Jan 16, 2024, 8:37:00 PMJan 16
to Pavish Kumar Ramani Gopal, Mathesar Developers

I think that "up" command within the first section should be:

docker compose -f docker-compose.yml -f docker-compose.dev.yml up dev-service

i.e. it needs “dev-service” after the command you have

I haven't looked at the other sections.

Reply all
Reply to author
Forward
0 new messages