Trying to make the migration to utf-8 to work. Added all order, products, customers, promotions, quota and subject to classes to be migrated. All of them report 0 items when starting sudo -u apache /usr/local/bin/ruby231 /home/niklaus/git/bbmb/bin/migrate_to_utf_8 config=/var/www/sandoz.bbmb.ch/etc/config.yml
Zeno told me that, the bbmb databases are older than those from ydim. Therefore I am looking at changes in odba which could explain this behaviour.
Comparing the persistence setup of ydim and bbmb. Starting with odba.rb. Looking at bbmb_model_customer_customer_id in sandoz_bbmb-2016-05-17-backup.gz we find many entries. But may be the table bbmb_model_customer_email (origin_id, search_term, target_id) with entries like 3413 11 *@*-pharma.ch 11
is easier to debug.
Running
zgrep -nw 11 /var/backup/fast/db_dumps/sandoz_bbmb-2016-05-17-backup.gz 180:11 4100600427 11 1892:11 7601001004214 11 3413:11 *@*-pharma.ch 11 844426:11 04086f3a1a42424d423a3a4d6f64656c3a3a437573746f6d65721b3a0f406661766f72697465736f3a0f4f4442413a3a53747562093a154072656365697665725f6c6f61646564543a10406f6462615f636c617373631742424d423a3a4d6f64656c3a3a4f726465723a14406f6462615f636f6e7461696e657240003a0d406f6462615f696469133a0e406164647265737333303a14406f6462615f6f6273657276657273303a0b4065616e31332212373630313030313030343231343a0f4066697273746e616d65220c436c61756469613a134063757272656e745f6f726465726f3b07093b08543b0940073b0a40003b0b6902fc743a0b40656d61696c653a27456e636f64696e673a3a4368617261637465723a3a555446383a3a4d6574686f647322266c696c6a616e652e6b6973746c65724073747265756c692d706861726d612e63683a09406661782212303535203238352039322038303a0e406164647265737332303a0d40617263686976656f3b07093b08303b0a40003b0b69123a0e407265636569766572303a0c4071756f7461736f3b07093b08303b0a40003b0b69113b16303a0a4063697479220b557a6e6163683a15406f6462615f70657273697374656e74543a0e40616464726573733122154261686e686f667374726173736520373b0b69103a0b407469746c652209467261753a12406f7267616e69736174696f6e221653747265756c6920506861726d612041473a0f4070726f7465637465647b063a0a656d61696c543a0940706c7a2209383733303a144070686f6e655f627573696e6573732212303535203238352039322039323a1140637573746f6d65725f6964220f343130303630303432373a0e406c6173746e616d65220c53747265756c69 \N t BBMB::Model::Customer 934711:11 12 934712:11 13 934713:11 14 934715:14 11 966573:11 29948 966749:29948 11
But when running bbmb/bin/migrate_to_utf_8 I see in the log FEHLER: Relation �bbmb_model_customer_email� existiert nicht
. Why? DB seems okay as it reports DB used is sandoz_bbmb user: sandoz auth:
. Runing psql -U sandoz sandoz_bbmb --host=localhost
I can debug some entries with:
sandoz_bbmb=# select count(*) from bbmb_model_customer_email; count ------- 331 (1 Zeile) sandoz_bbmb=# \dS bbmb_model_customer_email; Tabelle »public.bbmb_model_customer_email« Spalte | Typ | Attribute -------------+---------+----------- origin_id | integer | search_term | text | target_id | integer | Indexe: "origin_id_bbmb_model_customer_email" btree (origin_id) "search_term_bbmb_model_customer_email" btree (search_term) "target_id_bbmb_model_customer_email" btree (target_id) sandoz_bbmb=# select * from bbmb_model_customer_email where origin_id = '11'; origin_id | search_term | target_id -----------+-----------------------------------+----------- 11 | *@*-pharma.ch | 11 (1 Zeile) sandoz_bbmb=# select count(*) from ydim_autoinvoice_unique_id; count ------- 0 (1 Zeile) sandoz_bbmb=# select count(*) from ydim_debitor_email; count ------- 0 (1 Zeile)
Comparing odba 1.1.0 (which is used on fastpower for sandoz.bbmb.ch) with the current version. Broke into pry where I expected all customers. Calling ODBA.cache.fetch('3')
returns a Hash with 322 entries. And ODBA.cache.fetch('11').class
is YDIM::Debitor. But trying to look at all elements using pry throws errors like ODBA::Stub was unable to replace BBMB::Model::Order#26256 from BBMB::Model::Customer:#21
But ODBA.cache.extent(BBMB::Model::Customer)
returns an empty array [].
It looks as if we can the YDIM classes, but not the bbmb ones
[49] pry(main)> ODBA.cache.extent(YDIM::Debitor).size => 386 [51] pry(main)> ODBA.cache.extent(YDIM::Debitor).first.contact => "Hackethal"
Using the 3 YDIM classes makes me proceed a log furhter, but I am getting 2339 errors NoMethodError: undefined method `keys' for nil:NilClass when updating index
. But I sucessfully migrated
2016-05-23 13:55:23 +0200: Start migrating 362 debitors 2016-05-23 13:55:31 +0200: Start migrating 2299 invoices 2016-05-23 13:56:26 +0200: Start migrating 40 autoinvoices
Must replace in bin/bbmbd VERSION = `cg-object-id`
by VERSION = `git rev-parse HEAD`
. Now I get the sanoz login.
When trying to login, I the in log/error_log
the lines
[Mon May 23 14:27:48 2016] [warn] Unable to load url configuration: can't convert nil into Hash [Mon May 23 14:27:48 2016] [notice] Hint: store configuration in a YAML-File at DOCUMENT_ROOT/../etc/trans_handler.yml
Changed /service/sandoz.bbmb.ch-yus/run
to
#!/bin/sh DIR=/var/www/sandoz.bbmb.ch/ exec 2>&1 exec sudo -u apache /usr/local/bin/ruby231 /usr/local/bin/yusd config=$DIR/etc/yus.yml
and restarted sandoz.bbmb.ch-yus. Now the login fails but return to the original URL. And I see in the file /service/sandoz.bbmb.ch-yus/log/main/current
@400000005742fce739ee0a3c I, [2016-05-23T14:51:41.971769 #9408] INFO -- Yus::Server: Login attempt for ngiger@ywesee.com from ch.bbmb @400000005742fce739f011c4 W, [2016-05-23T14:51:41.971983 #9408] WARN -- Yus::Server: Authentication failed for ngiger@ywesee.com
Trying to add myself as a new root user I get the following error
sudo yus_add_user ngiger@ywesee.com login org.oddb.RootUser Ignoring byebug-8.2.4 because its extensions are not built. Try: gem pristine byebug --version 8.2.4 Ignoring ffi-1.9.10 because its extensions are not built. Try: gem pristine ffi --version 1.9.10 Password for ngiger@ywesee.com: /usr/local/lib/ruby/gems/2.3.0/gems/yus-1.0.2/bin/yus_add_user:60:in `<top (required)>': undefined method `callcc' for main:Object (NoMethodError) from /usr/local/bin/yus_add_user:23:in `load' from /usr/local/bin/yus_add_user:23:in `<main>'