db_nazi 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/CHANGELOG +4 -0
- data/lib/db_nazi/abstract_adapter.rb +11 -0
- data/lib/db_nazi/version.rb +1 -1
- data/test/unit/db_nazi/test_abstract_adapter.rb +17 -0
- metadata +40 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 64401fa9a2cbe3de9dd57b244ceb4988e4ce9a9e
|
4
|
+
data.tar.gz: 6d8ed847a5afd8626962935e6b6bfc7712c8cc46
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eef318da73d25b2985092afa1f37043a315ec256d02375f62d825e0e038ed4a52e9538f775bd4f938b3fae877f449cc57c7ceda308e0492e2f2b972bf7facb82
|
7
|
+
data.tar.gz: 1c65a04a5573b0b7ebeffc260e1c1fb5b62066e9f39238d79110c4d963153fd396c4fbc037a5a424ce53b5374b6dc3065ee9d57b36e098e6139789a099e0dcaa
|
data/CHANGELOG
CHANGED
@@ -29,6 +29,17 @@ module DBNazi
|
|
29
29
|
super
|
30
30
|
end
|
31
31
|
|
32
|
+
def change_column_default(table_name, column_name, default)
|
33
|
+
original_nullability = DBNazi.require_nullability
|
34
|
+
begin
|
35
|
+
DBNazi.require_nullability = false
|
36
|
+
return_val = super
|
37
|
+
ensure
|
38
|
+
DBNazi.require_nullability = original_nullability
|
39
|
+
return_val
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
32
43
|
def create_table(name, *)
|
33
44
|
if name.to_s == ActiveRecord::Migrator.schema_migrations_table_name.to_s
|
34
45
|
DBNazi.disable { super }
|
data/lib/db_nazi/version.rb
CHANGED
@@ -122,6 +122,23 @@ describe DBNazi::AbstractAdapter do
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
+
describe "#change_column_default" do
|
126
|
+
before do
|
127
|
+
connection.add_column 'test_table', 'test_column', :integer, null: false, default: 1
|
128
|
+
end
|
129
|
+
|
130
|
+
it "still changes the column default if ok" do
|
131
|
+
connection.change_column_default 'test_table', 'test_column', 2
|
132
|
+
connection.column_exists?('test_table', 'test_column', :integer, null: false, default: 2).must_equal true
|
133
|
+
end
|
134
|
+
|
135
|
+
it "restores the value of the nullability check" do
|
136
|
+
DBNazi.require_nullability.must_equal true
|
137
|
+
connection.change_column_default 'test_table', 'test_column', 2
|
138
|
+
DBNazi.require_nullability.must_equal true
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
125
142
|
describe "#add_index" do
|
126
143
|
before do
|
127
144
|
connection.add_column 'test_table', 'test_column', :boolean, null: true
|
metadata
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_nazi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- George Ogata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "<"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5'
|
11
|
+
|
12
|
+
date: 2014-02-26 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
20
15
|
type: :runtime
|
16
|
+
name: activerecord
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - <
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: "5"
|
21
22
|
prerelease: false
|
22
|
-
version_requirements:
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5'
|
27
|
-
description: ''
|
28
|
-
email:
|
23
|
+
version_requirements: *id001
|
24
|
+
description: ""
|
25
|
+
email:
|
29
26
|
- george.ogata@gmail.com
|
30
27
|
executables: []
|
28
|
+
|
31
29
|
extensions: []
|
30
|
+
|
32
31
|
extra_rdoc_files: []
|
33
|
-
|
34
|
-
|
35
|
-
-
|
32
|
+
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- .travis.yml
|
36
36
|
- CHANGELOG
|
37
37
|
- Gemfile
|
38
38
|
- LICENSE
|
@@ -57,31 +57,33 @@ files:
|
|
57
57
|
- test/unit/db_nazi/test_table.rb
|
58
58
|
- test/unit/db_nazi/test_table_definition.rb
|
59
59
|
- test/unit/test_db_nazi.rb
|
60
|
-
homepage:
|
61
|
-
licenses:
|
60
|
+
homepage: ""
|
61
|
+
licenses:
|
62
62
|
- MIT
|
63
63
|
metadata: {}
|
64
|
+
|
64
65
|
post_install_message:
|
65
66
|
rdoc_options: []
|
66
|
-
|
67
|
+
|
68
|
+
require_paths:
|
67
69
|
- lib
|
68
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
-
|
71
|
-
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
version: '0'
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- &id002
|
73
|
+
- ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- *id002
|
78
79
|
requirements: []
|
80
|
+
|
79
81
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.2.
|
82
|
+
rubygems_version: 2.2.2
|
81
83
|
signing_key:
|
82
84
|
specification_version: 4
|
83
85
|
summary: Encourage good DB practices in ActiveRecord migrations.
|
84
|
-
test_files:
|
86
|
+
test_files:
|
85
87
|
- test/database.yml
|
86
88
|
- test/integration/test_integration.rb
|
87
89
|
- test/test_helper.rb
|