mcfly 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +61 -54
- data/README.md +0 -1
- data/lib/mcfly/delete_trig.sql +5 -4
- data/lib/mcfly/insert_trig.sql +2 -2
- data/lib/mcfly/update_append_only_trig.sql +2 -2
- data/lib/mcfly/update_trig.sql +9 -13
- data/lib/mcfly/version.rb +1 -1
- data/spec/dummy/app/models/market_price.rb +1 -3
- data/spec/dummy/app/models/security_instrument.rb +0 -1
- data/spec/dummy/config/application.rb +0 -6
- data/spec/dummy/config/environments/development.rb +2 -3
- data/spec/dummy/config/environments/production.rb +3 -1
- data/spec/dummy/config/environments/test.rb +3 -4
- data/spec/spec_helper.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 325926858c6b7470e2e8ec190e1687acf2333176
|
4
|
+
data.tar.gz: 4954ea54da5a03cd7f792293dd7ce92391ebb07b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2876c9d82c53ce066e856dedd0f4d0d927ba9bd26ba85ebda2dcf03a9d1e75c3662f7581fd4e39c41864a27c8d8e2e04cfc711c2939b1f27c5570b0a7470aeec
|
7
|
+
data.tar.gz: 83af740784adc21713e895e61ac6de18192364b570455db37817785a8dfbb96121702bb1a39f0cb3116ab352cf962299896f308507e2ebddf54b429272464e28
|
data/Gemfile.lock
CHANGED
@@ -8,64 +8,72 @@ PATH
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (
|
12
|
-
|
13
|
-
activesupport (=
|
14
|
-
|
11
|
+
actionpack (4.2.4)
|
12
|
+
actionview (= 4.2.4)
|
13
|
+
activesupport (= 4.2.4)
|
14
|
+
rack (~> 1.6)
|
15
|
+
rack-test (~> 0.6.2)
|
16
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
+
actionview (4.2.4)
|
19
|
+
activesupport (= 4.2.4)
|
20
|
+
builder (~> 3.1)
|
15
21
|
erubis (~> 2.7.0)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
delorean_lang (0.3.17)
|
22
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
activemodel (4.2.4)
|
25
|
+
activesupport (= 4.2.4)
|
26
|
+
builder (~> 3.1)
|
27
|
+
activerecord (4.2.4)
|
28
|
+
activemodel (= 4.2.4)
|
29
|
+
activesupport (= 4.2.4)
|
30
|
+
arel (~> 6.0)
|
31
|
+
activesupport (4.2.4)
|
32
|
+
i18n (~> 0.7)
|
33
|
+
json (~> 1.7, >= 1.7.7)
|
34
|
+
minitest (~> 5.1)
|
35
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
36
|
+
tzinfo (~> 1.1)
|
37
|
+
arel (6.0.3)
|
38
|
+
builder (3.2.2)
|
39
|
+
delorean_lang (0.3.21)
|
35
40
|
activerecord (>= 3.2)
|
36
41
|
treetop (~> 1.5)
|
37
42
|
diff-lcs (1.2.5)
|
38
43
|
erubis (2.7.0)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
i18n (0.7.0)
|
45
|
+
json (1.8.3)
|
46
|
+
loofah (2.0.3)
|
47
|
+
nokogiri (>= 1.5.9)
|
48
|
+
mini_portile (0.6.2)
|
49
|
+
minitest (5.8.1)
|
50
|
+
nokogiri (1.6.6.2)
|
51
|
+
mini_portile (~> 0.6.0)
|
52
|
+
pg (0.18.3)
|
45
53
|
polyglot (0.3.5)
|
46
|
-
rack (1.4
|
47
|
-
rack-
|
48
|
-
rack (>= 0.4)
|
49
|
-
rack-ssl (1.3.4)
|
50
|
-
rack
|
51
|
-
rack-test (0.6.2)
|
54
|
+
rack (1.6.4)
|
55
|
+
rack-test (0.6.3)
|
52
56
|
rack (>= 1.0)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
+
rails-deprecated_sanitizer (1.0.3)
|
58
|
+
activesupport (>= 4.2.0.alpha)
|
59
|
+
rails-dom-testing (1.0.7)
|
60
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
61
|
+
nokogiri (~> 1.6.0)
|
62
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
63
|
+
rails-html-sanitizer (1.0.2)
|
64
|
+
loofah (~> 2.0)
|
65
|
+
railties (4.2.4)
|
66
|
+
actionpack (= 4.2.4)
|
67
|
+
activesupport (= 4.2.4)
|
57
68
|
rake (>= 0.8.7)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
rdoc (3.12.2)
|
62
|
-
json (~> 1.4)
|
63
|
-
rspec-collection_matchers (1.0.0)
|
69
|
+
thor (>= 0.18.1, < 2.0)
|
70
|
+
rake (10.4.2)
|
71
|
+
rspec-collection_matchers (1.1.2)
|
64
72
|
rspec-expectations (>= 2.99.0.beta1)
|
65
73
|
rspec-core (2.99.2)
|
66
74
|
rspec-expectations (2.99.2)
|
67
75
|
diff-lcs (>= 1.1.3, < 2.0)
|
68
|
-
rspec-mocks (2.99.
|
76
|
+
rspec-mocks (2.99.4)
|
69
77
|
rspec-rails (2.99.0)
|
70
78
|
actionpack (>= 3.0)
|
71
79
|
activemodel (>= 3.0)
|
@@ -75,16 +83,12 @@ GEM
|
|
75
83
|
rspec-core (~> 2.99.0)
|
76
84
|
rspec-expectations (~> 2.99.0)
|
77
85
|
rspec-mocks (~> 2.99.0)
|
78
|
-
sprockets (2.2.2)
|
79
|
-
hike (~> 1.2)
|
80
|
-
multi_json (~> 1.0)
|
81
|
-
rack (~> 1.0)
|
82
|
-
tilt (~> 1.1, != 1.3.0)
|
83
86
|
thor (0.19.1)
|
84
|
-
|
85
|
-
treetop (1.6.
|
87
|
+
thread_safe (0.3.5)
|
88
|
+
treetop (1.6.3)
|
86
89
|
polyglot (~> 0.3)
|
87
|
-
tzinfo (
|
90
|
+
tzinfo (1.2.2)
|
91
|
+
thread_safe (~> 0.1)
|
88
92
|
|
89
93
|
PLATFORMS
|
90
94
|
ruby
|
@@ -92,3 +96,6 @@ PLATFORMS
|
|
92
96
|
DEPENDENCIES
|
93
97
|
mcfly!
|
94
98
|
rspec-rails (~> 2.99)
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
1.10.6
|
data/README.md
CHANGED
data/lib/mcfly/delete_trig.sql
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
CREATE OR REPLACE FUNCTION "
|
1
|
+
CREATE OR REPLACE FUNCTION "tr_delete" ()
|
2
2
|
RETURNS TRIGGER
|
3
3
|
AS $$
|
4
4
|
|
@@ -15,8 +15,9 @@ BEGIN
|
|
15
15
|
|
16
16
|
now = now();
|
17
17
|
|
18
|
-
UPDATE
|
19
|
-
SET obsoleted_dt =
|
18
|
+
EXECUTE 'UPDATE ' || TG_RELID::regclass ||
|
19
|
+
' SET obsoleted_dt = $1, o_user_id = $2 where id = $3.id'
|
20
|
+
USING now, whodunnit, OLD;
|
20
21
|
|
21
22
|
RETURN NULL; -- the row is not actually deleted
|
22
23
|
END;
|
@@ -24,4 +25,4 @@ $$ LANGUAGE plpgsql;
|
|
24
25
|
|
25
26
|
DROP TRIGGER IF EXISTS %{table}_delete ON %{table};
|
26
27
|
CREATE TRIGGER "%{table}_delete" BEFORE DELETE ON "%{table}" FOR EACH ROW
|
27
|
-
EXECUTE PROCEDURE "
|
28
|
+
EXECUTE PROCEDURE "tr_delete"();
|
data/lib/mcfly/insert_trig.sql
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
CREATE OR REPLACE FUNCTION "
|
1
|
+
CREATE OR REPLACE FUNCTION "tr_insert" ()
|
2
2
|
RETURNS TRIGGER
|
3
3
|
AS $$
|
4
4
|
BEGIN
|
@@ -24,4 +24,4 @@ $$ LANGUAGE plpgsql;
|
|
24
24
|
|
25
25
|
DROP TRIGGER IF EXISTS %{table}_insert ON %{table};
|
26
26
|
CREATE TRIGGER "%{table}_insert" BEFORE INSERT ON "%{table}" FOR EACH ROW
|
27
|
-
EXECUTE PROCEDURE "
|
27
|
+
EXECUTE PROCEDURE "tr_insert"();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
CREATE OR REPLACE FUNCTION "
|
1
|
+
CREATE OR REPLACE FUNCTION "tr_update_append_only" ()
|
2
2
|
RETURNS TRIGGER
|
3
3
|
AS $$
|
4
4
|
DECLARE
|
@@ -23,4 +23,4 @@ $$ LANGUAGE plpgsql;
|
|
23
23
|
|
24
24
|
DROP TRIGGER IF EXISTS %{table}_update ON %{table};
|
25
25
|
CREATE TRIGGER "%{table}_update" BEFORE UPDATE ON "%{table}" FOR EACH ROW
|
26
|
-
EXECUTE PROCEDURE "
|
26
|
+
EXECUTE PROCEDURE "tr_update_append_only"();
|
data/lib/mcfly/update_trig.sql
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
CREATE OR REPLACE FUNCTION "
|
1
|
+
CREATE OR REPLACE FUNCTION "tr_update" ()
|
2
2
|
RETURNS TRIGGER
|
3
3
|
AS $$
|
4
4
|
DECLARE
|
5
|
-
rec "%{table}";
|
6
5
|
new_id INT4;
|
7
6
|
whodunnit int;
|
8
7
|
|
@@ -20,15 +19,12 @@ BEGIN
|
|
20
19
|
return OLD;
|
21
20
|
END IF;
|
22
21
|
|
23
|
-
-- copy old version of the row into rec
|
24
|
-
SELECT INTO rec * FROM "%{table}" WHERE "id" = NEW.id;
|
25
|
-
|
26
22
|
-- new_id is a new primary key that we'll use for the obsoleted row.
|
27
|
-
SELECT nextval('"
|
23
|
+
SELECT nextval('"' || TG_TABLE_NAME || '_id_seq"') INTO new_id;
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
OLD.id = new_id;
|
26
|
+
OLD.group_id = NEW.id;
|
27
|
+
OLD.o_user_id = NEW.user_id;
|
32
28
|
|
33
29
|
-- FIXME: The following IF/ELSE handles cases where created_dt is
|
34
30
|
-- sent in on update. This is only useful for debugging. Consider
|
@@ -38,18 +34,18 @@ BEGIN
|
|
38
34
|
-- Set the modified row's created_dt. The obsoleted_dt field was
|
39
35
|
-- already infinity, so we don't need to set it.
|
40
36
|
NEW.created_dt = now();
|
41
|
-
|
37
|
+
OLD.obsoleted_dt = now();
|
42
38
|
ELSE
|
43
39
|
IF NEW.created_dt <= OLD.created_dt THEN
|
44
40
|
RAISE EXCEPTION 'new created_dt must be greater than old';
|
45
41
|
END IF;
|
46
42
|
|
47
|
-
|
43
|
+
OLD.obsoleted_dt = NEW.created_dt;
|
48
44
|
END IF;
|
49
45
|
|
50
46
|
-- insert rec, note that the insert trigger will get called. The
|
51
47
|
-- obsoleted_dt is set so INSERT should not do anything with this row.
|
52
|
-
INSERT INTO
|
48
|
+
EXECUTE 'INSERT INTO ' || TG_RELID::regclass || ' values (($1).*)' USING OLD;
|
53
49
|
|
54
50
|
RETURN NEW;
|
55
51
|
END;
|
@@ -57,4 +53,4 @@ $$ LANGUAGE plpgsql;
|
|
57
53
|
|
58
54
|
DROP TRIGGER IF EXISTS %{table}_update ON %{table};
|
59
55
|
CREATE TRIGGER "%{table}_update" BEFORE UPDATE ON "%{table}" FOR EACH ROW
|
60
|
-
EXECUTE PROCEDURE "
|
56
|
+
EXECUTE PROCEDURE "tr_update"();
|
data/lib/mcfly/version.rb
CHANGED
@@ -3,9 +3,7 @@ require 'mcfly'
|
|
3
3
|
class MarketPrice < ActiveRecord::Base
|
4
4
|
has_mcfly
|
5
5
|
|
6
|
-
|
7
|
-
:settlement_mm, :settlement_yy, :price
|
8
|
-
validates_presence_of :security_instrument_id, :coupon,
|
6
|
+
validates_presence_of :security_instrument_id, :coupon,
|
9
7
|
:settlement_mm, :settlement_yy
|
10
8
|
|
11
9
|
mcfly_validates_uniqueness_of :security_instrument_id,
|
@@ -49,12 +49,6 @@ module Dummy
|
|
49
49
|
# like if you have constraints or database-specific column types
|
50
50
|
# config.active_record.schema_format = :sql
|
51
51
|
|
52
|
-
# Enforce whitelist mode for mass assignment.
|
53
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
54
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
55
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
56
|
-
config.active_record.whitelist_attributes = true
|
57
|
-
|
58
52
|
# Enable the asset pipeline
|
59
53
|
config.assets.enabled = true
|
60
54
|
|
@@ -22,9 +22,6 @@ Dummy::Application.configure do
|
|
22
22
|
# Only use best-standards-support built into browsers
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
24
|
|
25
|
-
# Raise exception on mass assignment protection for Active Record models
|
26
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
27
|
-
|
28
25
|
# Log the query plan for queries taking more than this (works
|
29
26
|
# with SQLite, MySQL, and PostgreSQL)
|
30
27
|
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
@@ -34,4 +31,6 @@ Dummy::Application.configure do
|
|
34
31
|
|
35
32
|
# Expands the lines which load the assets
|
36
33
|
config.assets.debug = true
|
34
|
+
|
35
|
+
config.eager_load = false
|
37
36
|
end
|
@@ -9,7 +9,7 @@ Dummy::Application.configure do
|
|
9
9
|
config.action_controller.perform_caching = true
|
10
10
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.
|
12
|
+
config.serve_static_files = false
|
13
13
|
|
14
14
|
# Compress JavaScripts and CSS
|
15
15
|
config.assets.compress = true
|
@@ -64,4 +64,6 @@ Dummy::Application.configure do
|
|
64
64
|
# Log the query plan for queries taking more than this (works
|
65
65
|
# with SQLite, MySQL, and PostgreSQL)
|
66
66
|
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
67
|
+
|
68
|
+
config.eager_load = true
|
67
69
|
end
|
@@ -8,7 +8,7 @@ Dummy::Application.configure do
|
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
|
-
config.
|
11
|
+
config.serve_static_files = true
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
13
13
|
|
14
14
|
# Log error messages when you accidentally call methods on nil
|
@@ -29,9 +29,8 @@ Dummy::Application.configure do
|
|
29
29
|
# ActionMailer::Base.deliveries array.
|
30
30
|
# config.action_mailer.delivery_method = :test
|
31
31
|
|
32
|
-
# Raise exception on mass assignment protection for Active Record models
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
34
|
-
|
35
32
|
# Print deprecation notices to the stderr
|
36
33
|
config.active_support.deprecation = :stderr
|
34
|
+
|
35
|
+
config.eager_load = false
|
37
36
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mcfly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.4.
|
142
|
+
rubygems_version: 2.4.8
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: A database table versioning system.
|