Skip to content

Conversation

@wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Apr 9, 2025

Overview

Prevent failure of migration on a brand new CMS by running command on signal not migration.

Related

Changes

  • retires add_groups migration
  • adds apps.py which creates groups
  • adds dummy model so post_migrate signal fires

Testing

  1. Set up a fresh CMS (no previous volumes):
    How to Setup CMS From Scratch? #942

  2. In the output, after migrations, see log statement:

    Finished creating CMS groups

  3. Open http://localhost:8000/admin/auth/group/.

  4. Log in.

  5. Verify groups exist.

  6. Open http://localhost:8000/admin/auth/group/6/change/.

  7. Verify permissions exist.

  8. Re-run migrations

    docker exec -it core_cms python manage.py migrate
    
  9. In the output, after "No migrations to apply.", see log statement:

    Finished updating CMS groups

UI

  1. clean up and set up
  2. finished creating groups
  3. No screenshot.
  4. No screenshot.
  5. groups exist
  6. No screenshot.
  7. perms exist
  8. migrate
  9. updating groups

Didn't work when I tested on fresh CMS. But seems simpler than before. Every time I tested previosu commit with AI debugging, we agreed "create_permissions" was a bad thing to do. It usurps Django's order of oeprations.
@wesleyboar wesleyboar marked this pull request as ready for review April 10, 2025 22:21
@wesleyboar wesleyboar changed the title fix(gh-931): cms migrate fails fix(gh-931): migrate fails on fresh cms Apr 10, 2025
@wesleyboar
Copy link
Member Author

wesleyboar commented Apr 18, 2025

New Update to Testing Steps

Old Update to Testing Steps

I updated the terminal command to copy over the new Make commands:

git diff --name-only origin/feat/script-to-setup-cms..origin/main | xargs git restore --source=origin/feat/script-to-setup-cms --

Previous command relied on local branch. This command relies on remote branches.

@wesleyboar
Copy link
Member Author

Testing step prerequisite simplified as new issue #942.

@wesleyboar wesleyboar merged commit c482d17 into main Apr 25, 2025
@wesleyboar wesleyboar deleted the fix/gh-931-cms-migrate-fail branch April 25, 2025 17:22
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.

CMS Migration Fails on New CMS

3 participants