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

Error when updating to v1.3.48 with django migration script #3222

Closed
spedou opened this issue Oct 31, 2023 · 5 comments · Fixed by #3260
Closed

Error when updating to v1.3.48 with django migration script #3222

spedou opened this issue Oct 31, 2023 · 5 comments · Fixed by #3260
Assignees
Labels
bug Something isn't working more info needed

Comments

@spedou
Copy link

spedou commented Oct 31, 2023

What went wrong?

Hello!

When updating the oncall-engine deployement to v1.3.48, I get this error trace on the django database migrations job

 File "/usr/local/lib/python3.11/site-packages/django/db/migrations/operations/fields.py", line 235, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 830, in alter_field
    self._alter_field(
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/schema.py", line 287, in _alter_field
    super()._alter_field(
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 1055, in _alter_field
    self.execute(
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
    return super().execute(sql, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
           ^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.ProgrammingError: cannot cast type integer to jsonb
LINE 1: ..." TYPE jsonb USING "going_oncall_notification_timing"::jsonb
                                                                ^

  Applying mobile_app.0011_alter_mobileappusersettings_going_oncall_notification_timing...

command : python manage.py migrate

I think this is due to this PR : #3103

Grafana OnCall Version

v1.3.48

Product Area

Other

Grafana OnCall Platform?

Kubernetes

User's Browser?

No response

Anything else to add?

No response

@spedou spedou added the bug Something isn't working label Oct 31, 2023
@max9933
Copy link

max9933 commented Nov 1, 2023

Can confirm experiencing the same issue when updating, having to stick on 1.3.43 currently

@agilob
Copy link

agilob commented Nov 2, 2023

Still here 4 minor releases later

+ release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 › oncall-migrate
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate postgresql.database (10.43.114.118:5432) open
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate Operations to perform:
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   Apply all migrations: admin, alerts, auth, auth_token, base, contenttypes, email, fcm_django, heartbeat, labels, mobile_app, oss_installation, phone_notifications, schedules, sessions, slack, social_django, telegram, twilioapp, user_management, webhooks, zvonok
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate Running migrations:
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate Traceback (most recent call last):
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     return self.cursor.execute(sql)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate            ^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate psycopg2.errors.CannotCoerce: cannot cast type integer to jsonb
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate LINE 1: ..." TYPE jsonb USING "going_oncall_notification_timing"::jsonb
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate                                                                 ^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate The above exception was the direct cause of the following exception:
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate Traceback (most recent call last):
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/etc/app/manage.py", line 15, in <module>
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     execute_from_command_line(sys.argv)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     utility.execute()
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     self.fetch_command(subcommand).run_from_argv(self.argv)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     self.execute(*args, **cmd_options)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     output = self.handle(*args, **options)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     res = handle_func(*args, **kwargs)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     post_migrate_state = executor.migrate(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate                          ^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/migrations/executor.py", line 135, in migrate
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     state = self._migrate_all_forwards(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     state = self.apply_migration(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate             ^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     state = migration.apply(state, schema_editor)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/migrations/migration.py", line 132, in apply
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     operation.database_forwards(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/migrations/operations/fields.py", line 235, in database_forwards
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     schema_editor.alter_field(from_model, from_field, to_field)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 830, in alter_field
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     self._alter_field(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/schema.py", line 287, in _alter_field
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     super()._alter_field(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 1055, in _alter_field
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     self.execute(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     return super().execute(sql, None)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate            ^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/schema.py", line 201, in execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     cursor.execute(sql, params)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     return self._execute_with_wrappers(
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     return executor(sql, params, many, context)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     with self.db.wrap_database_errors:
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     raise dj_exc_value.with_traceback(traceback) from exc_value
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate     return self.cursor.execute(sql)
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate            ^^^^^^^^^^^^^^^^^^^^^^^^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate django.db.utils.ProgrammingError: cannot cast type integer to jsonb
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate LINE 1: ..." TYPE jsonb USING "going_oncall_notification_timing"::jsonb
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate                                                                 ^
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate
release-oncall-engine-migrate-2023-11-02-14-34-07-qjfp7 oncall-migrate   Applying mobile_app.0011_alter_mobileappusersettings_going_oncall_notification_timing...

@Ferril Ferril self-assigned this Nov 2, 2023
github-merge-queue bot pushed a commit that referenced this issue Nov 2, 2023
# What this PR does
Fixes bd migration

## Which issue(s) this PR fixes
Closes #3222

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
@joeyorlando
Copy link
Contributor

👋 thanks for reporting this, a fix for this was added in #3260. Keep an eye out for the next release which should come out (hopefully) before the end of the week

@agilob
Copy link

agilob commented Nov 3, 2023

thanks 👍

@joeyorlando
Copy link
Contributor

hi there, a fix for this was included in v1.3.53 (just released). Feel free to open a separate issue if you're still running into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more info needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants