catmaid / CATMAID

Collaborative Annotation Toolkit for Massive Amounts of Image Data
https://catmaid.org
GNU General Public License v3.0
188 stars 57 forks source link

Failed migration `catmaid.0099_make_concept_ids_64_bit` #2063

Closed lanery closed 3 years ago

lanery commented 3 years ago

I have a migration that is failing after updating my CATMAID instance.

(catmaid) [catmaid@sonic django]$ ./projects/manage.py migrate
INFO 2021-02-11 18:52:07,602 CATMAID version 2018.11.09-1660-gce1dee4
WARNING 2021-02-11 18:52:08,251 NeuroML module could not be loaded.
WARNING 2021-02-11 18:52:08,506 CATMAID was unable to load the Rpy2 library, which is an optional dependency. Nblast support is therefore disabled.
WARNING 2021-02-11 18:52:08,507 CATMAID was unable to load the Pandas lirary, which is an optional dependency. Nblast support is therefore disabled.
INFO 2021-02-11 18:52:08,563 Spatial update events disabled
INFO 2021-02-11 18:52:08,690 History tracking enabled
System check identified some issues:

WARNINGS:
?: Couldn't check spatial update notification setup, missing database functions
        HINT: Migrate CATMAID
?: The output folder  is not writable
        HINT: Make sure the user running CATMAID can write to the output directory or change the MEDIA_ROOT setting.
Operations to perform:
  Apply all migrations: admin, auth, authtoken, catmaid, contenttypes, guardian, performancetests, pgcompat, sessions, sites, taggit
Running migrations:
  Applying catmaid.0058_add_pg_trgm_ext_and_class_instance_name_index... OK
  Applying catmaid.0059_add_node_query_grid_cache... OK
  Applying catmaid.0060_remove_segmentation_tool... OK
  Applying catmaid.0061_add_subset_field_to_nblastsample... OK
  Applying catmaid.0062_update_stack_metadata_comment_and_stackmirror_choices... OK
  Applying catmaid.0063_add_additional_neuron_similarity_fields... OK
  Applying catmaid.0064_add_project_cascading_delete_constraints... OK
  Applying catmaid.0065_add_extra_nblast_similarity_fields... OK
  Applying catmaid.0066_update_volume_geometry_field_type... OK
  Applying catmaid.0067_add_groupinactivityperiods... OK
  Applying catmaid.0068_add_annotate_with_token_permission... OK
  Applying catmaid.0069_fix_on_edit_treenode_connector_update_edges... OK
  Applying catmaid.0070_fix_change_request_treenode_reference... OK
  Applying catmaid.0071_fix_more_location_table_references... OK
  Applying catmaid.0070_remove_pg10_bug_workaround... OK
  Applying catmaid.0072_merge_maintenance_branch_migrations... OK
  Applying catmaid.0073_make_skeleton_summary_update_more_modular... OK
  Applying catmaid.0074_update_nblast_fields... OK
  Applying catmaid.0075_add_transaction_info_exec_time_index... OK
  Applying catmaid.0076_fix_skeleton_summary_update_fn... OK
  Applying catmaid.0077_add_edge_update_function... OK
  Applying catmaid.0078_add_order_column_to_node_grid_cache... OK
  Applying catmaid.0079_add_volume_area_volume_watertight_columns... OK
  Applying catmaid.0080_add_class_instance_name_index... OK
  Applying catmaid.0081_add_more_skeleton_summary_indices... OK
  Applying catmaid.0082_add_parent_node_to_treenode_edge... OK
  Applying catmaid.0083_add_datasource_and_skeletonorigin_tables... OK
  Applying catmaid.0084_add_source_project_id_column_to_data_source... OK
  Applying catmaid.0085_prepare_django_auth_user_update... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying catmaid.0086_complete_django_auth_user_update... OK
  Applying catmaid.0087_add_nblast_normalization_mode... OK
  Applying catmaid.0088_connector_geom_fix_bigint... OK
  Applying catmaid.0089_fix_treenode_connector_edge_foreign_key_types... OK
  Applying catmaid.0090_fix_change_reques_ids... OK
  Applying catmaid.0091_fix_history_view_helper... OK
  Applying catmaid.0092_make_history_trigger_functions_consistent... OK
  Applying catmaid.0093_add_primary_group_field_to_user_profile... OK
  Applying catmaid.0094_add_imported_cable_length_stats_summary_column... OK
  Applying catmaid.0095_create_can_fork_permission... OK
  Applying catmaid.0096_optimize_history_tracking... OK
  Applying catmaid.0097_add_num_imported_nodes_to_summary_and_optimize_edge_update... OK
  Applying catmaid.0098_make_primary_group_optional... OK
  Applying catmaid.0099_make_concept_ids_64_bit...Traceback (most recent call last):
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.SyntaxError: syntax error at or near "INCLUDE"
LINE 180:         CONSTRAINT class_id_pkey PRIMARY KEY (id) INCLUDE (p...
                                                            ^

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

Traceback (most recent call last):
  File "./projects/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 233, in handle
    fake_initial=fake_initial,
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/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 "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/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 "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/migrations/operations/special.py", line 105, in database_forwards
    self._run_sql(schema_editor, self.sql)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/migrations/operations/special.py", line 130, in _run_sql
    schema_editor.execute(statement, params=None)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 142, in execute
    cursor.execute(sql, params)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/catmaid/miniconda/envs/catmaid/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: syntax error at or near "INCLUDE"
LINE 180:         CONSTRAINT class_id_pkey PRIMARY KEY (id) INCLUDE (p...

Running python 3.6 and postgreSQL 10.10.

Edit:

I now see PostgreSQL >= 11 is required. Will try updating...

lanery commented 3 years ago

Updating to PostgreSQL 12 resolved the issue.