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 CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: ef96777baa9820f3ac045b8d34c72186caaf3af8
4
- data.tar.gz: 717b63040614818304ae8c8633948b1d1e796174
5
- SHA512:
6
- metadata.gz: 5d46ba3ebc5ed79e5cce094797e0bc58c7607be681b031f2c290580992531bf99c6c589f39354ff1cd5ee8e49227b38947e88707608de6269faf07a1cb657c5c
7
- data.tar.gz: c6d3435923defc3b29aca0bf0f89a2a4799057d0260024386344cb55f3892c16fda864a3db1f96528f2177d901fb1274361c5828ce1c93bf184eb00227cb7147
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
@@ -1,3 +1,7 @@
1
+ == 0.0.5 2014-02-26
2
+
3
+ * Disable DB Nazi for change_column_default.
4
+
1
5
  == 0.0.4 2014-02-14
2
6
 
3
7
  * Rails 4 compatibility.
@@ -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 }
@@ -1,5 +1,5 @@
1
1
  module DBNazi
2
- VERSION = [0, 0, 4]
2
+ VERSION = [0, 0, 5]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -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.4
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
- date: 2014-02-14 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activerecord
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: !ruby/object:Gem::Requirement
23
- requirements:
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
- files:
34
- - ".gitignore"
35
- - ".travis.yml"
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
- require_paths:
67
+
68
+ require_paths:
67
69
  - lib
68
- required_ruby_version: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: '0'
73
- required_rubygems_version: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
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.0
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