Last active
November 13, 2024 14:57
-
-
Save kerbrose/a3655d6307e00bbc5ad62131031d1e49 to your computer and use it in GitHub Desktop.
useful psql commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # used to delete a view that contains a removed field | |
| delete from ir_ui_view where position('FIELD_NAME' in arch_db)>0; | |
| # in odoo 16 ir_ui_view becomes a jsonb | |
| delete from ir_ui_view where arch_db->>'en_US' ilike '%FIELD_NAME%' ; | |
| update ir_ui_view set active = FALSE where position('FIELD_NAME' in arch_db)>0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import psycopg2 | |
| conn = psycopg2.connect("dbname=DBNAME user=USER") | |
| cur = conn.cursor() | |
| _1399 = ''' THE VIEW ''' | |
| cur.execute("""UPDATE ir_ui_view SET arch_db =%s WHERE id in (1399);""", (_1399,)) | |
| conn.commit() | |
| cur.close() | |
| conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment