activerecord-mysql-unsigned 0.3.0 → 0.3.1

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
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28887c8744010284c741bf409074d986e2e04092
4
- data.tar.gz: 054d6bc7e97203547459bc040f05d362f14083db
3
+ metadata.gz: 5fc6191d31871ae48741ed325d6bc3540ebc7ee2
4
+ data.tar.gz: b40d32872ba7ddec346904003b3a609d53feffaf
5
5
  SHA512:
6
- metadata.gz: 3f47eeeea032def664defb3990a04c78cb181e1b3a813999d12d3a0f8320f3d52c11c31d94978f3deb87beef30129d39aa0950e78b2051119574ff5edd911c7a
7
- data.tar.gz: 3ecd003fd8ce4dbd6158dffe52129d54622e950752c009dbedd094005ccdf8f3dbdfbef38f34ca57ed358ba3777dfd61b7101825f832be401bf8cc81963c8654
6
+ metadata.gz: e731e9b545386d2e1d7137311fa5f82a518930493a052dc385a5d70873bdb4d09b0a7d7aee86cff1c0047232c70089d0c9e07dc7a80a1b69c082af836b8322df
7
+ data.tar.gz: f97831d2ca2f5cd753baf50deff5443a5c4b2155d95165b71a948e9b6e0b3a4ddedb2e7b5d61937f1683d9cafca544f23183d2e343a413350fd37de74af160f2
@@ -10,9 +10,11 @@ module ActiveRecord
10
10
  class SchemaCreation < AbstractAdapter::SchemaCreation
11
11
  def visit_AddColumn(o)
12
12
  sql_type = type_to_sql(o.type.to_sym, o.limit, o.precision, o.scale, o.unsigned)
13
- sql = "ADD #{quote_column_name(o.name)} #{sql_type}"
14
- add_column_options!(sql, column_options(o)) unless o.type.to_sym == :primary_key
15
- add_column_position!(sql, column_options(o))
13
+ add_column_sql = "ADD #{quote_column_name(o.name)} #{sql_type}"
14
+ add_column_options!(add_column_sql, column_options(o)) unless o.type.to_sym == :primary_key
15
+ add_column_position!(add_column_sql, column_options(o))
16
+
17
+ add_column_sql
16
18
  end
17
19
 
18
20
  def visit_ChangeColumnDefinition(o)
@@ -22,12 +24,15 @@ module ActiveRecord
22
24
  change_column_sql = "CHANGE #{quote_column_name(column.name)} #{quote_column_name(options[:name])} #{sql_type}"
23
25
  add_column_options!(change_column_sql, options.merge(column: column)) unless o.type.to_sym == :primary_key
24
26
  add_column_position!(change_column_sql, options)
27
+
28
+ change_column_sql
25
29
  end
26
30
 
27
31
  def visit_ColumnDefinition(o)
28
32
  sql_type = type_to_sql(o.type.to_sym, o.limit, o.precision, o.scale, o.unsigned)
29
33
  column_sql = "#{quote_column_name(o.name)} #{sql_type}"
30
34
  add_column_options!(column_sql, column_options(o)) unless o.type.to_sym == :primary_key
35
+
31
36
  column_sql
32
37
  end
33
38
 
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module Mysql
3
3
  module Unsigned
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
6
6
  end
7
7
  end
@@ -52,6 +52,16 @@ describe "INT/Decimal column" do
52
52
  expect(unsigned_int_col.unsigned?).to be_truthy
53
53
  end
54
54
 
55
+ it "signed column has 'unsigned' attribute after changed" do
56
+ will_unsigned_int_col = User.columns[4]
57
+ expect(will_unsigned_int_col.unsigned?).to be_truthy
58
+ end
59
+
60
+ it "unsigned column has 'signed' attribute after changed" do
61
+ will_signed_int_col = User.columns[5]
62
+ expect(will_signed_int_col.unsigned?).to be_falsey
63
+ end
64
+
55
65
  it "allowed minus value of signed decimal" do
56
66
  @user.signed_decimal = -10.0
57
67
  @user.save
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-mysql-unsigned
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yo_waka