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

Migration base.0067_resourcebase_storetype broken #10752

Closed
3 tasks
etj opened this issue Mar 8, 2023 · 0 comments
Closed
3 tasks

Migration base.0067_resourcebase_storetype broken #10752

etj opened this issue Mar 8, 2023 · 0 comments
Labels
4.0.x 4.1.x major A high priority issue which might affect a lot of people or large parts of the codebase

Comments

@etj
Copy link
Contributor

etj commented Mar 8, 2023

Running migrations:
  Applying base.0067_resourcebase_storetype...Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 82, in _execute
    return self.cursor.execute(sql)
psycopg2.errors.UndefinedColumn: column "storeType" does not exist
LINE 4: FROM (select resourcebase_ptr_id,"storeType" from layers_lay...
                                         ^
HINT:  Perhaps you meant to reference the column "base_resourcebase.storetype".

Migration base.67

  • has as dependency layers.0035_auto_20210525_0847
  • adds field resourcebase.storetype
  • SQL: copies storetype from layers.storetype

Migration layers.0036

  • drops field storetype

Here the error is that in a dependency you can only specify the minimum version needed. Still, it's not said that you could have some more migration applied in the same app, so for sure the dep layers.0035 is satisfied, but also the layers.0036 has already been run, so the copy cannot be carried out.

The dependencies should assure that the field (or data) are where they are expected, so we may want to add a dependency toward the migrations that copies the data before removing the field.

We need to change:

  • layers.0036
    • ensure the data have been copied, so add a dependency to base.0067_resourcebase_storetype
  • base.0067
    • remove the useless dependency to layers.0035

Please also note that an analogous change is needed for documents.

Currently base.0067 is dependent on documents.0032_remove_document_doc_file, which is useless per se, and the author prolly wanted to avoid the execution of documents.0033_remove_document_doc_type which removes the field used in the copy procedures.
Anyway documents.0033_remove_document_doc_type has a dep on base.0067, so it makes sure the data are copied before removing the field.

  • base.0067
    • remove the useless dependency to documents.0032
etj added a commit to etj/geonode that referenced this issue Mar 8, 2023
@etj etj mentioned this issue Mar 8, 2023
12 tasks
giohappy pushed a commit that referenced this issue Mar 8, 2023
* #10747 Migration base/0074_drop_curated_thumbs.py broken

* #10752 Migration base.0067_resourcebase_storetype broken

* #10751 Migration upload/0033_auto_20210527_1520 broken

* #10753 Migration layers.0040_dataset_ows_url broken

* #10755 Some other migrations broken
giohappy pushed a commit that referenced this issue Mar 8, 2023
* #10747 Migration base/0074_drop_curated_thumbs.py broken

* #10752 Migration base.0067_resourcebase_storetype broken

* #10751 Migration upload/0033_auto_20210527_1520 broken

* #10753 Migration layers.0040_dataset_ows_url broken

* #10755 Some other migrations broken
@afabiani afabiani added major A high priority issue which might affect a lot of people or large parts of the codebase 4.0.x 4.1.x labels Mar 8, 2023
@afabiani afabiani closed this as completed Mar 8, 2023
giohappy added a commit that referenced this issue Mar 8, 2023
* #10747 Migration base/0074_drop_curated_thumbs.py broken

* #10752 Migration base.0067_resourcebase_storetype broken

* #10751 Migration upload/0033_auto_20210527_1520 broken

* #10753 Migration layers.0040_dataset_ows_url broken

* #10755 Some other migrations broken

Co-authored-by: Emanuele Tajariol <[email protected]>
github-actions bot pushed a commit that referenced this issue Mar 8, 2023
* #10747 Migration base/0074_drop_curated_thumbs.py broken

* #10752 Migration base.0067_resourcebase_storetype broken

* #10751 Migration upload/0033_auto_20210527_1520 broken

* #10753 Migration layers.0040_dataset_ows_url broken

* #10755 Some other migrations broken

Co-authored-by: Emanuele Tajariol <[email protected]>
(cherry picked from commit 7242030)
giohappy added a commit that referenced this issue Mar 8, 2023
* #10747 Migration base/0074_drop_curated_thumbs.py broken

* #10752 Migration base.0067_resourcebase_storetype broken

* #10751 Migration upload/0033_auto_20210527_1520 broken

* #10753 Migration layers.0040_dataset_ows_url broken

* #10755 Some other migrations broken

Co-authored-by: Emanuele Tajariol <[email protected]>
(cherry picked from commit 7242030)

Co-authored-by: Giovanni Allegri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0.x 4.1.x major A high priority issue which might affect a lot of people or large parts of the codebase
Projects
None yet
Development

No branches or pull requests

2 participants