caddie 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/caddie/crest_data_retriever.rb +10 -7
- data/app/models/caddie/crest_price_history_last_day_timestamp.rb +30 -0
- data/app/models/caddie/crest_price_history_update.rb +50 -25
- data/app/models/caddie/crest_price_history_update_log.rb +10 -0
- data/app/models/caddie/m_threaded_updater.rb +12 -10
- data/db/migrate/20160803094530_create_caddie_crest_price_history_last_day_timestamps.rb +12 -0
- data/lib/caddie/version.rb +1 -1
- data/lib/tasks/caddie_tasks.rake +4 -6
- data/{app → test/dummy/app}/models/crest_price_history.rb +0 -0
- data/test/dummy/app/models/eve_item.rb +5 -9
- data/test/dummy/db/migrate/20150815033941_add_epic_blueprint_to_eve_item.rb +5 -0
- data/test/dummy/db/migrate/20150916052729_add_market_group_ref_to_eve_item.rb +6 -0
- data/test/dummy/db/migrate/20160803143148_crest_price_history_index_rework_and_others.rb +17 -0
- data/test/dummy/db/schema.rb +25 -15
- data/test/factories/caddie/crest_price_history.rb +7 -0
- data/test/factories/caddie/crest_price_history_last_day_timestamp.rb +7 -0
- data/test/factories/caddie/crest_price_history_updates.rb +3 -0
- data/test/factories/caddie/eve_items.rb +1 -39
- data/test/factories/caddie/regions.rb +4 -27
- data/test/models/caddie/crest_data_retriever_test.rb +36 -0
- data/test/models/caddie/crest_price_history_last_day_timestamp_test.rb +102 -0
- data/test/models/caddie/crest_price_history_update_log_test.rb +15 -3
- data/test/models/caddie/crest_price_history_update_test.rb +31 -9
- data/test/models/caddie/m_threaded_updater_test.rb +13 -25
- data/test/test_helper.rb +7 -2
- metadata +64 -66
- data/lib/tasks/m_threaded_updater_test.no_rake +0 -53
- data/test/dummy/log/development.log +0 -637
- data/test/dummy/log/test.log +0 -46048
@@ -1,637 +0,0 @@
|
|
1
|
-
[1m[36m (15.0ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
2
|
-
[1m[35m (1.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
-
[1m[36mActiveRecord::SchemaMigration Load (1.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
-
Migrating to CreateEveItems (20150410082132)
|
5
|
-
[1m[35m (0.3ms)[0m BEGIN
|
6
|
-
DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /mnt/hdd1/ced/ruby/caddie/test/dummy/db/migrate/20150410082132_create_eve_items.rb:7)
|
7
|
-
[1m[36m (14.6ms)[0m [1mCREATE TABLE "eve_items" ("id" serial primary key, "eve_item_id" integer, "name" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
8
|
-
[1m[35m (1.5ms)[0m CREATE INDEX "index_eve_items_on_eve_item_id" ON "eve_items" ("eve_item_id")
|
9
|
-
[1m[36mSQL (1.4ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150410082132"]]
|
10
|
-
[1m[35m (0.8ms)[0m COMMIT
|
11
|
-
Migrating to AddNameLowcaseToEveItem (20150414095303)
|
12
|
-
[1m[36m (0.5ms)[0m [1mBEGIN[0m
|
13
|
-
[1m[35m (0.5ms)[0m ALTER TABLE "eve_items" ADD "name_lowcase" character varying
|
14
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150414095303"]]
|
15
|
-
[1m[35m (1.1ms)[0m COMMIT
|
16
|
-
Migrating to RenameEveItemId (20150416154256)
|
17
|
-
[1m[36m (0.3ms)[0m [1mBEGIN[0m
|
18
|
-
[1m[35m (0.4ms)[0m ALTER TABLE "eve_items" RENAME COLUMN "eve_item_id" TO "cpp_eve_item_id"
|
19
|
-
[1m[36m (0.3ms)[0m [1mALTER INDEX "index_eve_items_on_eve_item_id" RENAME TO "index_eve_items_on_cpp_eve_item_id"[0m
|
20
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150416154256"]]
|
21
|
-
[1m[36m (0.6ms)[0m [1mCOMMIT[0m
|
22
|
-
Migrating to AddCostToEveItem (20150417135716)
|
23
|
-
[1m[35m (0.2ms)[0m BEGIN
|
24
|
-
[1m[36m (1.2ms)[0m [1mALTER TABLE "eve_items" ADD "cost" float[0m
|
25
|
-
[1m[35mSQL (0.5ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150417135716"]]
|
26
|
-
[1m[36m (1.0ms)[0m [1mCOMMIT[0m
|
27
|
-
Migrating to AddCppMarketGroupIdToEveItem (20150906171550)
|
28
|
-
[1m[35m (0.4ms)[0m BEGIN
|
29
|
-
[1m[36m (0.4ms)[0m [1mALTER TABLE "eve_items" ADD "cpp_market_group_id" integer[0m
|
30
|
-
[1m[35m (1.6ms)[0m CREATE INDEX "index_eve_items_on_cpp_market_group_id" ON "eve_items" ("cpp_market_group_id")
|
31
|
-
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150906171550"]]
|
32
|
-
[1m[35m (1.8ms)[0m COMMIT
|
33
|
-
Migrating to AddInvolvedInBlueprintToEveItem (20150909162142)
|
34
|
-
[1m[36m (0.3ms)[0m [1mBEGIN[0m
|
35
|
-
[1m[35m (11.1ms)[0m ALTER TABLE "eve_items" ADD "involved_in_blueprint" bool DEFAULT 'f'
|
36
|
-
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150909162142"]]
|
37
|
-
[1m[35m (1.8ms)[0m COMMIT
|
38
|
-
Migrating to CreateRegions (20150910074544)
|
39
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
40
|
-
[1m[35m (7.4ms)[0m CREATE TABLE "regions" ("id" serial primary key, "cpp_region_id" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
41
|
-
[1m[36m (3.5ms)[0m [1mCREATE UNIQUE INDEX "index_regions_on_cpp_region_id" ON "regions" ("cpp_region_id")[0m
|
42
|
-
[1m[35mSQL (0.4ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150910074544"]]
|
43
|
-
[1m[36m (0.9ms)[0m [1mCOMMIT[0m
|
44
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
45
|
-
[1m[36m (4.8ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
46
|
-
FROM pg_constraint c
|
47
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
48
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
49
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
50
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
51
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
52
|
-
WHERE c.contype = 'f'
|
53
|
-
AND t1.relname = 'eve_items'
|
54
|
-
AND t3.nspname = ANY (current_schemas(false))
|
55
|
-
ORDER BY c.conname
|
56
|
-
[0m
|
57
|
-
[1m[35m (1.8ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
58
|
-
FROM pg_constraint c
|
59
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
60
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
61
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
62
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
63
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
64
|
-
WHERE c.contype = 'f'
|
65
|
-
AND t1.relname = 'regions'
|
66
|
-
AND t3.nspname = ANY (current_schemas(false))
|
67
|
-
ORDER BY c.conname
|
68
|
-
|
69
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
70
|
-
Migrating to CreateCaddieCrestPriceHistoryUpdates (20160524122651)
|
71
|
-
[1m[35m (0.2ms)[0m BEGIN
|
72
|
-
[1m[36m (6.9ms)[0m [1mCREATE TABLE "caddie_crest_price_history_updates" ("id" serial primary key, "eve_item_id" integer, "region_id" integer, "max_update" date, "max_eve_item_create" date, "max_region_create" date, "max_date" date, "nb_days" integer, "process_queue" character varying, "process_queue_priority" integer, "next_process_date" date, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
73
|
-
[1m[35m (5.9ms)[0m ALTER TABLE "caddie_crest_price_history_updates" ADD CONSTRAINT "fk_rails_30a37401e2"
|
74
|
-
FOREIGN KEY ("eve_item_id")
|
75
|
-
REFERENCES "eve_items" ("id")
|
76
|
-
|
77
|
-
[1m[36m (2.9ms)[0m [1mALTER TABLE "caddie_crest_price_history_updates" ADD CONSTRAINT "fk_rails_ee255dc7cc"
|
78
|
-
FOREIGN KEY ("region_id")
|
79
|
-
REFERENCES "regions" ("id")
|
80
|
-
[0m
|
81
|
-
[1m[35m (1.6ms)[0m CREATE UNIQUE INDEX "index_caddie_cphu_on_eve_item_id_and_region_id" ON "caddie_crest_price_history_updates" ("eve_item_id", "region_id")
|
82
|
-
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20160524122651"]]
|
83
|
-
[1m[35m (23.8ms)[0m COMMIT
|
84
|
-
Migrating to AddThreadSliceIdToCaddieCrestPriceHistoryUpdates (20160527152027)
|
85
|
-
[1m[36m (0.4ms)[0m [1mBEGIN[0m
|
86
|
-
[1m[35m (0.5ms)[0m ALTER TABLE "caddie_crest_price_history_updates" ADD "thread_slice_id" integer
|
87
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20160527152027"]]
|
88
|
-
[1m[35m (0.6ms)[0m COMMIT
|
89
|
-
Migrating to CreateCaddieCrestPriceHistoryUpdateLogs (20160707153021)
|
90
|
-
[1m[36m (0.3ms)[0m [1mBEGIN[0m
|
91
|
-
[1m[35m (4.7ms)[0m CREATE TABLE "caddie_crest_price_history_update_logs" ("id" serial primary key, "feed_date" date, "update_planning_time" integer, "feeding_time" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
92
|
-
[1m[36m (3.7ms)[0m [1mCREATE UNIQUE INDEX "index_caddie_crest_price_history_update_logs_on_feed_date" ON "caddie_crest_price_history_update_logs" ("feed_date")[0m
|
93
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160707153021"]]
|
94
|
-
[1m[36m (0.6ms)[0m [1mCOMMIT[0m
|
95
|
-
Migrating to AddTotalInsertsToCrestPriceHistoryUpdateLog (20160710163612)
|
96
|
-
[1m[35m (0.2ms)[0m BEGIN
|
97
|
-
[1m[36m (0.4ms)[0m [1mALTER TABLE "caddie_crest_price_history_update_logs" ADD "total_inserts" integer[0m
|
98
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160710163612"]]
|
99
|
-
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
100
|
-
Migrating to AddCoSecondsToCrestPriceHistoryUpdateLog (20160710163641)
|
101
|
-
[1m[35m (0.3ms)[0m BEGIN
|
102
|
-
[1m[36m (0.5ms)[0m [1mALTER TABLE "caddie_crest_price_history_update_logs" ADD "co_seconds" float[0m
|
103
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160710163641"]]
|
104
|
-
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
105
|
-
Migrating to AddIndexesToCrestPriceHistoryUpdate (20160725091214)
|
106
|
-
[1m[35m (0.2ms)[0m BEGIN
|
107
|
-
[1m[36m (3.3ms)[0m [1mCREATE INDEX "index_caddie_crest_price_history_updates_on_nb_days" ON "caddie_crest_price_history_updates" ("nb_days")[0m
|
108
|
-
[1m[35m (2.5ms)[0m CREATE INDEX "index_caddie_crest_price_history_updates_on_process_queue" ON "caddie_crest_price_history_updates" ("process_queue")
|
109
|
-
[1m[36m (2.7ms)[0m [1mCREATE INDEX "index_caddie_crest_price_history_updates_on_next_process_date" ON "caddie_crest_price_history_updates" ("next_process_date")[0m
|
110
|
-
[1m[35m (1.4ms)[0m CREATE INDEX "index_caddie_crest_price_history_updates_on_thread_slice_id" ON "caddie_crest_price_history_updates" ("thread_slice_id")
|
111
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20160725091214"]]
|
112
|
-
[1m[35m (0.5ms)[0m COMMIT
|
113
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.7ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
114
|
-
[1m[35m (2.7ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
115
|
-
FROM pg_constraint c
|
116
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
117
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
118
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
119
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
120
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
121
|
-
WHERE c.contype = 'f'
|
122
|
-
AND t1.relname = 'caddie_crest_price_history_update_logs'
|
123
|
-
AND t3.nspname = ANY (current_schemas(false))
|
124
|
-
ORDER BY c.conname
|
125
|
-
|
126
|
-
[1m[36m (2.7ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
127
|
-
FROM pg_constraint c
|
128
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
129
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
130
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
131
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
132
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
133
|
-
WHERE c.contype = 'f'
|
134
|
-
AND t1.relname = 'caddie_crest_price_history_updates'
|
135
|
-
AND t3.nspname = ANY (current_schemas(false))
|
136
|
-
ORDER BY c.conname
|
137
|
-
[0m
|
138
|
-
[1m[35m (2.7ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
139
|
-
FROM pg_constraint c
|
140
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
141
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
142
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
143
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
144
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
145
|
-
WHERE c.contype = 'f'
|
146
|
-
AND t1.relname = 'eve_items'
|
147
|
-
AND t3.nspname = ANY (current_schemas(false))
|
148
|
-
ORDER BY c.conname
|
149
|
-
|
150
|
-
[1m[36m (2.8ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
151
|
-
FROM pg_constraint c
|
152
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
153
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
154
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
155
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
156
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
157
|
-
WHERE c.contype = 'f'
|
158
|
-
AND t1.relname = 'regions'
|
159
|
-
AND t3.nspname = ANY (current_schemas(false))
|
160
|
-
ORDER BY c.conname
|
161
|
-
[0m
|
162
|
-
[1m[36m (4.3ms)[0m [1mSELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
163
|
-
[1m[35m (0.7ms)[0m BEGIN
|
164
|
-
[1m[36mSQL (1.2ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-25"]]
|
165
|
-
[1m[35mSQL (1.1ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-25"]]
|
166
|
-
[1m[36mSQL (1.0ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-25"]]
|
167
|
-
[1m[35mSQL (1.0ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 4 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-25"]]
|
168
|
-
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
169
|
-
[1m[35m (1.1ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
170
|
-
[1m[36m (1.6ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
171
|
-
[1m[35m (3.2ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
172
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (1.2ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
173
|
-
[1m[35m (0.6ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 [["next_process_date", "2016-07-25"], ["thread_slice_id", 2]]
|
174
|
-
[1m[36m (2.1ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
175
|
-
[1m[35m (1.9ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"], ["thread_slice_id", 2]]
|
176
|
-
[1m[36m (1.0ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
177
|
-
[1m[35mCaddie::CrestPriceHistoryUpdate Load (0.3ms)[0m SELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"]]
|
178
|
-
[1m[36m (0.4ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2[0m [["next_process_date", "2016-07-25"], ["thread_slice_id", 4]]
|
179
|
-
[1m[35m (1.8ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"], ["thread_slice_id", 4]]
|
180
|
-
[1m[36m (0.6ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
181
|
-
[1m[35m (0.4ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
182
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (0.6ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
183
|
-
[1m[35m (0.7ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 [["next_process_date", "2016-07-25"], ["thread_slice_id", 1]]
|
184
|
-
[1m[36m (0.9ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"], ["thread_slice_id", 1]]
|
185
|
-
[1m[35m (0.9ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
186
|
-
[1m[36m (0.6ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
187
|
-
[1m[35mCaddie::CrestPriceHistoryUpdate Load (0.7ms)[0m SELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"]]
|
188
|
-
[1m[36m (0.5ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2[0m [["next_process_date", "2016-07-25"], ["thread_slice_id", 3]]
|
189
|
-
[1m[35m (1.9ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"], ["thread_slice_id", 3]]
|
190
|
-
[1m[36m (0.4ms)[0m [1mBEGIN[0m
|
191
|
-
[1m[35mSQL (4.6ms)[0m INSERT INTO "regions" ("cpp_region_id", "name", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["cpp_region_id", "1232456"], ["name", "Toto"], ["created_at", "2016-07-25 15:01:38.457392"], ["updated_at", "2016-07-25 15:01:38.457392"]]
|
192
|
-
[1m[36m (1.1ms)[0m [1mCOMMIT[0m
|
193
|
-
[1m[35m (0.5ms)[0m BEGIN
|
194
|
-
[1m[36mSQL (3.4ms)[0m [1mINSERT INTO "eve_items" ("cpp_eve_item_id", "name", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"[0m [["cpp_eve_item_id", 1232456], ["name", "Toto"], ["created_at", "2016-07-25 15:02:05.378860"], ["updated_at", "2016-07-25 15:02:05.378860"]]
|
195
|
-
[1m[35m (0.9ms)[0m COMMIT
|
196
|
-
[1m[36mRegion Load (1.0ms)[0m [1mSELECT "regions".* FROM "regions" ORDER BY "regions"."id" ASC LIMIT 1[0m
|
197
|
-
[1m[35mEveItem Load (0.8ms)[0m SELECT "eve_items".* FROM "eve_items" ORDER BY "eve_items"."id" ASC LIMIT 1
|
198
|
-
[1m[36m (0.4ms)[0m [1mBEGIN[0m
|
199
|
-
[1m[35mSQL (4.4ms)[0m INSERT INTO "caddie_crest_price_history_updates" ("region_id", "eve_item_id", "next_process_date", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["region_id", 1], ["eve_item_id", 1], ["next_process_date", "2016-07-25"], ["created_at", "2016-07-25 15:03:04.293591"], ["updated_at", "2016-07-25 15:03:04.293591"]]
|
200
|
-
[1m[36m (0.7ms)[0m [1mCOMMIT[0m
|
201
|
-
[1m[35m (13.4ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"]]
|
202
|
-
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
203
|
-
[1m[35mSQL (0.8ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."id" = 1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-25"]]
|
204
|
-
[1m[36mSQL (0.6ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-25"]]
|
205
|
-
[1m[35mSQL (0.5ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-25"]]
|
206
|
-
[1m[36mSQL (0.5ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 4 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-25"]]
|
207
|
-
[1m[35m (4.9ms)[0m COMMIT
|
208
|
-
[1m[36m (0.5ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
209
|
-
[1m[35m (0.3ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
210
|
-
[1m[36m (0.4ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
211
|
-
[1m[35m (3.2ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
212
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (0.3ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
213
|
-
[1m[35m (1.5ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
214
|
-
[1m[36m (1.3ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
215
|
-
[1m[35mCaddie::CrestPriceHistoryUpdate Load (0.5ms)[0m SELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"]]
|
216
|
-
[1m[36m (2.7ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
217
|
-
[1m[35m (2.1ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
218
|
-
[1m[36m (0.4ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
219
|
-
[1m[35mCaddie::CrestPriceHistoryUpdate Load (1.4ms)[0m SELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"]]
|
220
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (0.9ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
221
|
-
[1m[35m (0.6ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 [["next_process_date", "2016-07-25"], ["thread_slice_id", 2]]
|
222
|
-
[1m[36m (1.1ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"], ["thread_slice_id", 2]]
|
223
|
-
[1m[35m (1.0ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 [["next_process_date", "2016-07-25"], ["thread_slice_id", 4]]
|
224
|
-
[1m[36m (0.6ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2[0m [["next_process_date", "2016-07-25"], ["thread_slice_id", 1]]
|
225
|
-
[1m[35m (1.2ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"], ["thread_slice_id", 1]]
|
226
|
-
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2[0m [["next_process_date", "2016-07-25"], ["thread_slice_id", 3]]
|
227
|
-
[1m[36m (0.9ms)[0m [1mSELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
228
|
-
[1m[35m (0.2ms)[0m BEGIN
|
229
|
-
[1m[36mSQL (1.0ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."id" = 1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-25"]]
|
230
|
-
[1m[35mSQL (0.5ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-25"]]
|
231
|
-
[1m[36mSQL (0.5ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-25"]]
|
232
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 4 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-25"]]
|
233
|
-
[1m[36m (2.0ms)[0m [1mCOMMIT[0m
|
234
|
-
[1m[35m (0.4ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
235
|
-
[1m[36m (0.8ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
236
|
-
[1m[35m (0.5ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
237
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (0.5ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
238
|
-
[1m[35m (0.5ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 [["next_process_date", "2016-07-25"], ["thread_slice_id", 1]]
|
239
|
-
[1m[36m (15.0ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
240
|
-
[1m[35m (0.7ms)[0m SELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 [["next_process_date", "2016-07-25"]]
|
241
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (1.3ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-25"]]
|
242
|
-
[1m[35m (2.0ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-25"], ["thread_slice_id", 1]]
|
243
|
-
[1m[36m (2.6ms)[0m [1mSELECT COUNT(*) FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1[0m [["next_process_date", "2016-07-25"]]
|
244
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
245
|
-
Migrating to CreateCrestPriceHistories (20150910080646)
|
246
|
-
[1m[35m (0.3ms)[0m BEGIN
|
247
|
-
[1m[36m (6.4ms)[0m [1mCREATE TABLE "crest_price_histories" ("id" serial primary key, "region_id" integer NOT NULL, "eve_item_id" integer NOT NULL, "day_timestamp" character varying NOT NULL, "history_date" timestamp NOT NULL, "order_count" bigint, "volume" bigint, "low_price" float, "avg_price" float, "high_price" float, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
248
|
-
[1m[35m (1.8ms)[0m CREATE INDEX "index_crest_price_histories_on_region_id" ON "crest_price_histories" ("region_id")
|
249
|
-
[1m[36m (2.3ms)[0m [1mCREATE INDEX "index_crest_price_histories_on_eve_item_id" ON "crest_price_histories" ("eve_item_id")[0m
|
250
|
-
[1m[35m (1.9ms)[0m CREATE INDEX "index_crest_price_histories_on_day_timestamp" ON "crest_price_histories" ("day_timestamp")
|
251
|
-
[1m[36m (1.3ms)[0m [1mALTER TABLE "crest_price_histories" ADD CONSTRAINT "fk_rails_35305feae4"
|
252
|
-
FOREIGN KEY ("region_id")
|
253
|
-
REFERENCES "regions" ("id")
|
254
|
-
[0m
|
255
|
-
[1m[35m (1.0ms)[0m ALTER TABLE "crest_price_histories" ADD CONSTRAINT "fk_rails_cc2b7d19d3"
|
256
|
-
FOREIGN KEY ("eve_item_id")
|
257
|
-
REFERENCES "eve_items" ("id")
|
258
|
-
|
259
|
-
[1m[36m (2.7ms)[0m [1mCREATE UNIQUE INDEX "price_histories_all_keys_index" ON "crest_price_histories" ("region_id", "eve_item_id", "day_timestamp")[0m
|
260
|
-
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150910080646"]]
|
261
|
-
[1m[36m (1.2ms)[0m [1mCOMMIT[0m
|
262
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
263
|
-
[1m[36m (2.3ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
264
|
-
FROM pg_constraint c
|
265
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
266
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
267
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
268
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
269
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
270
|
-
WHERE c.contype = 'f'
|
271
|
-
AND t1.relname = 'caddie_crest_price_history_update_logs'
|
272
|
-
AND t3.nspname = ANY (current_schemas(false))
|
273
|
-
ORDER BY c.conname
|
274
|
-
[0m
|
275
|
-
[1m[35m (3.3ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
276
|
-
FROM pg_constraint c
|
277
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
278
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
279
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
280
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
281
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
282
|
-
WHERE c.contype = 'f'
|
283
|
-
AND t1.relname = 'caddie_crest_price_history_updates'
|
284
|
-
AND t3.nspname = ANY (current_schemas(false))
|
285
|
-
ORDER BY c.conname
|
286
|
-
|
287
|
-
[1m[36m (4.1ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
288
|
-
FROM pg_constraint c
|
289
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
290
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
291
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
292
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
293
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
294
|
-
WHERE c.contype = 'f'
|
295
|
-
AND t1.relname = 'crest_price_histories'
|
296
|
-
AND t3.nspname = ANY (current_schemas(false))
|
297
|
-
ORDER BY c.conname
|
298
|
-
[0m
|
299
|
-
[1m[35m (2.4ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
300
|
-
FROM pg_constraint c
|
301
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
302
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
303
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
304
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
305
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
306
|
-
WHERE c.contype = 'f'
|
307
|
-
AND t1.relname = 'eve_items'
|
308
|
-
AND t3.nspname = ANY (current_schemas(false))
|
309
|
-
ORDER BY c.conname
|
310
|
-
|
311
|
-
[1m[36m (2.4ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
312
|
-
FROM pg_constraint c
|
313
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
314
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
315
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
316
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
317
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
318
|
-
WHERE c.contype = 'f'
|
319
|
-
AND t1.relname = 'regions'
|
320
|
-
AND t3.nspname = ANY (current_schemas(false))
|
321
|
-
ORDER BY c.conname
|
322
|
-
[0m
|
323
|
-
[1m[36m (21.3ms)[0m [1m/* Don't forget to set the postgres sequence to cycle on production */
|
324
|
-
/* ALTER SEQUENCE caddie_crest_price_history_updates_id_seq CYCLE; */
|
325
|
-
|
326
|
-
/* TRUNCATE TABLE caddie_crest_price_history_updates; */
|
327
|
-
|
328
|
-
/* Insert new regions / items */
|
329
|
-
INSERT INTO caddie_crest_price_history_updates( eve_item_id, region_id, created_at, updated_at )
|
330
|
-
SELECT eve_items.id, regions.id, now(), now()
|
331
|
-
FROM eve_items, regions
|
332
|
-
WHERE NOT EXISTS ( SELECT NULL FROM caddie_crest_price_history_updates WHERE eve_item_id = eve_items.id and region_id = regions.id );
|
333
|
-
|
334
|
-
/* Update all datas */
|
335
|
-
UPDATE caddie_crest_price_history_updates cphu
|
336
|
-
SET max_update = sub.mua, max_eve_item_create = sub.max_eve_item_create, max_region_create = sub.max_region_create
|
337
|
-
FROM (
|
338
|
-
SELECT DISTINCT eve_item_id, region_id, MAX( crest_price_histories.updated_at ) mua, MAX( eve_items.created_at ) max_eve_item_create, MAX( regions.created_at ) max_region_create
|
339
|
-
FROM crest_price_histories, eve_items, regions
|
340
|
-
WHERE eve_item_id = eve_items.id
|
341
|
-
AND region_id = regions.id
|
342
|
-
GROUP BY eve_item_id, region_id
|
343
|
-
) sub
|
344
|
-
WHERE cphu.eve_item_id = sub.eve_item_id
|
345
|
-
AND cphu.region_id = sub.region_id;
|
346
|
-
|
347
|
-
UPDATE caddie_crest_price_history_updates cphu SET max_date = GREATEST( max_update, max_eve_item_create, max_region_create );
|
348
|
-
|
349
|
-
UPDATE caddie_crest_price_history_updates cphu SET nb_days = ( CURRENT_DATE - max_date );
|
350
|
-
|
351
|
-
UPDATE caddie_crest_price_history_updates cphu
|
352
|
-
SET process_queue = 'DAILY', next_process_date = current_date, process_queue_priority = 1, updated_at = localtimestamp
|
353
|
-
WHERE nb_days <= 7;
|
354
|
-
|
355
|
-
UPDATE caddie_crest_price_history_updates cphu
|
356
|
-
SET process_queue = 'WEEKLY', next_process_date = date_trunc( 'week', ( current_date + ( interval '1 week' ) ) ), process_queue_priority = 2, updated_at = localtimestamp
|
357
|
-
WHERE nb_days <= 30 AND nb_days > 7;
|
358
|
-
|
359
|
-
UPDATE caddie_crest_price_history_updates cphu
|
360
|
-
SET process_queue = 'MONTHLY', next_process_date = date_trunc( 'month', ( current_date + ( interval '1 month' ) ) ), process_queue_priority = 3, updated_at = localtimestamp
|
361
|
-
WHERE nb_days > 30 OR nb_days IS NULL;
|
362
|
-
|
363
|
-
[0m
|
364
|
-
[1m[35m (0.5ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"]]
|
365
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
366
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 0 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
367
|
-
[1m[36mSQL (0.4ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
368
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
369
|
-
[1m[36mSQL (0.4ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
370
|
-
[1m[35m (0.3ms)[0m COMMIT
|
371
|
-
[1m[36m (4.5ms)[0m [1m/* Don't forget to set the postgres sequence to cycle on production */
|
372
|
-
/* ALTER SEQUENCE caddie_crest_price_history_updates_id_seq CYCLE; */
|
373
|
-
|
374
|
-
/* TRUNCATE TABLE caddie_crest_price_history_updates; */
|
375
|
-
|
376
|
-
/* Insert new regions / items */
|
377
|
-
INSERT INTO caddie_crest_price_history_updates( eve_item_id, region_id, created_at, updated_at )
|
378
|
-
SELECT eve_items.id, regions.id, now(), now()
|
379
|
-
FROM eve_items, regions
|
380
|
-
WHERE NOT EXISTS ( SELECT NULL FROM caddie_crest_price_history_updates WHERE eve_item_id = eve_items.id and region_id = regions.id );
|
381
|
-
|
382
|
-
/* Update all datas */
|
383
|
-
UPDATE caddie_crest_price_history_updates cphu
|
384
|
-
SET max_update = sub.mua, max_eve_item_create = sub.max_eve_item_create, max_region_create = sub.max_region_create
|
385
|
-
FROM (
|
386
|
-
SELECT DISTINCT eve_item_id, region_id, MAX( crest_price_histories.updated_at ) mua, MAX( eve_items.created_at ) max_eve_item_create, MAX( regions.created_at ) max_region_create
|
387
|
-
FROM crest_price_histories, eve_items, regions
|
388
|
-
WHERE eve_item_id = eve_items.id
|
389
|
-
AND region_id = regions.id
|
390
|
-
GROUP BY eve_item_id, region_id
|
391
|
-
) sub
|
392
|
-
WHERE cphu.eve_item_id = sub.eve_item_id
|
393
|
-
AND cphu.region_id = sub.region_id;
|
394
|
-
|
395
|
-
UPDATE caddie_crest_price_history_updates cphu SET max_date = GREATEST( max_update, max_eve_item_create, max_region_create );
|
396
|
-
|
397
|
-
UPDATE caddie_crest_price_history_updates cphu SET nb_days = ( CURRENT_DATE - max_date );
|
398
|
-
|
399
|
-
UPDATE caddie_crest_price_history_updates cphu
|
400
|
-
SET process_queue = 'DAILY', next_process_date = current_date, process_queue_priority = 1, updated_at = localtimestamp
|
401
|
-
WHERE nb_days <= 7;
|
402
|
-
|
403
|
-
UPDATE caddie_crest_price_history_updates cphu
|
404
|
-
SET process_queue = 'WEEKLY', next_process_date = date_trunc( 'week', ( current_date + ( interval '1 week' ) ) ), process_queue_priority = 2, updated_at = localtimestamp
|
405
|
-
WHERE nb_days <= 30 AND nb_days > 7;
|
406
|
-
|
407
|
-
UPDATE caddie_crest_price_history_updates cphu
|
408
|
-
SET process_queue = 'MONTHLY', next_process_date = date_trunc( 'month', ( current_date + ( interval '1 month' ) ) ), process_queue_priority = 3, updated_at = localtimestamp
|
409
|
-
WHERE nb_days > 30 OR nb_days IS NULL;
|
410
|
-
|
411
|
-
[0m
|
412
|
-
[1m[35m (0.6ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"]]
|
413
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
414
|
-
[1m[35mSQL (0.6ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 0 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
415
|
-
[1m[36mSQL (0.6ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
416
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
417
|
-
[1m[36mSQL (0.5ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
418
|
-
[1m[35m (0.2ms)[0m COMMIT
|
419
|
-
[1m[36m (1.4ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 2]]
|
420
|
-
[1m[35m (1.1ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 1]]
|
421
|
-
[1m[36m (1.7ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 0]]
|
422
|
-
[1m[35m (1.0ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 3]]
|
423
|
-
[1m[36m (3.7ms)[0m [1m/* Don't forget to set the postgres sequence to cycle on production */
|
424
|
-
/* ALTER SEQUENCE caddie_crest_price_history_updates_id_seq CYCLE; */
|
425
|
-
|
426
|
-
/* TRUNCATE TABLE caddie_crest_price_history_updates; */
|
427
|
-
|
428
|
-
/* Insert new regions / items */
|
429
|
-
INSERT INTO caddie_crest_price_history_updates( eve_item_id, region_id, created_at, updated_at )
|
430
|
-
SELECT eve_items.id, regions.id, now(), now()
|
431
|
-
FROM eve_items, regions
|
432
|
-
WHERE NOT EXISTS ( SELECT NULL FROM caddie_crest_price_history_updates WHERE eve_item_id = eve_items.id and region_id = regions.id );
|
433
|
-
|
434
|
-
/* Update all datas */
|
435
|
-
UPDATE caddie_crest_price_history_updates cphu
|
436
|
-
SET max_update = sub.mua, max_eve_item_create = sub.max_eve_item_create, max_region_create = sub.max_region_create
|
437
|
-
FROM (
|
438
|
-
SELECT DISTINCT eve_item_id, region_id, MAX( crest_price_histories.updated_at ) mua, MAX( eve_items.created_at ) max_eve_item_create, MAX( regions.created_at ) max_region_create
|
439
|
-
FROM crest_price_histories, eve_items, regions
|
440
|
-
WHERE eve_item_id = eve_items.id
|
441
|
-
AND region_id = regions.id
|
442
|
-
GROUP BY eve_item_id, region_id
|
443
|
-
) sub
|
444
|
-
WHERE cphu.eve_item_id = sub.eve_item_id
|
445
|
-
AND cphu.region_id = sub.region_id;
|
446
|
-
|
447
|
-
UPDATE caddie_crest_price_history_updates cphu SET max_date = GREATEST( max_update, max_eve_item_create, max_region_create );
|
448
|
-
|
449
|
-
UPDATE caddie_crest_price_history_updates cphu SET nb_days = ( CURRENT_DATE - max_date );
|
450
|
-
|
451
|
-
UPDATE caddie_crest_price_history_updates cphu
|
452
|
-
SET process_queue = 'DAILY', next_process_date = current_date, process_queue_priority = 1, updated_at = localtimestamp
|
453
|
-
WHERE nb_days <= 7;
|
454
|
-
|
455
|
-
UPDATE caddie_crest_price_history_updates cphu
|
456
|
-
SET process_queue = 'WEEKLY', next_process_date = date_trunc( 'week', ( current_date + ( interval '1 week' ) ) ), process_queue_priority = 2, updated_at = localtimestamp
|
457
|
-
WHERE nb_days <= 30 AND nb_days > 7;
|
458
|
-
|
459
|
-
UPDATE caddie_crest_price_history_updates cphu
|
460
|
-
SET process_queue = 'MONTHLY', next_process_date = date_trunc( 'month', ( current_date + ( interval '1 month' ) ) ), process_queue_priority = 3, updated_at = localtimestamp
|
461
|
-
WHERE nb_days > 30 OR nb_days IS NULL;
|
462
|
-
|
463
|
-
[0m
|
464
|
-
[1m[35m (0.3ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"]]
|
465
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
466
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 0 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
467
|
-
[1m[36mSQL (0.4ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
468
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
469
|
-
[1m[36mSQL (0.4ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
470
|
-
[1m[35m (0.2ms)[0m COMMIT
|
471
|
-
[1m[36m (1.7ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 0]]
|
472
|
-
[1m[35m (0.7ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 1]]
|
473
|
-
[1m[36m (0.9ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 2]]
|
474
|
-
[1m[35m (0.9ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 3]]
|
475
|
-
[1m[36m (6.7ms)[0m [1m/* Don't forget to set the postgres sequence to cycle on production */
|
476
|
-
/* ALTER SEQUENCE caddie_crest_price_history_updates_id_seq CYCLE; */
|
477
|
-
|
478
|
-
/* TRUNCATE TABLE caddie_crest_price_history_updates; */
|
479
|
-
|
480
|
-
/* Insert new regions / items */
|
481
|
-
INSERT INTO caddie_crest_price_history_updates( eve_item_id, region_id, created_at, updated_at )
|
482
|
-
SELECT eve_items.id, regions.id, now(), now()
|
483
|
-
FROM eve_items, regions
|
484
|
-
WHERE NOT EXISTS ( SELECT NULL FROM caddie_crest_price_history_updates WHERE eve_item_id = eve_items.id and region_id = regions.id );
|
485
|
-
|
486
|
-
/* Update all datas */
|
487
|
-
UPDATE caddie_crest_price_history_updates cphu
|
488
|
-
SET max_update = sub.mua, max_eve_item_create = sub.max_eve_item_create, max_region_create = sub.max_region_create
|
489
|
-
FROM (
|
490
|
-
SELECT DISTINCT eve_item_id, region_id, MAX( crest_price_histories.updated_at ) mua, MAX( eve_items.created_at ) max_eve_item_create, MAX( regions.created_at ) max_region_create
|
491
|
-
FROM crest_price_histories, eve_items, regions
|
492
|
-
WHERE eve_item_id = eve_items.id
|
493
|
-
AND region_id = regions.id
|
494
|
-
GROUP BY eve_item_id, region_id
|
495
|
-
) sub
|
496
|
-
WHERE cphu.eve_item_id = sub.eve_item_id
|
497
|
-
AND cphu.region_id = sub.region_id;
|
498
|
-
|
499
|
-
UPDATE caddie_crest_price_history_updates cphu SET max_date = GREATEST( max_update, max_eve_item_create, max_region_create );
|
500
|
-
|
501
|
-
UPDATE caddie_crest_price_history_updates cphu SET nb_days = ( CURRENT_DATE - max_date );
|
502
|
-
|
503
|
-
UPDATE caddie_crest_price_history_updates cphu
|
504
|
-
SET process_queue = 'DAILY', next_process_date = current_date, process_queue_priority = 1, updated_at = localtimestamp
|
505
|
-
WHERE nb_days <= 7;
|
506
|
-
|
507
|
-
UPDATE caddie_crest_price_history_updates cphu
|
508
|
-
SET process_queue = 'WEEKLY', next_process_date = date_trunc( 'week', ( current_date + ( interval '1 week' ) ) ), process_queue_priority = 2, updated_at = localtimestamp
|
509
|
-
WHERE nb_days <= 30 AND nb_days > 7;
|
510
|
-
|
511
|
-
UPDATE caddie_crest_price_history_updates cphu
|
512
|
-
SET process_queue = 'MONTHLY', next_process_date = date_trunc( 'month', ( current_date + ( interval '1 month' ) ) ), process_queue_priority = 3, updated_at = localtimestamp
|
513
|
-
WHERE nb_days > 30 OR nb_days IS NULL;
|
514
|
-
|
515
|
-
[0m
|
516
|
-
[1m[35m (0.4ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"]]
|
517
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
518
|
-
[1m[35mSQL (0.9ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 0 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
519
|
-
[1m[36mSQL (0.4ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
520
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
521
|
-
[1m[36mSQL (0.6ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
522
|
-
[1m[35m (0.2ms)[0m COMMIT
|
523
|
-
[1m[36m (1.3ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 2]]
|
524
|
-
[1m[35m (3.3ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 1]]
|
525
|
-
[1m[36m (1.2ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 0]]
|
526
|
-
[1m[35m (1.0ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 3]]
|
527
|
-
[1m[36mCaddie::CrestPriceHistoryUpdate Load (0.8ms)[0m [1mSELECT "caddie_crest_price_history_updates".* FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"]]
|
528
|
-
[1m[36m (5.1ms)[0m [1m/* Don't forget to set the postgres sequence to cycle on production */
|
529
|
-
/* ALTER SEQUENCE caddie_crest_price_history_updates_id_seq CYCLE; */
|
530
|
-
|
531
|
-
/* TRUNCATE TABLE caddie_crest_price_history_updates; */
|
532
|
-
|
533
|
-
/* Insert new regions / items */
|
534
|
-
INSERT INTO caddie_crest_price_history_updates( eve_item_id, region_id, created_at, updated_at )
|
535
|
-
SELECT eve_items.id, regions.id, now(), now()
|
536
|
-
FROM eve_items, regions
|
537
|
-
WHERE NOT EXISTS ( SELECT NULL FROM caddie_crest_price_history_updates WHERE eve_item_id = eve_items.id and region_id = regions.id );
|
538
|
-
|
539
|
-
/* Update all datas */
|
540
|
-
UPDATE caddie_crest_price_history_updates cphu
|
541
|
-
SET max_update = sub.mua, max_eve_item_create = sub.max_eve_item_create, max_region_create = sub.max_region_create
|
542
|
-
FROM (
|
543
|
-
SELECT DISTINCT eve_item_id, region_id, MAX( crest_price_histories.updated_at ) mua, MAX( eve_items.created_at ) max_eve_item_create, MAX( regions.created_at ) max_region_create
|
544
|
-
FROM crest_price_histories, eve_items, regions
|
545
|
-
WHERE eve_item_id = eve_items.id
|
546
|
-
AND region_id = regions.id
|
547
|
-
GROUP BY eve_item_id, region_id
|
548
|
-
) sub
|
549
|
-
WHERE cphu.eve_item_id = sub.eve_item_id
|
550
|
-
AND cphu.region_id = sub.region_id;
|
551
|
-
|
552
|
-
UPDATE caddie_crest_price_history_updates cphu SET max_date = GREATEST( max_update, max_eve_item_create, max_region_create );
|
553
|
-
|
554
|
-
UPDATE caddie_crest_price_history_updates cphu SET nb_days = ( CURRENT_DATE - max_date );
|
555
|
-
|
556
|
-
UPDATE caddie_crest_price_history_updates cphu
|
557
|
-
SET process_queue = 'DAILY', next_process_date = current_date, process_queue_priority = 1, updated_at = localtimestamp
|
558
|
-
WHERE nb_days <= 7;
|
559
|
-
|
560
|
-
UPDATE caddie_crest_price_history_updates cphu
|
561
|
-
SET process_queue = 'WEEKLY', next_process_date = date_trunc( 'week', ( current_date + ( interval '1 week' ) ) ), process_queue_priority = 2, updated_at = localtimestamp
|
562
|
-
WHERE nb_days <= 30 AND nb_days > 7;
|
563
|
-
|
564
|
-
UPDATE caddie_crest_price_history_updates cphu
|
565
|
-
SET process_queue = 'MONTHLY', next_process_date = date_trunc( 'month', ( current_date + ( interval '1 month' ) ) ), process_queue_priority = 3, updated_at = localtimestamp
|
566
|
-
WHERE nb_days > 30 OR nb_days IS NULL;
|
567
|
-
|
568
|
-
[0m
|
569
|
-
[1m[35m (0.4ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"]]
|
570
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
571
|
-
[1m[35mSQL (0.5ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 0 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
572
|
-
[1m[36mSQL (0.5ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
573
|
-
[1m[35mSQL (0.2ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
574
|
-
[1m[36mSQL (0.2ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
575
|
-
[1m[35m (0.1ms)[0m COMMIT
|
576
|
-
[1m[36m (1.5ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 1]]
|
577
|
-
[1m[35m (0.8ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 0]]
|
578
|
-
[1m[36m (0.9ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 2]]
|
579
|
-
[1m[35m (0.9ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 3]]
|
580
|
-
[1m[36m (0.3ms)[0m [1mBEGIN[0m
|
581
|
-
[1m[35mSQL (3.4ms)[0m INSERT INTO "caddie_crest_price_history_update_logs" ("feed_date", "update_planning_time", "feeding_time", "total_inserts", "co_seconds", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["feed_date", "2016-07-28"], ["update_planning_time", 0], ["feeding_time", 0], ["total_inserts", 0], ["co_seconds", 0.0], ["created_at", "2016-07-28 09:01:34.922997"], ["updated_at", "2016-07-28 09:01:34.922997"]]
|
582
|
-
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
583
|
-
[1m[36m (5.2ms)[0m [1m/* Don't forget to set the postgres sequence to cycle on production */
|
584
|
-
/* ALTER SEQUENCE caddie_crest_price_history_updates_id_seq CYCLE; */
|
585
|
-
|
586
|
-
/* TRUNCATE TABLE caddie_crest_price_history_updates; */
|
587
|
-
|
588
|
-
/* Insert new regions / items */
|
589
|
-
INSERT INTO caddie_crest_price_history_updates( eve_item_id, region_id, created_at, updated_at )
|
590
|
-
SELECT eve_items.id, regions.id, now(), now()
|
591
|
-
FROM eve_items, regions
|
592
|
-
WHERE NOT EXISTS ( SELECT NULL FROM caddie_crest_price_history_updates WHERE eve_item_id = eve_items.id and region_id = regions.id );
|
593
|
-
|
594
|
-
/* Update all datas */
|
595
|
-
UPDATE caddie_crest_price_history_updates cphu
|
596
|
-
SET max_update = sub.mua, max_eve_item_create = sub.max_eve_item_create, max_region_create = sub.max_region_create
|
597
|
-
FROM (
|
598
|
-
SELECT DISTINCT eve_item_id, region_id, MAX( crest_price_histories.updated_at ) mua, MAX( eve_items.created_at ) max_eve_item_create, MAX( regions.created_at ) max_region_create
|
599
|
-
FROM crest_price_histories, eve_items, regions
|
600
|
-
WHERE eve_item_id = eve_items.id
|
601
|
-
AND region_id = regions.id
|
602
|
-
GROUP BY eve_item_id, region_id
|
603
|
-
) sub
|
604
|
-
WHERE cphu.eve_item_id = sub.eve_item_id
|
605
|
-
AND cphu.region_id = sub.region_id;
|
606
|
-
|
607
|
-
UPDATE caddie_crest_price_history_updates cphu SET max_date = GREATEST( max_update, max_eve_item_create, max_region_create );
|
608
|
-
|
609
|
-
UPDATE caddie_crest_price_history_updates cphu SET nb_days = ( CURRENT_DATE - max_date );
|
610
|
-
|
611
|
-
UPDATE caddie_crest_price_history_updates cphu
|
612
|
-
SET process_queue = 'DAILY', next_process_date = current_date, process_queue_priority = 1, updated_at = localtimestamp
|
613
|
-
WHERE nb_days <= 7;
|
614
|
-
|
615
|
-
UPDATE caddie_crest_price_history_updates cphu
|
616
|
-
SET process_queue = 'WEEKLY', next_process_date = date_trunc( 'week', ( current_date + ( interval '1 week' ) ) ), process_queue_priority = 2, updated_at = localtimestamp
|
617
|
-
WHERE nb_days <= 30 AND nb_days > 7;
|
618
|
-
|
619
|
-
UPDATE caddie_crest_price_history_updates cphu
|
620
|
-
SET process_queue = 'MONTHLY', next_process_date = date_trunc( 'month', ( current_date + ( interval '1 month' ) ) ), process_queue_priority = 3, updated_at = localtimestamp
|
621
|
-
WHERE nb_days > 30 OR nb_days IS NULL;
|
622
|
-
|
623
|
-
[0m
|
624
|
-
[1m[35m (0.4ms)[0m SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"]]
|
625
|
-
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
626
|
-
[1m[35mSQL (1.0ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 0 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
627
|
-
[1m[36mSQL (0.6ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 1 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
628
|
-
[1m[35mSQL (0.4ms)[0m UPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 2 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC) [["next_process_date", "2016-07-28"]]
|
629
|
-
[1m[36mSQL (0.4ms)[0m [1mUPDATE "caddie_crest_price_history_updates" SET "thread_slice_id" = 3 WHERE "caddie_crest_price_history_updates"."id" IN (SELECT "caddie_crest_price_history_updates"."id" FROM "caddie_crest_price_history_updates" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND 1=0 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC)[0m [["next_process_date", "2016-07-28"]]
|
630
|
-
[1m[35m (0.3ms)[0m COMMIT
|
631
|
-
[1m[36m (1.0ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 0]]
|
632
|
-
[1m[35m (0.8ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 1]]
|
633
|
-
[1m[36m (0.9ms)[0m [1mSELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC[0m [["next_process_date", "2016-07-28"], ["thread_slice_id", 2]]
|
634
|
-
[1m[35m (1.0ms)[0m SELECT "caddie_crest_price_history_updates"."eve_item_id", "caddie_crest_price_history_updates"."region_id", cpp_eve_item_id, cpp_region_id FROM "caddie_crest_price_history_updates" INNER JOIN "eve_items" ON "eve_items"."id" = "caddie_crest_price_history_updates"."eve_item_id" INNER JOIN "regions" ON "regions"."id" = "caddie_crest_price_history_updates"."region_id" WHERE "caddie_crest_price_history_updates"."next_process_date" = $1 AND "caddie_crest_price_history_updates"."thread_slice_id" = $2 ORDER BY "caddie_crest_price_history_updates"."process_queue_priority" ASC [["next_process_date", "2016-07-28"], ["thread_slice_id", 3]]
|
635
|
-
[1m[36m (0.3ms)[0m [1mBEGIN[0m
|
636
|
-
[1m[35mSQL (0.9ms)[0m INSERT INTO "caddie_crest_price_history_update_logs" ("feed_date", "update_planning_time", "feeding_time", "total_inserts", "co_seconds", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["feed_date", "2016-07-28"], ["update_planning_time", 0], ["feeding_time", 0], ["total_inserts", 0], ["co_seconds", 0.0], ["created_at", "2016-07-28 09:05:10.978280"], ["updated_at", "2016-07-28 09:05:10.978280"]]
|
637
|
-
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|