I have a fresh Install of Wagtail (4.0.1) and Django (4.1.1).
When creating the first tenant, there is a database migration error.
Maybe you have an idea about this?
(env) C:\Users\ano\coding>manage.py create_tenant
schema name: web1
name: web1
paid until: 2022-12-31
on trial: False
[1/1 (100%) standard:web1] === Starting migration
[1/1 (100%) standard:web1] Operations to perform:
[1/1 (100%) standard:web1] Apply all migrations: admin, auth, contenttypes, customers, home, sessions, taggit, users, wagtail_tenants, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
[1/1 (100%) standard:web1] Running migrations:
[1/1 (100%) standard:web1] Applying customers.0001_initial...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying contenttypes.0001_initial...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying contenttypes.0002_remove_content_type_name...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0001_initial...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0002_alter_permission_name_max_length...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0003_alter_user_email_max_length...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0004_alter_user_username_opts...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0005_alter_user_last_login_null...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0006_require_contenttypes_0002...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0007_alter_validators_add_error_messages...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0008_alter_user_username_max_length...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0009_alter_user_last_name_max_length...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0010_alter_group_name_max_length...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0011_update_proxy_permissions...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying auth.0012_alter_user_first_name_max_length...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtail_tenants.0001_initial...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying admin.0001_initial...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying admin.0002_logentry_remove_auto_add...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying admin.0003_logentry_add_action_flag_choices...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying customers.0002_clientbackup...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying customers.0003_alter_clientbackup_created_at...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0001_squashed_0016_change_page_url_path_to_text_field...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0017_change_edit_page_permission_description...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0018_pagerevision_submitted_for_moderation_index...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0019_verbose_names_cleanup...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0020_add_index_on_page_first_published_at...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0021_capitalizeverbose...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0022_add_site_name...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0023_alter_page_revision_on_delete_behaviour...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0024_collection...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0025_collection_initial_data...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0026_group_collection_permission...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0027_fix_collection_path_collation...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0024_alter_page_content_type_on_delete_behaviour...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0028_merge...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0029_unicode_slugfield_dj19...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0030_index_on_pagerevision_created_at...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0031_add_page_view_restriction_types...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0032_add_bulk_delete_page_permission...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0033_remove_golive_expiry_help_text...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0034_page_live_revision...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0035_page_last_published_at...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0036_populate_page_last_published_at...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0037_set_page_owner_editable...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0038_make_first_published_at_editable...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0039_collectionviewrestriction...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying wagtailcore.0040_page_draft_title...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying home.0001_initial...
[1/1 (100%) standard:web1] OK
[1/1 (100%) standard:web1] Applying home.0002_create_homepage...
Traceback (most recent call last):
File "C:\Users\ano\coding\env\lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "wagtailcore_pagerevision" does not exist
LINE 1: ...ge_id", "wagtailcore_pagerevision"."user_id" FROM "wagtailco...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\ano\coding\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\management\commands\create_tenant.py", line 69, in handle
tenant = self.store_tenant(**tenant_data)
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\management\commands\create_tenant.py", line 106, in store_tenant
tenant = get_tenant_model().objects.create(**fields)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\query.py", line 671, in create
obj.save(force_insert=True, using=self.db)
File "C:\Users\ano\coding\env\lib\site-packages\wagtail_tenants\customers\models.py", line 18, in save
super(Client, self).save(*args, **kwargs)
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\models.py", line 111, in save
self.create_schema(check_if_exists=True, verbosity=verbosity)
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\models.py", line 198, in create_schema
call_command('migrate_schemas',
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\__init__.py", line 198, in call_command
return command.execute(*args, **defaults)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\management\commands\migrate_schemas.py", line 77, in handle
executor.run_migrations(tenants=tenants)
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\migration_executors\standard.py", line 14, in run_migrations
run_migrations(self.args, self.options, self.codename, schema_name, idx=idx, count=len(tenants))
File "C:\Users\ano\coding\env\lib\site-packages\django_tenants\migration_executors\base.py", line 53, in run_migrations
MigrateCommand(stdout=stdout, stderr=stderr).execute(*args, **options)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\base.py", line 96, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\ano\coding\env\lib\site-packages\django\core\management\commands\migrate.py", line 349, in handle
post_migrate_state = executor.migrate(
File "C:\Users\ano\coding\env\lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
File "C:\Users\ano\coding\env\lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
File "C:\Users\ano\coding\env\lib\site-packages\django\db\migrations\executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\migrations\migration.py", line 130, in apply
operation.database_forwards(
File "C:\Users\ano\coding\env\lib\site-packages\django\db\migrations\operations\special.py", line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File "C:\Users\ano\coding\home\migrations\0002_create_homepage.py", line 14, in create_homepage
Page.objects.filter(id=2).delete()
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\query.py", line 1131, in delete
collector.collect(del_query)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\deletion.py", line 343, in collect
if sub_objs:
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\query.py", line 408, in __bool__
self._fetch_all()
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\query.py", line 1866, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\query.py", line 87, in __iter__
results = compiler.execute_sql(
File "C:\Users\ano\coding\env\lib\site-packages\django\db\models\sql\compiler.py", line 1395, in execute_sql
cursor.execute(sql, params)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\backends\utils.py", line 103, in execute
return super().execute(sql, params)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
File "C:\Users\ano\coding\env\lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\ano\coding\env\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "C:\Users\ano\coding\env\lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\ano\coding\env\lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "wagtailcore_pagerevision" does not exist
LINE 1: ...ge_id", "wagtailcore_pagerevision"."user_id" FROM "wagtailco...
^
bug