schema_plus 1.8.3 → 1.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/README.md +6 -0
- data/lib/schema_plus/active_record/connection_adapters/abstract_adapter.rb +1 -1
- data/lib/schema_plus/version.rb +1 -1
- data/schema_plus.gemspec +1 -1
- data/spec/migration_spec.rb +7 -0
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b535cbef242d2c3616d089e7ef267ffcda421a06
|
4
|
+
data.tar.gz: e788022566d93869fd22c992c1e15b6acee28bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c4bb4ccada1450523f33121bf5c7f4071c53f1714c6fbe6cd1c32efdce9aa85ddf7130194332b048127af5ef18ecbff4b738be8e6e172126d68abf686e9e0c2
|
7
|
+
data.tar.gz: c5f26b566f7cc429eb62d53a0d1f84faed2583b4bbc1f76b0ceabcc6e44ad3f80571456aef55a614720a9a106ea38e89bb18c508b3839eb91943c85591d57f28
|
data/.travis.yml
CHANGED
@@ -23,6 +23,8 @@ gemfile:
|
|
23
23
|
- gemfiles/rails-4.2/Gemfile.postgresql
|
24
24
|
- gemfiles/rails-4.2/Gemfile.sqlite3
|
25
25
|
env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
|
26
|
+
addons:
|
27
|
+
postgresql: '9.3'
|
26
28
|
before_script: bundle exec rake create_databases
|
27
29
|
after_script: bundle exec rake drop_databases
|
28
30
|
script: bundle exec rake travis
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -258,6 +258,12 @@ resolves to:
|
|
258
258
|
NOW() # PostgreSQL
|
259
259
|
(DATETIME('now')) # SQLite3
|
260
260
|
invalid # MySQL
|
261
|
+
|
262
|
+
If you are using Postgresql with a `json` column, the default value may be an unadorned hash. A hash having just one key `:expr` or `:value` will be taken as schema_plus syntax; i.e, these two are equivalent:
|
263
|
+
|
264
|
+
t.json :fields, default: { field1: 'a', field2: 'b' }
|
265
|
+
t.json :fields, default: { value: { field1: 'a', field2: 'b' } }
|
266
|
+
|
261
267
|
|
262
268
|
### Column Defaults: Using
|
263
269
|
|
@@ -199,7 +199,7 @@ module SchemaPlus
|
|
199
199
|
if options_include_default?(options)
|
200
200
|
default = options[:default]
|
201
201
|
|
202
|
-
if default.is_a? Hash
|
202
|
+
if default.is_a? Hash and [[:expr], [:value]].include?(default.keys)
|
203
203
|
value = default[:value]
|
204
204
|
expr = sql_for_function(default[:expr]) || default[:expr] if default[:expr]
|
205
205
|
else
|
data/lib/schema_plus/version.rb
CHANGED
data/schema_plus.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency("activerecord", ">= 3.2", "< 4.3")
|
25
25
|
s.add_dependency("valuable")
|
26
26
|
|
27
|
-
s.add_development_dependency("schema_dev", "~> 1.
|
27
|
+
s.add_development_dependency("schema_dev", "~> 1.4")
|
28
28
|
s.add_development_dependency("rake")
|
29
29
|
s.add_development_dependency("rspec", "~> 3.0.0")
|
30
30
|
s.add_development_dependency("rdoc")
|
data/spec/migration_spec.rb
CHANGED
@@ -49,6 +49,13 @@ describe ActiveRecord::Migration do
|
|
49
49
|
expect(@model.create.reload.bool).to be true
|
50
50
|
end
|
51
51
|
|
52
|
+
it "should properly handle default values for json (#195)", :postgresql => :only do
|
53
|
+
recreate_table(@model) do |t|
|
54
|
+
t.json :json, :default => {}
|
55
|
+
end
|
56
|
+
expect(@model.create.reload.json).to eq({})
|
57
|
+
end if ActiveRecord::VERSION::MAJOR >= 4
|
58
|
+
|
52
59
|
it "should create auto foreign keys" do
|
53
60
|
recreate_table(@model) do |t|
|
54
61
|
t.integer :user_id
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronen Barzel
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -51,20 +51,14 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 1.2.5
|
54
|
+
version: '1.4'
|
58
55
|
type: :development
|
59
56
|
prerelease: false
|
60
57
|
version_requirements: !ruby/object:Gem::Requirement
|
61
58
|
requirements:
|
62
59
|
- - "~>"
|
63
60
|
- !ruby/object:Gem::Version
|
64
|
-
version: '1.
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 1.2.5
|
61
|
+
version: '1.4'
|
68
62
|
- !ruby/object:Gem::Dependency
|
69
63
|
name: rake
|
70
64
|
requirement: !ruby/object:Gem::Requirement
|