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

[10.0] missing foreign keys #18880

Closed
flotho opened this issue Aug 16, 2017 · 6 comments
Closed

[10.0] missing foreign keys #18880

flotho opened this issue Aug 16, 2017 · 6 comments

Comments

@flotho
Copy link
Contributor

flotho commented Aug 16, 2017

Impacted versions:
Latest git pulled on the community edition

Steps to reproduce:
create a fresh deb

Current behavior:
in the tables (ir_ui_view) no more foreign key is referenced for inherit_id

Expected behavior:
Foreign keys to be kept

@flotho
Copy link
Contributor Author

flotho commented Aug 17, 2017

Hi @nim-odoo , @mart-e ,

Could we have a review on this. I made additionnal tests and comparison on the same machine
I'm working for all my tests with :

  • psycopg2 (2.7.3)
  • psql (9.6.3, serveur 9.4.12)

I tested with a odoo v9 to create a fresh DB and there was FK in the tables.
I tested with 10.0 0888602 and I have this in the logs :

 'res_users': added foreign key 'write_uid' with definition=REFERENCES "res_users" ON DELETE set null
2017-08-17 09:59:25,415 15265 DEBUG genericv10 odoo.models.schema: Table 'res_users': added foreign key 'partner_id' with definition=REFERENCES "res_partner" ON DELETE restrict
2017-08-17 09:59:25,418 15265 DEBUG genericv10 odoo.models.schema: Table 'res_users': added foreign key 'create_uid' with definition=REFERENCES "res_users" ON DELETE set null
2017-08-17 09:59:25,419 15265 DEBUG genericv10 odoo.models.schema: Table 'res_users': added foreign key 'company_id' with definition=REFERENCES "res_company" ON DELETE set null
2017-08-17 09:59:25,424 15265 INFO genericv10 odoo.addons.auth_crypt.models.res_users: Hashing passwords, may be slow for databases with many users...
2017-08-17 09:59:25,436 15265 INFO genericv10 odoo.modules.loading: loading web_settings_dashboard/views/dashboard_views.xml

yet no FK in the tables. The behaviour is not the same as the v9. Is there any kind of deferred operations in transactions?

@mart-e
Copy link
Contributor

mart-e commented Aug 17, 2017

$ psql --version
psql (PostgreSQL) 9.6.3
$ python2 -c "import psycopg2; print psycopg2.__version__"
2.7.3 (dt dec pq3 ext lo64)


10c=# \d ir_ui_view
                                       Table "public.ir_ui_view"
    Column     |            Type             |                        Modifiers                        
---------------+-----------------------------+---------------------------------------------------------
 id            | integer                     | not null default nextval('ir_ui_view_id_seq'::regclass)
 create_date   | timestamp without time zone | 
 write_date    | timestamp without time zone | 
 write_uid     | integer                     | 
 field_parent  | character varying           | 
 inherit_id    | integer                     | 
 model_data_id | integer                     | 
 priority      | integer                     | not null
 type          | character varying           | 
 arch_db       | text                        | 
 create_uid    | integer                     | 
 key           | character varying           | 
 active        | boolean                     | 
 arch_fs       | character varying           | 
 name          | character varying           | not null
 mode          | character varying           | not null
 model         | character varying           | 
Indexes:
    "ir_ui_view_pkey" PRIMARY KEY, btree (id)
    "ir_ui_view_inherit_id_index" btree (inherit_id)
    "ir_ui_view_model_index" btree (model)
    "ir_ui_view_model_type_inherit_id" btree (model, inherit_id)
Check constraints:
    "ir_ui_view_inheritance_mode" CHECK (mode::text <> 'extension'::text OR inherit_id IS NOT NULL)
Foreign-key constraints:
    "ir_ui_view_create_uid_fkey" FOREIGN KEY (create_uid) REFERENCES res_users(id) ON DELETE SET NULL
    "ir_ui_view_inherit_id_fkey" FOREIGN KEY (inherit_id) REFERENCES ir_ui_view(id) ON DELETE RESTRICT
    "ir_ui_view_model_data_id_fkey" FOREIGN KEY (model_data_id) REFERENCES ir_model_data(id) ON DELETE SET NULL
    "ir_ui_view_write_uid_fkey" FOREIGN KEY (write_uid) REFERENCES res_users(id) ON DELETE SET NULL
Referenced by:
....

Sorry but I have foreign key on all my databases.

@mart-e mart-e changed the title [10.0]Where are the foreign keys? HOT! [10.0] Where are the foreign keys? Aug 17, 2017
@mart-e mart-e changed the title [10.0] Where are the foreign keys? [10.0] missing foreign keys Aug 17, 2017
@flotho
Copy link
Contributor Author

flotho commented Aug 17, 2017

I also checked my "older version" of db created in v10 and I have some with foreign keys in it.
really strange that new DB for v10 only are not creating FK
@mart-e what is your server version?

@flotho
Copy link
Contributor Author

flotho commented Aug 17, 2017

@mart-e , you're right, I'm suspecting additionnal repos and let you know

@flotho
Copy link
Contributor Author

flotho commented Aug 17, 2017

Hi @mart-e , this one was tricky but really don't seems to be an Odoo core one but a conflict with an OCA repos

@flotho flotho closed this as completed Aug 17, 2017
@mart-e
Copy link
Contributor

mart-e commented Aug 18, 2017

Thank you for the update, don't worry, we have not removed the foreign key 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants