mv-mysql 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e320daa83937ba93169384643381c662857b23
|
4
|
+
data.tar.gz: e9e1cb2fb399ad3bb270d1a2e1274150d33c9f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ea8c2b37d10ce07c45505def703c444e68ddd56afe4575489bb29f57418e0b4a9b3ecc4e3d3f9d939ec868d1c7e2a8c844c3c6dfe8ef0a4b6493e4bb362912
|
7
|
+
data.tar.gz: 0d64dfb7d3546b68f853f14be7ee55106751a355dd9ae0ea7a8915f1cb2f01b90653cedc804184343fc21dd9f40c595e76fe0b16b49c5892de5b4a6646e78d7c
|
data/README.md
CHANGED
@@ -757,6 +757,11 @@ Define validations directly in DB as MySQL constraints and integrate them into y
|
|
757
757
|
|
758
758
|
* Fix issue with invalid parameters number in `add_column` and `change_column` methods
|
759
759
|
|
760
|
+
**(2.2.4)** (23 Nov, 2015)
|
761
|
+
|
762
|
+
* Do not camel case column name in error message
|
763
|
+
* Use SIGNAL to raise validation exception for MySQL >= 5.5
|
764
|
+
|
760
765
|
## Contributing
|
761
766
|
|
762
767
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
@@ -4,8 +4,12 @@ module Mv
|
|
4
4
|
module ConnectionAdapters
|
5
5
|
module MysqlAdapterDecorator
|
6
6
|
include Mv::Core::ActiveRecord::ConnectionAdapters::AbstractAdapterDecorator
|
7
|
+
|
8
|
+
def support_signal?
|
9
|
+
respond_to?(:full_version, true) && full_version >= '5.5'
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
11
|
-
end
|
15
|
+
end
|
@@ -25,7 +25,7 @@ module Mv
|
|
25
25
|
|
26
26
|
|
27
27
|
def drop_trigger_statement table_name
|
28
|
-
"DROP TRIGGER IF EXISTS #{name};"
|
28
|
+
"DROP TRIGGER IF EXISTS #{name};"
|
29
29
|
end
|
30
30
|
|
31
31
|
def create_trigger_statement table_name
|
@@ -40,12 +40,18 @@ module Mv
|
|
40
40
|
def trigger_body(table_name)
|
41
41
|
validation_builders.select{|b| b.table_name == table_name }.collect(&:conditions).flatten.collect do |condition|
|
42
42
|
"IF NOT(#{condition[:statement]}) THEN
|
43
|
-
|
43
|
+
#{raise_error_statement(condition[:message])}
|
44
44
|
END IF".squish
|
45
45
|
end.join("; \n")
|
46
46
|
end
|
47
|
+
|
48
|
+
def raise_error_statement message
|
49
|
+
return "SIGNAL SQLSTATE '45000' SET message_text = '#{message}';" if db.support_signal?
|
50
|
+
|
51
|
+
"SET var = (SELECT MAX(1) FROM `#{message}`);"
|
52
|
+
end
|
47
53
|
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
51
|
-
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mv-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valeriy Prokopchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.2.
|
47
|
+
version: 2.2.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.2.
|
54
|
+
version: 2.2.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jeweler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|