OCA / search-engine

GNU Affero General Public License v3.0
45 stars 60 forks source link

[13.0] connector_algolia: crash caused by migrations/13.0.2.2.0/post-migrate.py #154

Closed alexis-via closed 6 months ago

alexis-via commented 1 year ago

connector_algolia/migrations/13.0.2.2.0/post-migrate.py contains:

set_not_null(cr, "se_backend_algolia", "tech_name")

But, in connector_algolia/models/se_backend_algolia.py, the tech_name field is defined as:

tech_name = fields.Char(related="se_backend_id.tech_name", store=True, readonly=False)

And tech_name doesn't seem to be required, cf https://github.com/OCA/server-env/blob/13.0/server_environment/models/server_env_tech_name_mixin.py#L36 (I'm not sure it's this one, because there are a lot of inherit and mixins...)

Then, during the upgrade, you get this error:

2023-08-18 16:32:30,028 2222103 INFO mig1 odoo.modules.migration: module connector_algolia: Running migration [13.0.2.2.0>] post-migrate
2023-08-18 16:32:30,028 2222103 ERROR mig1 odoo.modules.loading: Error executing post migration script for module connector_algolia
: ('Table %r: unable to set NOT NULL on column %r', 'se_backend_algolia', 'tech_name')   
2023-08-18 16:32:30,033 2222103 ERROR mig1 odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
  File "/home/odoo/migration/13/openupgrade/odoo/tools/sql.py", line 112, in set_not_null
    cr.execute(query, log_exceptions=False)
  File "/home/odoo/migration/13/openupgrade/odoo/sql_db.py", line 173, in wrapper
    return f(self, *args, **kwargs)
  File "/home/odoo/migration/13/openupgrade/odoo/sql_db.py", line 250, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.NotNullViolation: column "tech_name" contains null values
github-actions[bot] commented 7 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.