Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrations issue w/ docker instructions #103

Open
whatSocks opened this issue Jun 18, 2022 · 1 comment
Open

migrations issue w/ docker instructions #103

whatSocks opened this issue Jun 18, 2022 · 1 comment

Comments

@whatSocks
Copy link
Contributor

whatSocks commented Jun 18, 2022

Describe the bug

there seems to be a missing migration on the docker instructions. I can try to work around it.

to get around this issue, i changed

default=django.utils.timezone.now

to

default=1

in the migrations file.

here's the error:

 Applying main.0002_auto_20220618_1234...Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 1774, in get_prep_value
    return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/backend/RxcVoiceApi/./manage.py", line 22, in <module>
    main()
  File "/backend/RxcVoiceApi/./manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 243, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/operations/fields.py", line 104, in database_forwards
    schema_editor.add_field(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 455, in add_field
    definition, params = self.column_sql(model, field, include_default=True)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 223, in column_sql
    default_value = self.effective_default(field)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 303, in effective_default
    return field.get_db_prep_save(self._effective_default(field), self.connection)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related.py", line 971, in get_db_prep_save
    return self.target_field.get_db_prep_save(value, connection=connection)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 823, in get_db_prep_save
    return self.get_db_prep_value(value, connection=connection, prepared=False)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 2388, in get_db_prep_value
    value = self.get_prep_value(value)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 1776, in get_prep_value
    raise e.__class__(
TypeError: Field 'id' expected a number but got datetime.datetime(2022, 6, 18, 16, 42, 30, 390586, tzinfo=<UTC>).
@alexrandaccio
Copy link
Member

alexrandaccio commented Jun 22, 2022

@whatSocks thanks for posting the logs!

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

No branches or pull requests

2 participants