{"action":"created","issue":{"url":"https://api.github.com/repos/artsy/exchange/issues/299","repository_url":"https://api.github.com/repos/artsy/exchange","labels_url":"https://api.github.com/repos/artsy/exchange/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/artsy/exchange/issues/299/comments","events_url":"https://api.github.com/repos/artsy/exchange/issues/299/events","html_url":"https://github.com/artsy/exchange/pull/299","id":385739241,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0NjM5ODIy","number":299,"title":"Fix Papertrail versions issue","user":{"login":"ashkan18","id":1230819,"node_id":"MDQ6VXNlcjEyMzA4MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1230819?v=4","gravatar_id":"","url":"https://api.github.com/users/ashkan18","html_url":"https://github.com/ashkan18","followers_url":"https://api.github.com/users/ashkan18/followers","following_url":"https://api.github.com/users/ashkan18/following{/other_user}","gists_url":"https://api.github.com/users/ashkan18/gists{/gist_id}","starred_url":"https://api.github.com/users/ashkan18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashkan18/subscriptions","organizations_url":"https://api.github.com/users/ashkan18/orgs","repos_url":"https://api.github.com/users/ashkan18/repos","events_url":"https://api.github.com/users/ashkan18/events{/privacy}","received_events_url":"https://api.github.com/users/ashkan18/received_events","type":"User","site_admin":false},"labels":[{"id":1093494309,"node_id":"MDU6TGFiZWwxMDkzNDk0MzA5","url":"https://api.github.com/repos/artsy/exchange/labels/Jira%20Synced","name":"Jira Synced","color":"0366d6","default":false}],"state":"open","locked":false,"assignee":{"login":"williardx","id":4432348,"node_id":"MDQ6VXNlcjQ0MzIzNDg=","avatar_url":"https://avatars1.githubusercontent.com/u/4432348?v=4","gravatar_id":"","url":"https://api.github.com/users/williardx","html_url":"https://github.com/williardx","followers_url":"https://api.github.com/users/williardx/followers","following_url":"https://api.github.com/users/williardx/following{/other_user}","gists_url":"https://api.github.com/users/williardx/gists{/gist_id}","starred_url":"https://api.github.com/users/williardx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williardx/subscriptions","organizations_url":"https://api.github.com/users/williardx/orgs","repos_url":"https://api.github.com/users/williardx/repos","events_url":"https://api.github.com/users/williardx/events{/privacy}","received_events_url":"https://api.github.com/users/williardx/received_events","type":"User","site_admin":false},"assignees":[{"login":"williardx","id":4432348,"node_id":"MDQ6VXNlcjQ0MzIzNDg=","avatar_url":"https://avatars1.githubusercontent.com/u/4432348?v=4","gravatar_id":"","url":"https://api.github.com/users/williardx","html_url":"https://github.com/williardx","followers_url":"https://api.github.com/users/williardx/followers","following_url":"https://api.github.com/users/williardx/following{/other_user}","gists_url":"https://api.github.com/users/williardx/gists{/gist_id}","starred_url":"https://api.github.com/users/williardx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/williardx/subscriptions","organizations_url":"https://api.github.com/users/williardx/orgs","repos_url":"https://api.github.com/users/williardx/repos","events_url":"https://api.github.com/users/williardx/events{/privacy}","received_events_url":"https://api.github.com/users/williardx/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-11-29T13:35:31Z","updated_at":"2018-11-29T19:44:00Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/artsy/exchange/pulls/299","html_url":"https://github.com/artsy/exchange/pull/299","diff_url":"https://github.com/artsy/exchange/pull/299.diff","patch_url":"https://github.com/artsy/exchange/pull/299.patch"},"body":"# Problem\r\nhttps://artsyproduct.atlassian.net/browse/PLATFORM-1058\r\n\r\n# TLDR\r\nSince we switched from integer primary keys for models to `uuid`, papertrail has been silently failing storing correct data by trying to insert our `uuid` string field into `integer` field and basically resulting in wrong data in `item_id` field.\r\n\r\n# Quick Solution\r\nPapertrail was mainly added as an audit trail to Exchange since we are storing some important data and we do want to track changes on our most important models. Having said that, no one is currently actively using this data and there hasn't been a need to look at them yet. The quickest solution here is to:\r\n- [ ] fix the issue by changing `item_id` to be `string`, this should fix the issue for all new changes to models\r\n- [ ] Archive the table and store in S3 possibly in `artsy-backup/db`, the archived data is still valuable if we ever wanted to go back to papertrail data for older records since they have a the actual `jsonb` data\r\n- [ ] Delete older records with wrong `item_id`\r\n\r\n# Test\r\n- on `master` create an order\r\n- notice it creates version but item id is `826`\r\n- switch to this PR's branch\r\n- ran migration  (int -> string)\r\n- get existing order, \r\n  - verified versions are not there anymore\r\n- created a new order\r\n  - verified versions are correct\r\n- added new order\r\n  - verified previous order versions are correct\r\n\r\n```shell\r\n ~/src/exchange   master  rails c\r\nLoading development environment (Rails 5.2.1)\r\n2.5.3 :001 > Order.create(mode: \"BUY\", buyer_id: '123', buyer_type: 'user', seller_id: '321', seller_type: 'gallery', state: 'pending', currency_code: 'usd')\r\n   (0.3ms)  BEGIN\r\n  Order Create (61.5ms)  INSERT INTO \"orders\" (\"currency_code\", \"buyer_id\", \"seller_id\", \"created_at\", \"updated_at\", \"state\", \"state_updated_at\", \"state_expires_at\", \"buyer_type\", \"seller_type\", \"mode\") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING \"id\"  [[\"currency_code\", \"USD\"], [\"buyer_id\", \"123\"], [\"seller_id\", \"321\"], [\"created_at\", \"2018-11-29 13:38:30.676232\"], [\"updated_at\", \"2018-11-29 13:38:30.676232\"], [\"state\", \"pending\"], [\"state_updated_at\", \"2018-11-29 13:38:30.675897\"], [\"state_expires_at\", \"2018-12-01 13:38:30.675897\"], [\"buyer_type\", \"user\"], [\"seller_type\", \"gallery\"], [\"mode\", \"BUY\"]]\r\n  PaperTrail::Version Create (172.8ms)  INSERT INTO \"versions\" (\"item_type\", \"item_id\", \"event\", \"created_at\") VALUES ($1, $2, $3, $4) RETURNING \"id\"  [[\"item_type\", \"Order\"], [\"item_id\", 826], [\"event\", \"create\"], [\"created_at\", \"2018-11-29 13:38:30.676232\"]]\r\n  Order Exists (1.3ms)  SELECT  1 AS one FROM \"orders\" WHERE \"orders\".\"code\" = $1 LIMIT $2  [[\"code\", \"062460771\"], [\"LIMIT\", 1]]\r\n  Order Update (1.2ms)  UPDATE \"orders\" SET \"code\" = $1, \"updated_at\" = $2 WHERE \"orders\".\"id\" = $3  [[\"code\", \"062460771\"], [\"updated_at\", \"2018-11-29 13:38:30.973293\"], [\"id\", \"826ce7fb-fb19-4108-84dd-622a3d211a70\"]]\r\n  PaperTrail::Version Create (0.6ms)  INSERT INTO \"versions\" (\"item_type\", \"item_id\", \"event\", \"object\", \"created_at\") VALUES ($1, $2, $3, $4, $5) RETURNING \"id\"  [[\"item_type\", \"Order\"], [\"item_id\", 826], [\"event\", \"update\"], [\"object\", \"{\\\"id\\\":\\\"826ce7fb-fb19-4108-84dd-622a3d211a70\\\",\\\"code\\\":null,\\\"shipping_total_cents\\\":null,\\\"tax_total_cents\\\":null,\\\"transaction_fee_cents\\\":null,\\\"commission_fee_cents\\\":null,\\\"currency_code\\\":\\\"USD\\\",\\\"buyer_id\\\":\\\"123\\\",\\\"seller_id\\\":\\\"321\\\",\\\"created_at\\\":\\\"2018-11-29T13:38:30.676Z\\\",\\\"updated_at\\\":\\\"2018-11-29T13:38:30.676Z\\\",\\\"state\\\":\\\"pending\\\",\\\"credit_card_id\\\":null,\\\"state_updated_at\\\":\\\"2018-11-29T13:38:30.675Z\\\",\\\"state_expires_at\\\":\\\"2018-12-01T13:38:30.675Z\\\",\\\"shipping_address_line1\\\":null,\\\"shipping_address_line2\\\":null,\\\"shipping_city\\\":null,\\\"shipping_country\\\":null,\\\"shipping_postal_code\\\":null,\\\"fulfillment_type\\\":null,\\\"shipping_region\\\":null,\\\"external_charge_id\\\":null,\\\"shipping_name\\\":null,\\\"buyer_type\\\":\\\"user\\\",\\\"seller_type\\\":\\\"gallery\\\",\\\"items_total_cents\\\":null,\\\"buyer_total_cents\\\":null,\\\"seller_total_cents\\\":null,\\\"buyer_phone_number\\\":null,\\\"state_reason\\\":null,\\\"commission_rate\\\":null,\\\"mode\\\":\\\"BUY\\\",\\\"last_offer_id\\\":null,\\\"original_user_agent\\\":null,\\\"original_user_ip\\\":null}\"], [\"created_at\", \"2018-11-29 13:38:30.973293\"]]\r\n  StateHistory Create (45.3ms)  INSERT INTO \"state_histories\" (\"order_id\", \"created_at\", \"updated_at\", \"state\") VALUES ($1, $2, $3, $4) RETURNING \"id\"  [[\"order_id\", \"826ce7fb-fb19-4108-84dd-622a3d211a70\"], [\"created_at\", \"2018-11-29 13:38:31.014421\"], [\"updated_at\", \"2018-11-29 13:38:30.675897\"], [\"state\", \"pending\"]]\r\n   (0.5ms)  COMMIT\r\n => #<Order id: \"826ce7fb-fb19-4108-84dd-622a3d211a70\", code: \"062460771\", shipping_total_cents: nil, tax_total_cents: nil, transaction_fee_cents: nil, commission_fee_cents: nil, currency_code: \"USD\", buyer_id: \"123\", seller_id: \"321\", created_at: \"2018-11-29 13:38:30\", updated_at: \"2018-11-29 13:38:30\", state: \"pending\", credit_card_id: nil, state_updated_at: \"2018-11-29 13:38:30\", state_expires_at: \"2018-12-01 13:38:30\", shipping_address_line1: nil, shipping_address_line2: nil, shipping_city: nil, shipping_country: nil, shipping_postal_code: nil, fulfillment_type: nil, shipping_region: nil, external_charge_id: nil, shipping_name: nil, buyer_type: \"user\", seller_type: \"gallery\", items_total_cents: nil, buyer_total_cents: nil, seller_total_cents: nil, buyer_phone_number: nil, state_reason: nil, commission_rate: nil, mode: \"BUY\", last_offer_id: nil, original_user_agent: nil, original_user_ip: nil>\r\n2.5.3 :002 > o = _\r\n => #<Order id: \"826ce7fb-fb19-4108-84dd-622a3d211a70\", code: \"062460771\", shipping_total_cents: nil, tax_total_cents: nil, transaction_fee_cents: nil, commission_fee_cents: nil, currency_code: \"USD\", buyer_id: \"123\", seller_id: \"321\", created_at: \"2018-11-29 13:38:30\", updated_at: \"2018-11-29 13:38:30\", state: \"pending\", credit_card_id: nil, state_updated_at: \"2018-11-29 13:38:30\", state_expires_at: \"2018-12-01 13:38:30\", shipping_address_line1: nil, shipping_address_line2: nil, shipping_city: nil, shipping_country: nil, shipping_postal_code: nil, fulfillment_type: nil, shipping_region: nil, external_charge_id: nil, shipping_name: nil, buyer_type: \"user\", seller_type: \"gallery\", items_total_cents: nil, buyer_total_cents: nil, seller_total_cents: nil, buyer_phone_number: nil, state_reason: nil, commission_rate: nil, mode: \"BUY\", last_offer_id: nil, original_user_agent: nil, original_user_ip: nil>\r\n2.5.3 :003 > o.versions\r\n  PaperTrail::Version Load (0.6ms)  SELECT  \"versions\".* FROM \"versions\" WHERE \"versions\".\"item_id\" = $1 AND \"versions\".\"item_type\" = $2 ORDER BY \"versions\".\"created_at\" ASC, \"versions\".\"id\" ASC LIMIT $3  [[\"item_id\", 826], [\"item_type\", \"Order\"], [\"LIMIT\", 11]]\r\n => #<ActiveRecord::Associations::CollectionProxy [#<PaperTrail::Version id: 1, item_type: \"Order\", item_id: 826, event: \"create\", whodunnit: nil, object: nil, created_at: \"2018-11-29 13:38:30\">, #<PaperTrail::Version id: 2, item_type: \"Order\", item_id: 826, event: \"update\", whodunnit: nil, object: {\"id\"=>\"826ce7fb-fb19-4108-84dd-622a3d211a70\", \"code\"=>nil, \"mode\"=>\"BUY\", \"state\"=>\"pending\", \"buyer_id\"=>\"123\", \"seller_id\"=>\"321\", \"buyer_type\"=>\"user\", \"created_at\"=>\"2018-11-29T13:38:30.676Z\", \"updated_at\"=>\"2018-11-29T13:38:30.676Z\", \"seller_type\"=>\"gallery\", \"state_reason\"=>nil, \"currency_code\"=>\"USD\", \"last_offer_id\"=>nil, \"shipping_city\"=>nil, \"shipping_name\"=>nil, \"credit_card_id\"=>nil, \"commission_rate\"=>nil, \"shipping_region\"=>nil, \"tax_total_cents\"=>nil, \"fulfillment_type\"=>nil, \"original_user_ip\"=>nil, \"shipping_country\"=>nil, \"state_expires_at\"=>\"2018-12-01T13:38:30.675Z\", \"state_updated_at\"=>\"2018-11-29T13:38:30.675Z\", \"buyer_total_cents\"=>nil, \"items_total_cents\"=>nil, \"buyer_phone_number\"=>nil, \"external_charge_id\"=>nil, \"seller_total_cents\"=>nil, \"original_user_agent\"=>nil, \"commission_fee_cents\"=>nil, \"shipping_postal_code\"=>nil, \"shipping_total_cents\"=>nil, \"transaction_fee_cents\"=>nil, \"shipping_address_line1\"=>nil, \"shipping_address_line2\"=>nil}, created_at: \"2018-11-29 13:38:30\">]>\r\n2.5.3 :004 > exit\r\n ~/src/exchange   master  git checkout fix-versions\r\nSwitched to branch 'fix-versions'\r\nYour branch is up to date with 'origin/fix-versions'.\r\n ~/src/exchange   fix-versions  rails db:migrate\r\n== 20181129132032 FixVersions: migrating ======================================\r\n-- change_column(:versions, :item_id, :string)\r\n   -> 0.0927s\r\n== 20181129132032 FixVersions: migrated (0.0928s) =============================\r\n\r\n ~/src/exchange   fix-versions  rails c\r\nLoading development environment (Rails 5.2.1)\r\n2.5.3 :001 > Order.first\r\n  Order Load (0.9ms)  SELECT  \"orders\".* FROM \"orders\" ORDER BY \"orders\".\"id\" ASC LIMIT $1  [[\"LIMIT\", 1]]\r\n => #<Order id: \"826ce7fb-fb19-4108-84dd-622a3d211a70\", code: \"062460771\", shipping_total_cents: nil, tax_total_cents: nil, transaction_fee_cents: nil, commission_fee_cents: nil, currency_code: \"USD\", buyer_id: \"123\", seller_id: \"321\", created_at: \"2018-11-29 13:38:30\", updated_at: \"2018-11-29 13:38:30\", state: \"pending\", credit_card_id: nil, state_updated_at: \"2018-11-29 13:38:30\", state_expires_at: \"2018-12-01 13:38:30\", shipping_address_line1: nil, shipping_address_line2: nil, shipping_city: nil, shipping_country: nil, shipping_postal_code: nil, fulfillment_type: nil, shipping_region: nil, external_charge_id: nil, shipping_name: nil, buyer_type: \"user\", seller_type: \"gallery\", items_total_cents: nil, buyer_total_cents: nil, seller_total_cents: nil, buyer_phone_number: nil, state_reason: nil, commission_rate: nil, mode: \"BUY\", last_offer_id: nil, original_user_agent: nil, original_user_ip: nil>\r\n2.5.3 :002 > o = _\r\n => #<Order id: \"826ce7fb-fb19-4108-84dd-622a3d211a70\", code: \"062460771\", shipping_total_cents: nil, tax_total_cents: nil, transaction_fee_cents: nil, commission_fee_cents: nil, currency_code: \"USD\", buyer_id: \"123\", seller_id: \"321\", created_at: \"2018-11-29 13:38:30\", updated_at: \"2018-11-29 13:38:30\", state: \"pending\", credit_card_id: nil, state_updated_at: \"2018-11-29 13:38:30\", state_expires_at: \"2018-12-01 13:38:30\", shipping_address_line1: nil, shipping_address_line2: nil, shipping_city: nil, shipping_country: nil, shipping_postal_code: nil, fulfillment_type: nil, shipping_region: nil, external_charge_id: nil, shipping_name: nil, buyer_type: \"user\", seller_type: \"gallery\", items_total_cents: nil, buyer_total_cents: nil, seller_total_cents: nil, buyer_phone_number: nil, state_reason: nil, commission_rate: nil, mode: \"BUY\", last_offer_id: nil, original_user_agent: nil, original_user_ip: nil>\r\n2.5.3 :003 > o.versions\r\n  PaperTrail::Version Load (40.7ms)  SELECT  \"versions\".* FROM \"versions\" WHERE \"versions\".\"item_id\" = $1 AND \"versions\".\"item_type\" = $2 ORDER BY \"versions\".\"created_at\" ASC, \"versions\".\"id\" ASC LIMIT $3  [[\"item_id\", \"826ce7fb-fb19-4108-84dd-622a3d211a70\"], [\"item_type\", \"Order\"], [\"LIMIT\", 11]]\r\n => #<ActiveRecord::Associations::CollectionProxy []>\r\n2.5.3 :004 > Order.create(mode: \"BUY\", buyer_id: '123', buyer_type: 'user', seller_id: '321', seller_type: 'gallery', state: 'pending', currency_code: 'usd')\r\n   (0.3ms)  BEGIN\r\n  Order Create (3.7ms)  INSERT INTO \"orders\" (\"currency_code\", \"buyer_id\", \"seller_id\", \"created_at\", \"updated_at\", \"state\", \"state_updated_at\", \"state_expires_at\", \"buyer_type\", \"seller_type\", \"mode\") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING \"id\"  [[\"currency_code\", \"USD\"], [\"buyer_id\", \"123\"], [\"seller_id\", \"321\"], [\"created_at\", \"2018-11-29 13:39:33.760038\"], [\"updated_at\", \"2018-11-29 13:39:33.760038\"], [\"state\", \"pending\"], [\"state_updated_at\", \"2018-11-29 13:39:33.759735\"], [\"state_expires_at\", \"2018-12-01 13:39:33.759735\"], [\"buyer_type\", \"user\"], [\"seller_type\", \"gallery\"], [\"mode\", \"BUY\"]]\r\n  PaperTrail::Version Create (0.6ms)  INSERT INTO \"versions\" (\"item_type\", \"item_id\", \"event\", \"created_at\") VALUES ($1, $2, $3, $4) RETURNING \"id\"  [[\"item_type\", \"Order\"], [\"item_id\", \"f1570031-588d-4562-9ce0-65869e9d177d\"], [\"event\", \"create\"], [\"created_at\", \"2018-11-29 13:39:33.760038\"]]\r\n  Order Exists (0.5ms)  SELECT  1 AS one FROM \"orders\" WHERE \"orders\".\"code\" = $1 LIMIT $2  [[\"code\", \"506195359\"], [\"LIMIT\", 1]]\r\n  Order Update (0.7ms)  UPDATE \"orders\" SET \"code\" = $1, \"updated_at\" = $2 WHERE \"orders\".\"id\" = $3  [[\"code\", \"506195359\"], [\"updated_at\", \"2018-11-29 13:39:33.775602\"], [\"id\", \"f1570031-588d-4562-9ce0-65869e9d177d\"]]\r\n  PaperTrail::Version Create (0.8ms)  INSERT INTO \"versions\" (\"item_type\", \"item_id\", \"event\", \"object\", \"created_at\") VALUES ($1, $2, $3, $4, $5) RETURNING \"id\"  [[\"item_type\", \"Order\"], [\"item_id\", \"f1570031-588d-4562-9ce0-65869e9d177d\"], [\"event\", \"update\"], [\"object\", \"{\\\"id\\\":\\\"f1570031-588d-4562-9ce0-65869e9d177d\\\",\\\"code\\\":null,\\\"shipping_total_cents\\\":null,\\\"tax_total_cents\\\":null,\\\"transaction_fee_cents\\\":null,\\\"commission_fee_cents\\\":null,\\\"currency_code\\\":\\\"USD\\\",\\\"buyer_id\\\":\\\"123\\\",\\\"seller_id\\\":\\\"321\\\",\\\"created_at\\\":\\\"2018-11-29T13:39:33.760Z\\\",\\\"updated_at\\\":\\\"2018-11-29T13:39:33.760Z\\\",\\\"state\\\":\\\"pending\\\",\\\"credit_card_id\\\":null,\\\"state_updated_at\\\":\\\"2018-11-29T13:39:33.759Z\\\",\\\"state_expires_at\\\":\\\"2018-12-01T13:39:33.759Z\\\",\\\"shipping_address_line1\\\":null,\\\"shipping_address_line2\\\":null,\\\"shipping_city\\\":null,\\\"shipping_country\\\":null,\\\"shipping_postal_code\\\":null,\\\"fulfillment_type\\\":null,\\\"shipping_region\\\":null,\\\"external_charge_id\\\":null,\\\"shipping_name\\\":null,\\\"buyer_type\\\":\\\"user\\\",\\\"seller_type\\\":\\\"gallery\\\",\\\"items_total_cents\\\":null,\\\"buyer_total_cents\\\":null,\\\"seller_total_cents\\\":null,\\\"buyer_phone_number\\\":null,\\\"state_reason\\\":null,\\\"commission_rate\\\":null,\\\"mode\\\":\\\"BUY\\\",\\\"last_offer_id\\\":null,\\\"original_user_agent\\\":null,\\\"original_user_ip\\\":null}\"], [\"created_at\", \"2018-11-29 13:39:33.775602\"]]\r\n  StateHistory Create (0.8ms)  INSERT INTO \"state_histories\" (\"order_id\", \"created_at\", \"updated_at\", \"state\") VALUES ($1, $2, $3, $4) RETURNING \"id\"  [[\"order_id\", \"f1570031-588d-4562-9ce0-65869e9d177d\"], [\"created_at\", \"2018-11-29 13:39:33.806329\"], [\"updated_at\", \"2018-11-29 13:39:33.759735\"], [\"state\", \"pending\"]]\r\n   (41.3ms)  COMMIT\r\n => #<Order id: \"f1570031-588d-4562-9ce0-65869e9d177d\", code: \"506195359\", shipping_total_cents: nil, tax_total_cents: nil, transaction_fee_cents: nil, commission_fee_cents: nil, currency_code: \"USD\", buyer_id: \"123\", seller_id: \"321\", created_at: \"2018-11-29 13:39:33\", updated_at: \"2018-11-29 13:39:33\", state: \"pending\", credit_card_id: nil, state_updated_at: \"2018-11-29 13:39:33\", state_expires_at: \"2018-12-01 13:39:33\", shipping_address_line1: nil, shipping_address_line2: nil, shipping_city: nil, shipping_country: nil, shipping_postal_code: nil, fulfillment_type: nil, shipping_region: nil, external_charge_id: nil, shipping_name: nil, buyer_type: \"user\", seller_type: \"gallery\", items_total_cents: nil, buyer_total_cents: nil, seller_total_cents: nil, buyer_phone_number: nil, state_reason: nil, commission_rate: nil, mode: \"BUY\", last_offer_id: nil, original_user_agent: nil, original_user_ip: nil>\r\n2.5.3 :005 > o = _\r\n => #<Order id: \"f1570031-588d-4562-9ce0-65869e9d177d\", code: \"506195359\", shipping_total_cents: nil, tax_total_cents: nil, transaction_fee_cents: nil, commission_fee_cents: nil, currency_code: \"USD\", buyer_id: \"123\", seller_id: \"321\", created_at: \"2018-11-29 13:39:33\", updated_at: \"2018-11-29 13:39:33\", state: \"pending\", credit_card_id: nil, state_updated_at: \"2018-11-29 13:39:33\", state_expires_at: \"2018-12-01 13:39:33\", shipping_address_line1: nil, shipping_address_line2: nil, shipping_city: nil, shipping_country: nil, shipping_postal_code: nil, fulfillment_type: nil, shipping_region: nil, external_charge_id: nil, shipping_name: nil, buyer_type: \"user\", seller_type: \"gallery\", items_total_cents: nil, buyer_total_cents: nil, seller_total_cents: nil, buyer_phone_number: nil, state_reason: nil, commission_rate: nil, mode: \"BUY\", last_offer_id: nil, original_user_agent: nil, original_user_ip: nil>\r\n2.5.3 :006 > o.versions\r\n  PaperTrail::Version Load (0.4ms)  SELECT  \"versions\".* FROM \"versions\" WHERE \"versions\".\"item_id\" = $1 AND \"versions\".\"item_type\" = $2 ORDER BY \"versions\".\"created_at\" ASC, \"versions\".\"id\" ASC LIMIT $3  [[\"item_id\", \"f1570031-588d-4562-9ce0-65869e9d177d\"], [\"item_type\", \"Order\"], [\"LIMIT\", 11]]\r\n => #<ActiveRecord::Associations::CollectionProxy [#<PaperTrail::Version id: 3, item_type: \"Order\", item_id: \"f1570031-588d-4562-9ce0-65869e9d177d\", event: \"create\", whodunnit: nil, object: nil, created_at: \"2018-11-29 13:39:33\">, #<PaperTrail::Version id: 4, item_type: \"Order\", item_id: \"f1570031-588d-4562-9ce0-65869e9d177d\", event: \"update\", whodunnit: nil, object: {\"id\"=>\"f1570031-588d-4562-9ce0-65869e9d177d\", \"code\"=>nil, \"mode\"=>\"BUY\", \"state\"=>\"pending\", \"buyer_id\"=>\"123\", \"seller_id\"=>\"321\", \"buyer_type\"=>\"user\", \"created_at\"=>\"2018-11-29T13:39:33.760Z\", \"updated_at\"=>\"2018-11-29T13:39:33.760Z\", \"seller_type\"=>\"gallery\", \"state_reason\"=>nil, \"currency_code\"=>\"USD\", \"last_offer_id\"=>nil, \"shipping_city\"=>nil, \"shipping_name\"=>nil, \"credit_card_id\"=>nil, \"commission_rate\"=>nil, \"shipping_region\"=>nil, \"tax_total_cents\"=>nil, \"fulfillment_type\"=>nil, \"original_user_ip\"=>nil, \"shipping_country\"=>nil, \"state_expires_at\"=>\"2018-12-01T13:39:33.759Z\", \"state_updated_at\"=>\"2018-11-29T13:39:33.759Z\", \"buyer_total_cents\"=>nil, \"items_total_cents\"=>nil, \"buyer_phone_number\"=>nil, \"external_charge_id\"=>nil, \"seller_total_cents\"=>nil, \"original_user_agent\"=>nil, \"commission_fee_cents\"=>nil, \"shipping_postal_code\"=>nil, \"shipping_total_cents\"=>nil, \"transaction_fee_cents\"=>nil, \"shipping_address_line1\"=>nil, \"shipping_address_line2\"=>nil}, created_at: \"2018-11-29 13:39:33\">]>\r\n2.5.3 :007 >\r\n```"},"comment":{"url":"https://api.github.com/repos/artsy/exchange/issues/comments/442967461","html_url":"https://github.com/artsy/exchange/pull/299#issuecomment-442967461","issue_url":"https://api.github.com/repos/artsy/exchange/issues/299","id":442967461,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Mjk2NzQ2MQ==","user":{"login":"ashkan18","id":1230819,"node_id":"MDQ6VXNlcjEyMzA4MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1230819?v=4","gravatar_id":"","url":"https://api.github.com/users/ashkan18","html_url":"https://github.com/ashkan18","followers_url":"https://api.github.com/users/ashkan18/followers","following_url":"https://api.github.com/users/ashkan18/following{/other_user}","gists_url":"https://api.github.com/users/ashkan18/gists{/gist_id}","starred_url":"https://api.github.com/users/ashkan18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashkan18/subscriptions","organizations_url":"https://api.github.com/users/ashkan18/orgs","repos_url":"https://api.github.com/users/ashkan18/repos","events_url":"https://api.github.com/users/ashkan18/events{/privacy}","received_events_url":"https://api.github.com/users/ashkan18/received_events","type":"User","site_admin":false},"created_at":"2018-11-29T19:44:00Z","updated_at":"2018-11-29T19:44:00Z","author_association":"COLLABORATOR","body":"i actually thought about switching to `uuid` but thought having it as `string` would be more generic. I'm happy to change it but also could live with `string`, from _papertrail_ perspective that totally worked.\r\nAs I have it in the PR description, for migration, im planning to:\r\n- [ ] Run db migration\r\n- [ ] Copy the snapshot of the database to S3 for any possible future references\r\n- [ ] Delete older data"}}
{"actor":{"display_login":"ashkan18"}}