Skip to content
This repository has been archived by the owner on Jun 17, 2019. It is now read-only.

Phone number primary key collision when importing ActionKit data with phonenumber #4

Open
benjycook opened this issue Jun 14, 2017 · 0 comments

Comments

@benjycook
Copy link
Contributor

Result when trying to run:
Identity::Importer::Tasks::ActionKit::Members.run

@hiemanshu you have access to the Zazim Identity heroku project, feel free to run/test from there.

irb(main):001:0> PhoneNumber.all
=> #<ActiveRecord::Relation []>
irb(main):002:0> Identity::Importer::Tasks::ActionKit::Members.run
   INFO - 14/Jun/2017 13:15:18 Loading member cache
   INFO - 14/Jun/2017 13:15:18 Loading member cache done (0 of them)
I, [2017-06-14T13:15:18.647248 #4]  INFO -- : Trying to connect to a MySQL DB
I, [2017-06-14T13:15:21.711683 #4]  INFO -- : Connected to MySQL database
   INFO - 14/Jun/2017 13:15:22 Received 24220 members from upstream database
   INFO - 14/Jun/2017 13:15:23 Start importing members batch (of 1000)
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "phone_numbers_pkey"
DETAIL:  Key (id)=(333) already exists.
: INSERT INTO "phone_numbers" ("id","member_id","phone","created_at","updated_at","type") VALUES (333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(334,NULL,'972503536371','2017-06-14 13:15:23.064152','2017-06-14 13:15:26.461655',NULL),(335,NULL,'972507904334','2017-06-14 13:15:23.070197','2017-06-14 13:15:26.461655',NULL),(335,NULL,'972507904334','2017-06-14 13:15:23.070197','2017-06-14 13:15:26.461655',NULL),(334,NULL,'972503536371','2017-06-14 13:15:23.064152','2017-06-14 13:15:26.461655',NULL),(336,NULL,'972526790242','2017-06-14 13:15:23.087411','2017-06-14 13:15:26.461655',NULL),(337,NULL,'972523729299','2017-06-14 13:15:23.095217','2017-06-14 13:15:26.461655',NULL),(338,NULL,'972544465979','2017-06-14 13:15:23.103665','2017-06-14 13:15:26.461655',NULL),(339,NULL,'972507638568','2017-06-14 13:15:23.112149','2017-06-14 13:15:26.461655',NULL),(340,NULL,'972505579300','2017-06-14 13:15:23.121296','2017-06-14 13:15:26.461655',NULL),(341,NULL,'972544655091','2017-06-14 13:15:23.134468','2017-06-14 13:15:26.461655',NULL),(333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(342,NULL,'972502333086','2017-06-14 13:15:23.146932','2017-06-14 13:15:26.461655',NULL),(343,NULL,'972502978413','2017-06-14 13:15:23.154799','2017-06-14 13:15:26.461655',NULL),(344,NULL,'972544702018','2017-06-14 13:15:23.161997','2017-06-14 13:15:26.461655',NULL),(345,NULL,'972523374854','2017-06-14 13:15:23.171108','2017-06-14 13:15:26.461655',NULL),(346,NULL,'972522751261','2017-06-14 13:15:23.184095','2017-06-14 13:15:26.461655',NULL),(347,NULL,'972528480543','2017-06-14 13:15:23.195284','2017-06-14 13:15:26.461655',NULL),(348,NULL,'972523401478','2017-06-14 13:15:23.209042','2017-06-14 13:15:26.461655',NULL),(349,NULL,'972507984012','2017-06-14 13:15:23.223126','2017-06-14 13:15:26.461655',NULL),(350,NULL,'972547483220','2017-06-14 13:15:23.232361','2017-06-14 13:15:26.461655',NULL),(351,NULL,'972502244123','2017-06-14 13:15:23.242202','2017-06-14 13:15:26.461655',NULL),(352,NULL,'972502313870','2017-06-14 13:15:23.251023','2017-06-14 13:15:26.461655',NULL),(353,NULL,'972522442531','2017-06-14 13:15:23.261103','2017-06-14 13:15:26.461655',NULL),(354,NULL,'972544789877','2017-06-14 13:15:23.268777','2017-06-14 13:15:26.461655',NULL),(355,NULL,'972544519520','2017-06-14 13:15:23.275894','2017-06-14 13:15:26.461655',NULL),(356,NULL,'972542344884','2017-06-14 13:15:23.282652','2017-06-14 13:15:26.461655',NULL),(357,NULL,'97249531093','2017-06-14 13:15:23.291841','2017-06-14 13:15:26.461655',NULL),(358,NULL,'97289472447','2017-06-14 13:15:23.299451','2017-06-14 13:15:26.461655',NULL),(359,NULL,'972523937984','2017-06-14 13:15:23.320262','2017-06-14 13:15:26.461655',NULL),(360,NULL,'97235280094','2017-06-14 13:15:23.328137','2017-06-14 13:15:26.461655',NULL),(361,NULL,'972543060656','2017-06-14 13:15:23.339282','2017-06-14 13:15:26.461655',NULL),(333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(362,NULL,'972544435397','2017-06-14 13:15:23.363845','2017-06-14 13:15:26.461655',NULL),(363,NULL,'972522533929','2017-06-14 13:15:23.371283','2017-06-14 13:15:26.461655',NULL),(364,NULL,'97299523261','2017-06-14 13:15:23.379177','2017-06-14 13:15:26.461655',NULL),(365,NULL,'97289270674','2017-06-14 13:15:23.391130','2017-06-14 13:15:26.461655',NULL),(366,NULL,'97225793608','2017-06-14 13:15:23.400915','2017-06-14 13:15:26.461655',NULL),(367,NULL,'972506473310','2017-06-14 13:15:23.415405','2017-06-14 13:15:26.461655',NULL),(368,NULL,'972506235260','2017-06-14 13:15:23.428466','2017-06-14 13:15:26.461655',NULL),(369,NULL,'972546710630','2017-06-14 13:15:23.438225','2017-06-14 13:15:26.461655',NULL),(370,NULL,'972549732104','2017-06-14 13:15:23.446240','2017-06-14 13:15:26.461655',NULL),(333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(371,NULL,'972524737722','2017-06-14 13:15:23.464218','2017-06-14 13:15:26.461655',NULL),(372,NULL,'97299508052','2017-06-14 13:15:23.474323','2017-06-14 13:15:26.461655',NULL),(373,NULL,'972528322962','2017-06-14 13:15:23.486201','2017-06-14 13:15:26.461655',NULL),(374,NULL,'972523626760','2017-06-14 13:15:23.496310','2017-06-14 13:15:26.461655',NULL),(375,NULL,'972507983991','2017-06-14 13:15:23.502840','2017-06-14 13:15:26.461655',NULL),(376,NULL,'972533406503','2017-06-14 13:15:23.513370','2017-06-14 13:15:26.461655',NULL),(377,NULL,'972544797426','2017-06-14 13:15:23.526423','2017-06-14 13:15:26.461655',NULL),(378,NULL,'972528674811','2017-06-14 13:15:23.534803','2017-06-14 13:15:26.461655',NULL),(379,NULL,'972508900220','2017-06-14 13:15:23.542984','2017-06-14 13:15:26.461655',NULL),(333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(380,NULL,'972528884998','2017-06-14 13:15:23.568965','2017-06-14 13:15:26.461655',NULL),(381,NULL,'972526856020','2017-06-14 13:15:23.579047','2017-06-14 13:15:26.461655',NULL),(382,NULL,'972522492307','2017-06-14 13:15:23.605595','2017-06-14 13:15:26.461655',NULL),(383,NULL,'972525720222','2017-06-14 13:15:23.623166','2017-06-14 13:15:26.461655',NULL),(384,NULL,'972542550085','2017-06-14 13:15:23.629999','2017-06-14 13:15:26.461655',NULL),(385,NULL,'972525461334','2017-06-14 13:15:23.636992','2017-06-14 13:15:26.461655',NULL),(386,NULL,'972544704080','2017-06-14 13:15:23.643880','2017-06-14 13:15:26.461655',NULL),(387,NULL,'972503501235','2017-06-14 13:15:23.650387','2017-06-14 13:15:26.461655',NULL),(388,NULL,'972509323825','2017-06-14 13:15:23.656403','2017-06-14 13:15:26.461655',NULL),(389,NULL,'972526040165','2017-06-14 13:15:23.662227','2017-06-14 13:15:26.461655',NULL),(390,NULL,'972506801575','2017-06-14 13:15:23.683573','2017-06-14 13:15:26.461655',NULL),(391,NULL,'972522728415','2017-06-14 13:15:23.690831','2017-06-14 13:15:26.461655',NULL),(333,NULL,'','2017-06-14 13:15:23.053595','2017-06-14 13:15:26.461655',NULL),(392,NULL,'972585002670','2017-06-14 13:15:23.712473','2017-06-14 13:15:26.461655',NULL),(393,NULL,'972509466774','2017-06-14 13:15:23.723838','2017-06-14 13:15:26.461655',NULL),(394,NULL,'972585300910','2017-06-14 13:15:23.730902','2017-06-14 13:15:26.461655',NULL),(395,NULL,'972544440994','2017-06-14 13:15:23.740571','2017-06-14 13:15:26.461655',NULL),(396,NULL,'972547263566','2017-06-14 13:15:23.747729','2017-06-14 13:15:26.461655',NULL),(397,NULL,'972544663360','2017-06-14 13:15:23.760429','2017-06-14 13:15:26.461655',NULL),(398,NULL,'972508619317','2017-06-14 13:15:23.766852','2017-06-14 13:15:26.461655',NULL),(399,NULL,'972544533986','2017-06-14 13:15:23.774046','2017-06-14 13:15:26.461655',NULL),(400,NULL,'972503833984','2017-06-14 13:15:23.781107','2017-06-14 13:15:26.461655',NULL),(401,NULL,'972544603274','2017-06-14 13:15:23.788869','2017-06-14 13:15:26.461655',NULL),(402,NULL,'972547668607','2017-06-14 13:15:23.796767','2017-06-14 13:15:26.461655',NULL),(403,NULL,'972502177699','2017-06-14 13:15:23.803455','2017-06-14 13:15:26.461655',NULL),(404,NULL,'972503583465','2017-06-14 13:15:23.811945','2017-06-14 13:15:26.461655',NULL),(405,NULL,'972544567170','2017-06-14 13:15:23.819586','2017-06-14 13:15:26.461655',NULL),(406,NULL,'972506414525','2017-06-14 13:15:23.831543','2017-06-14 13:15:26.461655',NULL),(407,NULL,'972522589673','2017-06-14 13:15:23.838448','2017-06-14 13:15:26.461655',NULL),(408,NULL,'972585884117','2017-06-14 13:15:23.846710','2017-06-14 13:15:26.461655',NULL),(409,NULL,'972545428544','2017-06-14 13:15:23.856923','2017-06-14 13:15:26.461655',NULL),(410,NULL,'972522903377','2017-06-14 13:15:23.864342','2017-06-14 13:15:26.461655',NULL),(411,NULL,'972526790011','2017-06-14 13:15:23.873325','2017-06-14 13:15:26.461655',NULL),(412,NULL,'97236408553','2017-06-14 13:15:23.888284','2017-06-14 13:15:26.461655',NULL),(413,NULL,'972548077663','2017-06-14 13:15:23.895522','2017-06-14 13:15:26.461655',NULL),(414,NULL,'972547731173','2017-06-14 13:15:23.903234','2017-06-14 13:15:26.461655',NULL),(415,NULL,'972544283967','2017-06-14 13:15:23.916229','2017-06-14 13:15:26.461655',NULL)RETURNING id
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/postgresql_adapter.rb:798:in `async_exec'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/postgresql_adapter.rb:798:in `exec_no_cache'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/postgresql/database_statements.rb:138:in `block in exec_query'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract_adapter.rb:442:in `block in log'
	from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract_adapter.rb:437:in `log'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/postgresql/database_statements.rb:50:in `select_rows'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/database_statements.rb:46:in `select_values'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/adapters/postgresql_adapter.rb:19:in `insert_many'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/import.rb:517:in `block in import_without_validations_or_callbacks'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/import.rb:515:in `each'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/import.rb:515:in `each_slice'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/import.rb:515:in `import_without_validations_or_callbacks'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/import.rb:468:in `import_with_validations'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-import-0.15.0/lib/activerecord-import/import.rb:393:in `import_helper'
... 3 levels...
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `within_new_transaction'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/connection_adapters/abstract/database_statements.rb:203:in `transaction'
	from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.0.13/lib/active_record/transactions.rb:209:in `transaction'
	from /app/vendor/bundle/ruby/2.2.0/bundler/gems/identity-importer-e30d0c6e6278/lib/identity/importer/tasks/members.rb:26:in `block in run'
	from /app/vendor/bundle/ruby/2.2.0/bundler/gems/identity-importer-e30d0c6e6278/lib/identity/importer/tasks/members.rb:24:in `each'
	from /app/vendor/bundle/ruby/2.2.0/bundler/gems/identity-importer-e30d0c6e6278/lib/identity/importer/tasks/members.rb:24:in `each_slice'
	from /app/vendor/bundle/ruby/2.2.0/bundler/gems/identity-importer-e30d0c6e6278/lib/identity/importer/tasks/members.rb:24:in `run'
	from (irb):2
	from /app/vendor/bundle/ruby/2.2.0/gems/padrino-core-0.14.0.1/lib/padrino-core/cli/base.rb:43:in `console'
	from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	from /app/vendor/bundle/ruby/2.2.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	from /app/vendor/bundle/ruby/2.2.0/gems/padrino-core-0.14.0.1/bin/padrino:9:in `<top (required)>'
	from /app/vendor/bundle/bin/padrino:17:in `load'
	from /app/vendor/bundle/bin/padrino:17:in `<main>'
irb(main):003:0> 
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant