periodic_counter 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/periodic_counter.rb +31 -2
- data/require.rb +1 -1
- data/spec/log/test.log +600 -0
- data/spec/periodic_counter_spec.rb +8 -8
- metadata +2 -2
data/lib/periodic_counter.rb
CHANGED
@@ -48,12 +48,20 @@ class PeriodicCounter
|
|
48
48
|
computed_at = data["#{col}_at"] || Time.now.utc
|
49
49
|
duration = column_to_period_integer(col)
|
50
50
|
time_since_compute = Time.now.utc - computed_at
|
51
|
+
last_day =
|
52
|
+
if col.include?('day')
|
53
|
+
self.class.today
|
54
|
+
elsif col.include?('week')
|
55
|
+
self.class.last_monday
|
56
|
+
elsif col.include?('month')
|
57
|
+
self.class.first_of_the_month
|
58
|
+
end
|
51
59
|
if (time_since_compute - duration) >= 0
|
52
60
|
data[col] = count
|
53
|
-
data["#{col}_at"] =
|
61
|
+
data["#{col}_at"] = last_day
|
54
62
|
else
|
55
63
|
data[col] ||= count
|
56
|
-
data["#{col}_at"] ||=
|
64
|
+
data["#{col}_at"] ||= last_day
|
57
65
|
end
|
58
66
|
record[col] = count - data[col].to_i
|
59
67
|
end
|
@@ -80,4 +88,25 @@ class PeriodicCounter
|
|
80
88
|
end
|
81
89
|
eval(column.join('.'))
|
82
90
|
end
|
91
|
+
|
92
|
+
class <<self
|
93
|
+
|
94
|
+
def first_of_the_month(now=Time.now.utc.to_date)
|
95
|
+
Date.new(now.year, now.month, 1).to_time(:utc)
|
96
|
+
end
|
97
|
+
|
98
|
+
def last_monday(now=Time.now.utc.to_date)
|
99
|
+
wday = now.wday
|
100
|
+
if wday == 0
|
101
|
+
-6
|
102
|
+
else
|
103
|
+
diff = 1 - wday
|
104
|
+
end
|
105
|
+
Date.new(now.year, now.month, now.day + diff).to_time(:utc)
|
106
|
+
end
|
107
|
+
|
108
|
+
def today(now=Time.now.utc.to_date)
|
109
|
+
Date.new(now.year, now.month, now.day).to_time(:utc)
|
110
|
+
end
|
111
|
+
end
|
83
112
|
end
|
data/require.rb
CHANGED
data/spec/log/test.log
CHANGED
@@ -9957,6 +9957,606 @@ counter_last_day: 4
|
|
9957
9957
|
counter_last_day_at: &id001 2010-06-12 22:18:56.313985 Z
|
9958
9958
|
counter_last_2_days_at: *id001
|
9959
9959
|
counter_last_2_days: 4
|
9960
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
9961
|
+
WHERE id = 1
|
9962
|
+
[0m
|
9963
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
9964
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
|
9965
|
+
[4;35;1mSQL (14.5ms)[0m [0mSHOW TABLES[0m
|
9966
|
+
[4;36;1mSQL (13.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
9967
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
9968
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
9969
|
+
Migrating to Counters (1)
|
9970
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
9971
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
9972
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
9973
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
9974
|
+
Migrating to Counters (1)
|
9975
|
+
[4;35;1mSQL (100.5ms)[0m [0mDROP TABLE `counters`[0m
|
9976
|
+
[4;36;1mSQL (0.9ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '1'[0m
|
9977
|
+
[4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m
|
9978
|
+
[4;36;1mSQL (0.3ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
9979
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
9980
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
9981
|
+
Migrating to Counters (1)
|
9982
|
+
[4;35;1mSQL (2.3ms)[0m [0mCREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB[0m
|
9983
|
+
[4;36;1mSQL (18.1ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
9984
|
+
[4;35;1mCounter Columns (187.3ms)[0m [0mSHOW FIELDS FROM `counters`[0m
|
9985
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
9986
|
+
[4;35;1mCounter Create (0.3ms)[0m [0mINSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)[0m
|
9987
|
+
[4;36;1mSQL (0.5ms)[0m [0;1mCOMMIT[0m
|
9988
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
9989
|
+
[4;36;1mSQL (1.3ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
9990
|
+
[4;35;1mSQL (1.6ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
9991
|
+
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
9992
|
+
FROM counters
|
9993
|
+
[0m
|
9994
|
+
[4;35;1mSQL (0.9ms)[0m [0m UPDATE counters
|
9995
|
+
SET counter_data = '---
|
9996
|
+
counter_last_day: 1
|
9997
|
+
counter_last_day_at: 2010-06-14 00:00:00 Z
|
9998
|
+
counter_last_2_days_at: 2010-06-14 00:00:00 Z
|
9999
|
+
counter_last_2_days: 1
|
10000
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10001
|
+
WHERE id = 1
|
10002
|
+
[0m
|
10003
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10004
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10005
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10006
|
+
[4;35;1mCounter Update (0.3ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1[0m
|
10007
|
+
[4;36;1mSQL (2.9ms)[0m [0;1mCOMMIT[0m
|
10008
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10009
|
+
[4;36;1mSQL (1.8ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10010
|
+
[4;35;1mSQL (1.5ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10011
|
+
[4;36;1mSQL (3.1ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10012
|
+
FROM counters
|
10013
|
+
[0m
|
10014
|
+
[4;35;1mSQL (0.7ms)[0m [0m UPDATE counters
|
10015
|
+
SET counter_data = '---
|
10016
|
+
counter_last_day: 1
|
10017
|
+
counter_last_day_at: 2010-06-14 00:00:00 Z
|
10018
|
+
counter_last_2_days_at: 2010-06-14 00:00:00 Z
|
10019
|
+
counter_last_2_days: 1
|
10020
|
+
', counter_last_day = 1, counter_last_2_days = 1
|
10021
|
+
WHERE id = 1
|
10022
|
+
[0m
|
10023
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10024
|
+
[4;35;1mCounter Load (6.1ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10025
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10026
|
+
[4;35;1mCounter Update (0.3ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1[0m
|
10027
|
+
[4;36;1mSQL (0.5ms)[0m [0;1mCOMMIT[0m
|
10028
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10029
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10030
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10031
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10032
|
+
FROM counters
|
10033
|
+
[0m
|
10034
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10035
|
+
SET counter_data = '---
|
10036
|
+
counter_last_day: 3
|
10037
|
+
counter_last_day_at: 2010-06-15 23:46:45.964893 Z
|
10038
|
+
counter_last_2_days_at: 2010-06-14 00:00:00 Z
|
10039
|
+
counter_last_2_days: 1
|
10040
|
+
', counter_last_day = 0, counter_last_2_days = 2
|
10041
|
+
WHERE id = 1
|
10042
|
+
[0m
|
10043
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10044
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10045
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10046
|
+
[4;35;1mCounter Update (0.2ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-15 23:46:45.964893 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1[0m
|
10047
|
+
[4;36;1mSQL (21.0ms)[0m [0;1mCOMMIT[0m
|
10048
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10049
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10050
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10051
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10052
|
+
FROM counters
|
10053
|
+
[0m
|
10054
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10055
|
+
SET counter_data = '---
|
10056
|
+
counter_last_day: 4
|
10057
|
+
counter_last_day_at: &id001 2010-06-16 23:46:46.005453 Z
|
10058
|
+
counter_last_2_days_at: *id001
|
10059
|
+
counter_last_2_days: 4
|
10060
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10061
|
+
WHERE id = 1
|
10062
|
+
[0m
|
10063
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10064
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
|
10065
|
+
[4;35;1mSQL (0.7ms)[0m [0mSHOW TABLES[0m
|
10066
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10067
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10068
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10069
|
+
Migrating to Counters (1)
|
10070
|
+
[4;35;1mSQL (0.8ms)[0m [0mSHOW TABLES[0m
|
10071
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10072
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10073
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10074
|
+
Migrating to Counters (1)
|
10075
|
+
[4;35;1mSQL (21.3ms)[0m [0mDROP TABLE `counters`[0m
|
10076
|
+
[4;36;1mSQL (0.8ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '1'[0m
|
10077
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10078
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10079
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10080
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10081
|
+
Migrating to Counters (1)
|
10082
|
+
[4;35;1mSQL (22.0ms)[0m [0mCREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB[0m
|
10083
|
+
[4;36;1mSQL (0.7ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
10084
|
+
[4;35;1mCounter Columns (1.7ms)[0m [0mSHOW FIELDS FROM `counters`[0m
|
10085
|
+
[4;36;1mSQL (75.0ms)[0m [0;1mBEGIN[0m
|
10086
|
+
[4;35;1mCounter Create (0.3ms)[0m [0mINSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)[0m
|
10087
|
+
[4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m
|
10088
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10089
|
+
[4;36;1mSQL (1.4ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10090
|
+
[4;35;1mSQL (1.4ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10091
|
+
[4;36;1mSQL (0.4ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10092
|
+
FROM counters
|
10093
|
+
[0m
|
10094
|
+
[4;35;1mSQL (0.7ms)[0m [0m UPDATE counters
|
10095
|
+
SET counter_data = '---
|
10096
|
+
counter_last_day: 1
|
10097
|
+
counter_last_day_at: 2010-06-14 00:00:00 Z
|
10098
|
+
counter_last_2_days_at: 2010-06-14 00:00:00 Z
|
10099
|
+
counter_last_2_days: 1
|
10100
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10101
|
+
WHERE id = 1
|
10102
|
+
[0m
|
10103
|
+
[4;36;1mCounter Load (0.3ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10104
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10105
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10106
|
+
[4;35;1mCounter Update (0.3ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1[0m
|
10107
|
+
[4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m
|
10108
|
+
[4;35;1mSQL (0.9ms)[0m [0mSHOW TABLES[0m
|
10109
|
+
[4;36;1mSQL (3.2ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10110
|
+
[4;35;1mSQL (1.7ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10111
|
+
[4;36;1mSQL (0.4ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10112
|
+
FROM counters
|
10113
|
+
[0m
|
10114
|
+
[4;35;1mSQL (0.7ms)[0m [0m UPDATE counters
|
10115
|
+
SET counter_data = '---
|
10116
|
+
counter_last_day: 2
|
10117
|
+
counter_last_day_at: 2010-06-14 00:00:00 Z
|
10118
|
+
counter_last_2_days_at: 2010-06-14 00:00:00 Z
|
10119
|
+
counter_last_2_days: 1
|
10120
|
+
', counter_last_day = 0, counter_last_2_days = 1
|
10121
|
+
WHERE id = 1
|
10122
|
+
[0m
|
10123
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10124
|
+
[4;35;1mCounter Load (1.0ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10125
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10126
|
+
[4;35;1mCounter Update (0.4ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 2\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1[0m
|
10127
|
+
[4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m
|
10128
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10129
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10130
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10131
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10132
|
+
FROM counters
|
10133
|
+
[0m
|
10134
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10135
|
+
SET counter_data = '---
|
10136
|
+
counter_last_day: 3
|
10137
|
+
counter_last_day_at: 2010-06-16 00:00:00 Z
|
10138
|
+
counter_last_2_days_at: 2010-06-16 00:00:00 Z
|
10139
|
+
counter_last_2_days: 3
|
10140
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10141
|
+
WHERE id = 1
|
10142
|
+
[0m
|
10143
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10144
|
+
[4;35;1mCounter Load (1.2ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10145
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10146
|
+
[4;35;1mCounter Update (0.3ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 3\ncounter_last_2_days_at: 2010-06-16 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1[0m
|
10147
|
+
[4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m
|
10148
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10149
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10150
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10151
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10152
|
+
FROM counters
|
10153
|
+
[0m
|
10154
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10155
|
+
SET counter_data = '---
|
10156
|
+
counter_last_day: 4
|
10157
|
+
counter_last_day_at: 2010-06-17 00:00:00 Z
|
10158
|
+
counter_last_2_days_at: 2010-06-16 00:00:00 Z
|
10159
|
+
counter_last_2_days: 3
|
10160
|
+
', counter_last_day = 0, counter_last_2_days = 1
|
10161
|
+
WHERE id = 1
|
10162
|
+
[0m
|
10163
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10164
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
|
10165
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10166
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10167
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10168
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10169
|
+
Migrating to Counters (1)
|
10170
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10171
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10172
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10173
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10174
|
+
Migrating to Counters (1)
|
10175
|
+
[4;35;1mSQL (10.6ms)[0m [0mDROP TABLE `counters`[0m
|
10176
|
+
[4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '1'[0m
|
10177
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10178
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10179
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10180
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10181
|
+
Migrating to Counters (1)
|
10182
|
+
[4;35;1mSQL (1.8ms)[0m [0mCREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB[0m
|
10183
|
+
[4;36;1mSQL (0.5ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
10184
|
+
[4;35;1mCounter Columns (1.4ms)[0m [0mSHOW FIELDS FROM `counters`[0m
|
10185
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10186
|
+
[4;35;1mCounter Create (0.3ms)[0m [0mINSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)[0m
|
10187
|
+
[4;36;1mSQL (0.5ms)[0m [0;1mCOMMIT[0m
|
10188
|
+
[4;35;1mSQL (0.6ms)[0m [0mSHOW TABLES[0m
|
10189
|
+
[4;36;1mSQL (1.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10190
|
+
[4;35;1mSQL (1.7ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10191
|
+
[4;36;1mSQL (0.4ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10192
|
+
FROM counters
|
10193
|
+
[0m
|
10194
|
+
[4;35;1mSQL (31.1ms)[0m [0m UPDATE counters
|
10195
|
+
SET counter_data = '---
|
10196
|
+
counter_last_day: 1
|
10197
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10198
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10199
|
+
counter_last_2_days: 1
|
10200
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10201
|
+
WHERE id = 1
|
10202
|
+
[0m
|
10203
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10204
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10205
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10206
|
+
[4;35;1mCounter Update (3.7ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1[0m
|
10207
|
+
[4;36;1mSQL (0.4ms)[0m [0;1mCOMMIT[0m
|
10208
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10209
|
+
[4;36;1mSQL (1.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10210
|
+
[4;35;1mSQL (3.5ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10211
|
+
[4;36;1mSQL (0.7ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10212
|
+
FROM counters
|
10213
|
+
[0m
|
10214
|
+
[4;35;1mSQL (1.0ms)[0m [0m UPDATE counters
|
10215
|
+
SET counter_data = '---
|
10216
|
+
counter_last_day: 1
|
10217
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10218
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10219
|
+
counter_last_2_days: 1
|
10220
|
+
', counter_last_day = 1, counter_last_2_days = 1
|
10221
|
+
WHERE id = 1
|
10222
|
+
[0m
|
10223
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10224
|
+
[4;35;1mCounter Load (0.7ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10225
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10226
|
+
[4;35;1mCounter Update (0.2ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1[0m
|
10227
|
+
[4;36;1mSQL (0.9ms)[0m [0;1mCOMMIT[0m
|
10228
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10229
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10230
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10231
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10232
|
+
FROM counters
|
10233
|
+
[0m
|
10234
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10235
|
+
SET counter_data = '---
|
10236
|
+
counter_last_day: 3
|
10237
|
+
counter_last_day_at: 2010-06-16 00:00:00 Z
|
10238
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10239
|
+
counter_last_2_days: 1
|
10240
|
+
', counter_last_day = 0, counter_last_2_days = 2
|
10241
|
+
WHERE id = 1
|
10242
|
+
[0m
|
10243
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10244
|
+
[4;35;1mCounter Load (0.7ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10245
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10246
|
+
[4;35;1mCounter Update (0.8ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1[0m
|
10247
|
+
[4;36;1mSQL (0.4ms)[0m [0;1mCOMMIT[0m
|
10248
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10249
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10250
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10251
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10252
|
+
FROM counters
|
10253
|
+
[0m
|
10254
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10255
|
+
SET counter_data = '---
|
10256
|
+
counter_last_day: 4
|
10257
|
+
counter_last_day_at: 2010-06-17 00:00:00 Z
|
10258
|
+
counter_last_2_days_at: 2010-06-17 00:00:00 Z
|
10259
|
+
counter_last_2_days: 4
|
10260
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10261
|
+
WHERE id = 1
|
10262
|
+
[0m
|
10263
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10264
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
|
10265
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10266
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10267
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10268
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10269
|
+
Migrating to Counters (1)
|
10270
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10271
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10272
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10273
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10274
|
+
Migrating to Counters (1)
|
10275
|
+
[4;35;1mSQL (10.4ms)[0m [0mDROP TABLE `counters`[0m
|
10276
|
+
[4;36;1mSQL (0.8ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '1'[0m
|
10277
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10278
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10279
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10280
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10281
|
+
Migrating to Counters (1)
|
10282
|
+
[4;35;1mSQL (1.9ms)[0m [0mCREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB[0m
|
10283
|
+
[4;36;1mSQL (53.9ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
10284
|
+
[4;35;1mCounter Columns (1.3ms)[0m [0mSHOW FIELDS FROM `counters`[0m
|
10285
|
+
[4;36;1mSQL (0.8ms)[0m [0;1mBEGIN[0m
|
10286
|
+
[4;35;1mCounter Create (0.3ms)[0m [0mINSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)[0m
|
10287
|
+
[4;36;1mSQL (0.7ms)[0m [0;1mCOMMIT[0m
|
10288
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10289
|
+
[4;36;1mSQL (10.9ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10290
|
+
[4;35;1mSQL (1.5ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10291
|
+
[4;36;1mSQL (0.7ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10292
|
+
FROM counters
|
10293
|
+
[0m
|
10294
|
+
[4;35;1mSQL (0.6ms)[0m [0m UPDATE counters
|
10295
|
+
SET counter_data = '---
|
10296
|
+
counter_last_day: 1
|
10297
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10298
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10299
|
+
counter_last_2_days: 1
|
10300
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10301
|
+
WHERE id = 1
|
10302
|
+
[0m
|
10303
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10304
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10305
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10306
|
+
[4;35;1mCounter Update (1.7ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1[0m
|
10307
|
+
[4;36;1mSQL (1.4ms)[0m [0;1mCOMMIT[0m
|
10308
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10309
|
+
[4;36;1mSQL (1.9ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10310
|
+
[4;35;1mSQL (1.5ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10311
|
+
[4;36;1mSQL (0.7ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10312
|
+
FROM counters
|
10313
|
+
[0m
|
10314
|
+
[4;35;1mSQL (0.6ms)[0m [0m UPDATE counters
|
10315
|
+
SET counter_data = '---
|
10316
|
+
counter_last_day: 1
|
10317
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10318
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10319
|
+
counter_last_2_days: 1
|
10320
|
+
', counter_last_day = 1, counter_last_2_days = 1
|
10321
|
+
WHERE id = 1
|
10322
|
+
[0m
|
10323
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10324
|
+
[4;35;1mCounter Load (0.6ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10325
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10326
|
+
[4;35;1mCounter Update (0.2ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1[0m
|
10327
|
+
[4;36;1mSQL (3.0ms)[0m [0;1mCOMMIT[0m
|
10328
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10329
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10330
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10331
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10332
|
+
FROM counters
|
10333
|
+
[0m
|
10334
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10335
|
+
SET counter_data = '---
|
10336
|
+
counter_last_day: 3
|
10337
|
+
counter_last_day_at: 2010-06-16 00:00:00 Z
|
10338
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10339
|
+
counter_last_2_days: 1
|
10340
|
+
', counter_last_day = 0, counter_last_2_days = 2
|
10341
|
+
WHERE id = 1
|
10342
|
+
[0m
|
10343
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10344
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10345
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10346
|
+
[4;35;1mCounter Update (0.3ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1[0m
|
10347
|
+
[4;36;1mSQL (0.9ms)[0m [0;1mCOMMIT[0m
|
10348
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10349
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10350
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10351
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10352
|
+
FROM counters
|
10353
|
+
[0m
|
10354
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10355
|
+
SET counter_data = '---
|
10356
|
+
counter_last_day: 4
|
10357
|
+
counter_last_day_at: 2010-06-17 00:00:00 Z
|
10358
|
+
counter_last_2_days_at: 2010-06-17 00:00:00 Z
|
10359
|
+
counter_last_2_days: 4
|
10360
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10361
|
+
WHERE id = 1
|
10362
|
+
[0m
|
10363
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10364
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
|
10365
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10366
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10367
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10368
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10369
|
+
Migrating to Counters (1)
|
10370
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10371
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10372
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10373
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10374
|
+
Migrating to Counters (1)
|
10375
|
+
[4;35;1mSQL (45.9ms)[0m [0mDROP TABLE `counters`[0m
|
10376
|
+
[4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '1'[0m
|
10377
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10378
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10379
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10380
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10381
|
+
Migrating to Counters (1)
|
10382
|
+
[4;35;1mSQL (2.0ms)[0m [0mCREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB[0m
|
10383
|
+
[4;36;1mSQL (0.6ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
10384
|
+
[4;35;1mCounter Columns (1.6ms)[0m [0mSHOW FIELDS FROM `counters`[0m
|
10385
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10386
|
+
[4;35;1mCounter Create (0.3ms)[0m [0mINSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)[0m
|
10387
|
+
[4;36;1mSQL (0.5ms)[0m [0;1mCOMMIT[0m
|
10388
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10389
|
+
[4;36;1mSQL (1.3ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10390
|
+
[4;35;1mSQL (1.7ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10391
|
+
[4;36;1mSQL (0.2ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10392
|
+
FROM counters
|
10393
|
+
[0m
|
10394
|
+
[4;35;1mSQL (0.7ms)[0m [0m UPDATE counters
|
10395
|
+
SET counter_data = '---
|
10396
|
+
counter_last_day: 1
|
10397
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10398
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10399
|
+
counter_last_2_days: 1
|
10400
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10401
|
+
WHERE id = 1
|
10402
|
+
[0m
|
10403
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10404
|
+
[4;35;1mCounter Load (0.2ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10405
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10406
|
+
[4;35;1mCounter Update (0.4ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1[0m
|
10407
|
+
[4;36;1mSQL (0.8ms)[0m [0;1mCOMMIT[0m
|
10408
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10409
|
+
[4;36;1mSQL (1.3ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10410
|
+
[4;35;1mSQL (13.1ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10411
|
+
[4;36;1mSQL (0.3ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10412
|
+
FROM counters
|
10413
|
+
[0m
|
10414
|
+
[4;35;1mSQL (0.8ms)[0m [0m UPDATE counters
|
10415
|
+
SET counter_data = '---
|
10416
|
+
counter_last_day: 1
|
10417
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10418
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10419
|
+
counter_last_2_days: 1
|
10420
|
+
', counter_last_day = 1, counter_last_2_days = 1
|
10421
|
+
WHERE id = 1
|
10422
|
+
[0m
|
10423
|
+
[4;36;1mCounter Load (0.3ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10424
|
+
[4;35;1mCounter Load (0.3ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10425
|
+
[4;36;1mSQL (0.8ms)[0m [0;1mBEGIN[0m
|
10426
|
+
[4;35;1mCounter Update (0.3ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1[0m
|
10427
|
+
[4;36;1mSQL (0.6ms)[0m [0;1mCOMMIT[0m
|
10428
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10429
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10430
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10431
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10432
|
+
FROM counters
|
10433
|
+
[0m
|
10434
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10435
|
+
SET counter_data = '---
|
10436
|
+
counter_last_day: 3
|
10437
|
+
counter_last_day_at: 2010-06-16 00:00:00 Z
|
10438
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10439
|
+
counter_last_2_days: 1
|
10440
|
+
', counter_last_day = 0, counter_last_2_days = 2
|
10441
|
+
WHERE id = 1
|
10442
|
+
[0m
|
10443
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10444
|
+
[4;35;1mCounter Load (0.2ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10445
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10446
|
+
[4;35;1mCounter Update (0.2ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1[0m
|
10447
|
+
[4;36;1mSQL (1.0ms)[0m [0;1mCOMMIT[0m
|
10448
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10449
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10450
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10451
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10452
|
+
FROM counters
|
10453
|
+
[0m
|
10454
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10455
|
+
SET counter_data = '---
|
10456
|
+
counter_last_day: 4
|
10457
|
+
counter_last_day_at: 2010-06-17 00:00:00 Z
|
10458
|
+
counter_last_2_days_at: 2010-06-17 00:00:00 Z
|
10459
|
+
counter_last_2_days: 4
|
10460
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10461
|
+
WHERE id = 1
|
10462
|
+
[0m
|
10463
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10464
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSET SQL_AUTO_IS_NULL=0[0m
|
10465
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10466
|
+
[4;36;1mSQL (0.3ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10467
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10468
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10469
|
+
Migrating to Counters (1)
|
10470
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10471
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10472
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10473
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10474
|
+
Migrating to Counters (1)
|
10475
|
+
[4;35;1mSQL (36.2ms)[0m [0mDROP TABLE `counters`[0m
|
10476
|
+
[4;36;1mSQL (0.7ms)[0m [0;1mDELETE FROM schema_migrations WHERE version = '1'[0m
|
10477
|
+
[4;35;1mSQL (0.4ms)[0m [0mSHOW TABLES[0m
|
10478
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10479
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10480
|
+
[4;36;1mSQL (0.2ms)[0m [0;1mSELECT version FROM schema_migrations[0m
|
10481
|
+
Migrating to Counters (1)
|
10482
|
+
[4;35;1mSQL (2.0ms)[0m [0mCREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB[0m
|
10483
|
+
[4;36;1mSQL (0.9ms)[0m [0;1mINSERT INTO schema_migrations (version) VALUES ('1')[0m
|
10484
|
+
[4;35;1mCounter Columns (74.3ms)[0m [0mSHOW FIELDS FROM `counters`[0m
|
10485
|
+
[4;36;1mSQL (0.4ms)[0m [0;1mBEGIN[0m
|
10486
|
+
[4;35;1mCounter Create (0.3ms)[0m [0mINSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)[0m
|
10487
|
+
[4;36;1mSQL (0.4ms)[0m [0;1mCOMMIT[0m
|
10488
|
+
[4;35;1mSQL (0.3ms)[0m [0mSHOW TABLES[0m
|
10489
|
+
[4;36;1mSQL (1.1ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10490
|
+
[4;35;1mSQL (1.5ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10491
|
+
[4;36;1mSQL (0.7ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10492
|
+
FROM counters
|
10493
|
+
[0m
|
10494
|
+
[4;35;1mSQL (0.6ms)[0m [0m UPDATE counters
|
10495
|
+
SET counter_data = '---
|
10496
|
+
counter_last_day: 1
|
10497
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10498
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10499
|
+
counter_last_2_days: 1
|
10500
|
+
', counter_last_day = 0, counter_last_2_days = 0
|
10501
|
+
WHERE id = 1
|
10502
|
+
[0m
|
10503
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10504
|
+
[4;35;1mCounter Load (0.2ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10505
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10506
|
+
[4;35;1mCounter Update (0.4ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1[0m
|
10507
|
+
[4;36;1mSQL (0.7ms)[0m [0;1mCOMMIT[0m
|
10508
|
+
[4;35;1mSQL (0.2ms)[0m [0mSHOW TABLES[0m
|
10509
|
+
[4;36;1mSQL (1.4ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10510
|
+
[4;35;1mSQL (1.3ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10511
|
+
[4;36;1mSQL (0.7ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10512
|
+
FROM counters
|
10513
|
+
[0m
|
10514
|
+
[4;35;1mSQL (0.8ms)[0m [0m UPDATE counters
|
10515
|
+
SET counter_data = '---
|
10516
|
+
counter_last_day: 1
|
10517
|
+
counter_last_day_at: 2010-06-15 00:00:00 Z
|
10518
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10519
|
+
counter_last_2_days: 1
|
10520
|
+
', counter_last_day = 1, counter_last_2_days = 1
|
10521
|
+
WHERE id = 1
|
10522
|
+
[0m
|
10523
|
+
[4;36;1mCounter Load (0.2ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10524
|
+
[4;35;1mCounter Load (0.2ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10525
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10526
|
+
[4;35;1mCounter Update (0.2ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1[0m
|
10527
|
+
[4;36;1mSQL (0.4ms)[0m [0;1mCOMMIT[0m
|
10528
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10529
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10530
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10531
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10532
|
+
FROM counters
|
10533
|
+
[0m
|
10534
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10535
|
+
SET counter_data = '---
|
10536
|
+
counter_last_day: 3
|
10537
|
+
counter_last_day_at: 2010-06-16 00:00:00 Z
|
10538
|
+
counter_last_2_days_at: 2010-06-15 00:00:00 Z
|
10539
|
+
counter_last_2_days: 1
|
10540
|
+
', counter_last_day = 0, counter_last_2_days = 2
|
10541
|
+
WHERE id = 1
|
10542
|
+
[0m
|
10543
|
+
[4;36;1mCounter Load (0.0ms)[0m [0;1mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10544
|
+
[4;35;1mCounter Load (0.2ms)[0m [0mSELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1[0m
|
10545
|
+
[4;36;1mSQL (0.1ms)[0m [0;1mBEGIN[0m
|
10546
|
+
[4;35;1mCounter Update (0.2ms)[0m [0mUPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1[0m
|
10547
|
+
[4;36;1mSQL (0.4ms)[0m [0;1mCOMMIT[0m
|
10548
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW TABLES[0m
|
10549
|
+
[4;36;1mSQL (0.0ms)[0m [0;1mSHOW FIELDS FROM `counters`[0m
|
10550
|
+
[4;35;1mSQL (0.0ms)[0m [0mSHOW FIELDS FROM `schema_migrations`[0m
|
10551
|
+
[4;36;1mSQL (0.0ms)[0m [0;1m SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
|
10552
|
+
FROM counters
|
10553
|
+
[0m
|
10554
|
+
[4;35;1mSQL (0.0ms)[0m [0m UPDATE counters
|
10555
|
+
SET counter_data = '---
|
10556
|
+
counter_last_day: 4
|
10557
|
+
counter_last_day_at: 2010-06-17 00:00:00 Z
|
10558
|
+
counter_last_2_days_at: 2010-06-17 00:00:00 Z
|
10559
|
+
counter_last_2_days: 4
|
9960
10560
|
', counter_last_day = 0, counter_last_2_days = 0
|
9961
10561
|
WHERE id = 1
|
9962
10562
|
[0m
|
@@ -13,8 +13,8 @@ describe PeriodicCounter do
|
|
13
13
|
start
|
14
14
|
attributes = Counter.last.attributes
|
15
15
|
data = attributes.delete('counter_data')
|
16
|
-
data.delete('counter_last_day_at').to_s.should ==
|
17
|
-
data.delete('counter_last_2_days_at').to_s.should ==
|
16
|
+
data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
|
17
|
+
data.delete('counter_last_2_days_at').to_s.should == PeriodicCounter.today.to_s
|
18
18
|
data.should == {
|
19
19
|
"counter_last_day"=>1,
|
20
20
|
"counter_last_2_days"=>1
|
@@ -32,8 +32,8 @@ describe PeriodicCounter do
|
|
32
32
|
start
|
33
33
|
attributes = Counter.last.attributes
|
34
34
|
data = attributes.delete('counter_data')
|
35
|
-
data.delete('counter_last_day_at').to_s.should ==
|
36
|
-
data.delete('counter_last_2_days_at').to_s.should ==
|
35
|
+
data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
|
36
|
+
data.delete('counter_last_2_days_at').to_s.should == PeriodicCounter.today.to_s
|
37
37
|
data.should == {
|
38
38
|
"counter_last_day"=>1,
|
39
39
|
"counter_last_2_days"=>1
|
@@ -52,8 +52,8 @@ describe PeriodicCounter do
|
|
52
52
|
start
|
53
53
|
attributes = Counter.last.attributes
|
54
54
|
data = attributes.delete('counter_data')
|
55
|
-
data.delete('counter_last_day_at').to_s.should ==
|
56
|
-
data.delete('counter_last_2_days_at').to_s.should == (
|
55
|
+
data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
|
56
|
+
data.delete('counter_last_2_days_at').to_s.should == (PeriodicCounter.today - 1.day).to_s
|
57
57
|
data.should == {
|
58
58
|
"counter_last_day"=>3,
|
59
59
|
"counter_last_2_days"=>1
|
@@ -72,8 +72,8 @@ describe PeriodicCounter do
|
|
72
72
|
start
|
73
73
|
attributes = Counter.last.attributes
|
74
74
|
data = attributes.delete('counter_data')
|
75
|
-
data.delete('counter_last_day_at').to_s.should ==
|
76
|
-
data.delete('counter_last_2_days_at').to_s.should ==
|
75
|
+
data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
|
76
|
+
data.delete('counter_last_2_days_at').to_s.should == PeriodicCounter.today.to_s
|
77
77
|
data.should == {
|
78
78
|
"counter_last_day"=>4,
|
79
79
|
"counter_last_2_days"=>4
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: periodic_counter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winton Welsh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-06-
|
12
|
+
date: 2010-06-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|