Last active
August 29, 2015 14:06
-
-
Save adamkuipers/12578343d31a651bee4a to your computer and use it in GitHub Desktop.
ActiveRecord failing at batch-insert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):083:0> order.save.explain | |
(0.4ms) BEGIN | |
SQL (15.1ms) INSERT INTO "orders" ("address_id", "created_at", "customer_id", "order_request_id", "price_cents", "shipping_price_cents", "source", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["address_id", 291085], ["created_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00], ["customer_id", 63601], ["order_request_id", "2687c3b4-c0b3-44a1-887d-04073ae62d1b"], ["price_cents", 8900], ["shipping_price_cents", 1200], ["source", "web-cart"], ["updated_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00]] | |
SQL (4.1ms) UPDATE "customers" SET "orders_count" = COALESCE("orders_count", 0) + 1 WHERE "customers"."id" = 63601 | |
SQL (7.9ms) INSERT INTO "order_items" ("created_at", "order_id", "photo_count", "printer", "product", "source", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["created_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00], ["order_id", 80566], ["photo_count", 3], ["printer", 1], ["product", "calendardateless"], ["source", "printstagram"], ["updated_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00]] | |
SQL (1.6ms) UPDATE "orders" SET "order_items_count" = COALESCE("order_items_count", 0) + 1 WHERE "orders"."id" = 80566 | |
SQL (5.6ms) INSERT INTO "photos" ("created_at", "order_item_id", "position", "quantity", "received_url", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["created_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00], ["order_item_id", 92044], ["position", 0], ["quantity", 1], ["received_url", "http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10624320_1460446790896163_576385551_n.jpg"], ["updated_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00]] | |
SQL (0.8ms) INSERT INTO "photos" ("created_at", "order_item_id", "position", "quantity", "received_url", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["created_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00], ["order_item_id", 92044], ["position", 1], ["quantity", 1], ["received_url", "http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10624320_1460446790896163_576385551_n.jpg"], ["updated_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00]] | |
SQL (0.7ms) INSERT INTO "photos" ("created_at", "order_item_id", "position", "quantity", "received_url", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["created_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00], ["order_item_id", 92044], ["position", 2], ["quantity", 1], ["received_url", "http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10624320_1460446790896163_576385551_n.jpg"], ["updated_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00]] | |
SQL (0.8ms) UPDATE "customers" SET "updated_at" = '2014-09-10 19:07:34.875888', "ordered_at" = '2014-09-10 19:07:34.875888' WHERE "customers"."id" = 63601 | |
(2.0ms) COMMIT | |
OrderRequest Load (2.5ms) SELECT "order_requests".* FROM "order_requests" WHERE "order_requests"."id" = $1 LIMIT 1 [["id", "2687c3b4-c0b3-44a1-887d-04073ae62d1b"]] | |
(0.2ms) BEGIN | |
SQL (2.0ms) UPDATE "order_requests" SET "order_id" = $1, "updated_at" = $2 WHERE "order_requests"."id" = '2687c3b4-c0b3-44a1-887d-04073ae62d1b' [["order_id", 80566], ["updated_at", Wed, 10 Sep 2014 19:07:34 UTC +00:00]] | |
(0.5ms) COMMIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment