Closed torgeirl closed 1 year ago
You can run
manage.py makemigrations
manage.py makemigrations trix_core
manage.py migrate
If you prefer to have the migration folder committed I can do that, but not until early next week.
Not sure why, but that didn't solve the issue:
> venv/bin/python manage.py makemigrations
No changes detected
> venv/bin/python manage.py makemigrations trix_core
Migrations for 'trix_core':
venv/lib/python3.6/site-packages/trix/trix_core/migrations/0001_initial.py
- Create model User
- Create model Assignment
- Create model Course
- Create model HowSolved
- Create model Permalink
- Create model Tag
- Add field tags to permalink
- Add field active_period to course
- Add field admins to course
- Add field course_tag to course
- Add field owner to course
- Add field tags to assignment
> venv/bin/python manage.py migrate
Operations to perform:
Apply all migrations: account, admin, auth, contenttypes, sessions, sites, socialaccount, trix_core
Running migrations:
No migrations to apply.
It should be committed for the final release since all installations should use the same migrations.
Added in #101
This is still a problem in v3.0.0b3
(includes PR #101). There were similar issues when 2.1.0
was finalized in August 2018, so I looked more into how migrations are intended to work. It seems to me that the issue is that older migrations are missing. Perhaps that is the underlying issue?
Looking at the current production server (updated from 2.0.x
to 2.1.0
post its release on August 20, 2018) the following migrations should be available:
# venv/bin/python manage.py showmigrations
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
[X] 0008_alter_user_username_max_length
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
sessions
[X] 0001_initial
trix_core
[X] 0001_initial
[X] 0002_assignment_hidden
[X] 0003_auto_20180809_1220
[X] 0004_user_fix
The following migrations are also available on the test server (v3.0.0b3
):
account
[X] 0001_initial
[X] 0002_email_max_length
sites
[X] 0001_initial
[X] 0002_alter_domain_unique
socialaccount
[X] 0001_initial
[X] 0002_token_max_lengths
[X] 0003_extra_data_default_dict
trix_core
on the test server is however missinng trix_core 0002-0004. The files for them were added in #101, in addition to trix_core/migrations/0005_auto_20190818_2150.py
. A dependency for 0005 is auth's 0008_alter_user_username_max_length
, which migration file is not present in the repo.
I suspect adding the older migration files could solve the issue.
This is still a problem in
v3.0.0b3
(includes PR #101). There were similar issues when2.1.0
was finalized in August 2018, so I looked more into how migrations are intended to work. It seems to me that the issue is that older migrations are missing. Perhaps that is the underlying issue?(...)
I suspect adding the older migration files could solve the issue.
Migrations was introduced with Django 1.7. When the Django version and dependencies were updated for Trix 2.1, it upgraded from Django 1.6 to 1.11 (#26). I looks like migrations were not handled in the emigration process, and therefore still are missing.
Trying to edit admins on a course or in Django admin selection a course gives a HTTP 500:
ProgrammingError: relation "trix_core_course_owner" does not exist LINE 1: ...onsent_datetime" FROM "trix_core_user" INNER JOIN "trix_core...
It seems the migrations for the
trix_core_course_owner
app added in #97 is missing.
I'm still able to reproduce this issue in our fresh development environment:
UndefinedTable
relation "trix_core_course_owner" does not exist
LINE 1: ...e_user"."id" IN (SELECT U1."user_id" AS Col1 FROM "trix_core...
Setuptools was pruning migrations when building for release, so I removed the pruning and uploaded a new build to the 3.0.0b4 release. I do not have access too pypi to release the fix there.
I do not have access too pypi to release the fix there.
I can do releases, but since it's a pre-release and not from master it's safer to have @tworide do it – and perhaps it should be done as 3.0.0b5
?
@torgeirl The 3.0.0b5 pre-release is now available on pypi and ready for testing.
@torgeirl The 3.0.0b5 pre-release is now available on pypi and ready for testing.
$ oc get jobs
NAME COMPLETIONS DURATION AGE
trix-dev-migration 1/1 44s 7s
$ oc logs job.batch/trix-dev-migration
Begin Migration ...
Operations to perform:
Apply all migrations: account, admin, auth, contenttypes, sessions, sites, socialaccount, trix_core
Running migrations:
Applying trix_core.0005_auto_20190818_2150... OK
Migration Completed
It added one «new» migration, and I am no longer able to reproduce the issue! :tada:
Trying to edit admins on a course or in Django admin selection a course gives a HTTP 500:
It seems the migrations for the
trix_core_course_owner
app added in #97 is missing.