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

New Installation with sqlite fails migrations #5306

Closed
Matvey-Kuk opened this issue Nov 28, 2024 · 3 comments · Fixed by #5308
Closed

New Installation with sqlite fails migrations #5306

Matvey-Kuk opened this issue Nov 28, 2024 · 3 comments · Fixed by #5308
Labels
bug Something isn't working part:helm/kubernetes/docker

Comments

@Matvey-Kuk
Copy link
Contributor

What went wrong?

Hey, team 👋

Tried to launch OnCall and found that migration is failing on a clean environment if I follow README.md's hobby environment:

oncall_db_migration-1  |   Applying alerts.0069_remove_channelfilter__slack_channel_id_db... OK
oncall_db_migration-1  | Traceback (most recent call last):
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 89, in _execute
oncall_db_migration-1  |     return self.cursor.execute(sql, params)
oncall_db_migration-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
oncall_db_migration-1  |     return super().execute(query, params)
oncall_db_migration-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  | sqlite3.OperationalError: error in index alerts_reso_ts_a9bdf7_idx after drop column: no such column: _slack_channel_id
oncall_db_migration-1  | 
oncall_db_migration-1  | The above exception was the direct cause of the following exception:
oncall_db_migration-1  | 
oncall_db_migration-1  | Traceback (most recent call last):
oncall_db_migration-1  |   File "/etc/app/manage.py", line 34, in <module>
oncall_db_migration-1  |     execute_from_command_line(sys.argv)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
oncall_db_migration-1  |     utility.execute()
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
oncall_db_migration-1  |     self.fetch_command(subcommand).run_from_argv(self.argv)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 412, in run_from_argv
oncall_db_migration-1  |     self.execute(*args, **cmd_options)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 458, in execute
oncall_db_migration-1  |     output = self.handle(*args, **options)
oncall_db_migration-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 106, in wrapper
oncall_db_migration-1  |     res = handle_func(*args, **kwargs)
oncall_db_migration-1  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 356, in handle
oncall_db_migration-1  |     post_migrate_state = executor.migrate(
oncall_db_migration-1  |                          ^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate
oncall_db_migration-1  |     state = self._migrate_all_forwards(
oncall_db_migration-1  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
oncall_db_migration-1  |     state = self.apply_migration(
oncall_db_migration-1  |             ^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
oncall_db_migration-1  |     state = migration.apply(state, schema_editor)
oncall_db_migration-1  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply
oncall_db_migration-1  |     operation.database_forwards(
oncall_db_migration-1  |   File "/etc/app/common/migrations/remove_field.py", line 61, in database_forwards
oncall_db_migration-1  |     super().database_forwards(app_label, schema_editor, from_state, to_state)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/migrations/operations/fields.py", line 170, in database_forwards
oncall_db_migration-1  |     schema_editor.remove_field(
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/schema.py", line 424, in remove_field
oncall_db_migration-1  |     super().remove_field(model, field)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/base/schema.py", line 767, in remove_field
oncall_db_migration-1  |     self.execute(sql)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/base/schema.py", line 201, in execute
oncall_db_migration-1  |     cursor.execute(sql, params)
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 67, in execute
oncall_db_migration-1  |     return self._execute_with_wrappers(
oncall_db_migration-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
oncall_db_migration-1  |     return executor(sql, params, many, context)
oncall_db_migration-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 84, in _execute
oncall_db_migration-1  |     with self.db.wrap_database_errors:
oncall_db_migration-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
oncall_db_migration-1  |     raise dj_exc_value.with_traceback(traceback) from exc_value
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 89, in _execute
oncall_db_migration-1  |     return self.cursor.execute(sql, params)
oncall_db_migration-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  |   File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
oncall_db_migration-1  |     return super().execute(query, params)
oncall_db_migration-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
oncall_db_migration-1  | django.db.utils.OperationalError: error in index alerts_reso_ts_a9bdf7_idx after drop column: no such column: _slack_channel_id
oncall_db_migration-1  |   Applying alerts.0070_remove_resolutionnoteslackmessage__slack_channel_id_db...

As result, plugin can't connect to the engine:

Image

How do we reproduce it?

Follow README.md step-by-step.

Using:

docker-compose -v
Docker Compose version 2.30.3

docker -v 
Docker version 27.3.1, build ce12230

Grafana OnCall Version

1.13.4

Product Area

Helm/Kubernetes/Docker

Grafana OnCall Platform?

Docker

User's Browser?

Doesn't matter

Anything else to add?

No response

@Matvey-Kuk
Copy link
Contributor Author

@joeyorlando I guess this might be the breaking change: #5280

@joeyorlando joeyorlando marked this as a duplicate of #5304 Nov 28, 2024
@joeyorlando joeyorlando changed the title Failing migration broke quickstart from the README.md New Installation with sqlite fails migrations Nov 28, 2024
@Matvey-Kuk
Copy link
Contributor Author

@joeyorlando ❤️

@joeyorlando
Copy link
Contributor

v1.13.5 (which contains the fix from #5308) is being released right now, retry once the release workflow is finished (~15mins)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working part:helm/kubernetes/docker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants