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

[16.0] fatturapa_out Update pre-migrate.py #3915

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion l10n_it_fatturapa_out/migrations/16.0.1.0.9/pre-migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def migrate(env, version):
""",
(table_name, "%s" % constraint_name),
)
result = env.cr.fetchall()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probabilmente il vincolo wizard_export_fatturapa_report_print_menu_fkey dopo b32a0b6#diff-914565354eea6151b103fe044fbc59e9406e4df75dd4143da361a2873a4c246e non esisterà più, ma potrebbero esserci dei DB vecchi che lo hanno ancora.

LGTM


if env.cr.fetchall()[0]:
if result and result[0]:
alter_table_sql = sql.SQL("ALTER TABLE {} DROP CONSTRAINT {}").format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forse si può semplificare il tutto con
ALTER TABLE wizard_export_fatturapa DROP CONSTRAINT IF EXIST wizard_export_fatturapa_report_print_menu_fkey.
Così la query precedente manco serve, giusto?
(ho verificato, IF EXIST è stato introdotto in pg 9.0, Odoo 16 richiede minimo 10).

sql.Identifier(table_name), sql.Identifier(constraint_name)
)
Expand Down
Loading