Hi Don,

such warnings occur often. We consider it the responsability of the
database administrator to audit the logs and update the missing required
fields manually for now. When this is done, you can put the constraint
in place with another module upgrade.

To support the database administrator in this task, we envision an
OpenUpgrade service module that reports on these missing fields but work
on it has not yet started.

Best,
Stefan.


** Changed in: openupgrade-addons
       Status: New => Confirmed

** Changed in: openupgrade-addons
   Importance: Undecided => Wishlist

-- 
You received this bug notification because you are a member of
OpenUpgrade Committers, which is the registrant for OpenUpgrade Addons.
https://bugs.launchpad.net/bugs/1025896

Title:
  New parent constraint is violated on document directories

Status in OpenUpgrade Addons:
  Confirmed

Bug description:
  When I try to upgrade from 5.0.16 to 6.0, I get the following error
  (slightly edited):

  [...] ERROR:db.cursor:bad query: ALTER TABLE "document_directory" ADD 
CONSTRAINT "document_directory_dir_parented" check(parent_id IS NOT NULL OR 
storage_id IS NOT NULL)
  Traceback (most recent call last):
    File "[...]/server/upgrade-6.0/bin/sql_db.py", line 131, in execute
      res = self._obj.execute(query, params)
  IntegrityError: check constraint "document_directory_dir_parented" is 
violated by some row

  [...] WARNING:orm.schema:Table 'document_directory': unable to add 
'check(parent_id IS NOT NULL OR storage_id IS NOT NULL)' constraint !
   If you want to have it, you should update the records and execute manually:
  ALTER TABLE "document_directory" ADD CONSTRAINT 
"document_directory_dir_parented" check(parent_id IS NOT NULL OR storage_id IS 
NOT NULL)

  Steps to reproduce:
  1. Create a new database in 5.0 with no sample data and the manufacturing 
industry profile.
  2. Set the view mode to Extended Interface.
  3. Leave the default values for all the other setup steps, and set the chart 
of accounts to "None".
  4. From the Administration menu, choose Modules Management: Modules.
  5. Open the document module and install it. Accept the default settings.
  6. Run the migration using the options, "--update all --stop-after-init". The 
error occurs as listed above.

  The full command line I use for the migration is as follows:
  python openerp-server.py --database migrationtest --update all 
--stop-after-init --addons ~/upgrade-addons-6.0 --config ~/openerp-server.config

  Analysis:
  The constraint depends on values being in the new storage_id field, but it 
has a default value of null.

  Suggested fix:
  In the pre-migration, add the storage_id field without the foreign key, and 
set all records that need a value to use some bogus value. In the 
post-migration, update the bogus value to point at a valid storage record, and 
add the foreign key. I'll add a merge proposal.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openupgrade-addons/+bug/1025896/+subscriptions

-- 
Mailing list: https://launchpad.net/~credativ
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~credativ
More help   : https://help.launchpad.net/ListHelp

Reply via email to