class BaseModel(models.Model):
id = models.UUIDField(
primary_key=True, max_length=36, default=uuid.uuid4, editable=False
)
created = models.DateTimeField(auto_now_add=True)
class Meta:
abstract = True
Error output from heroku
Operations to perform:
Apply all migrations: accounts, admin, auth, contenttypes, sessions, token_blacklist
Running migrations:
Applying accounts.0002_user_created_alter_user_id...Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.CannotCoerce: cannot cast type bigint to uuid
LINE 1: ..."accounts_user" ALTER COLUMN "id" TYPE uuid USING "id"::uuid
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 373, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 417, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 90, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 253, in handle
post_migrate_state = executor.migrate(
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 126, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 156, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/executor.py", line 236, in apply_migration
state = migration.apply(state, schema_editor)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/migration.py", line 125, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/migrations/operations/fields.py", line 225, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 618, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type,
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/postgresql/schema.py", line 196, in _alter_field
super()._alter_field(
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 775, in _alter_field
self.execute(
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 151, in execute
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: cannot cast type bigint to uuid
LINE 1: ..."accounts_user" ALTER COLUMN "id" TYPE uuid USING "id"::uuid
^
file at
Error output from heroku