activerecord-fb-adapter 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,8 +77,13 @@ module ActiveRecord
77
77
  @firebird_type = Fb::SqlType.from_code(type, sub_type || 0)
78
78
  super(name.downcase, nil, @firebird_type, !null_flag)
79
79
  @default = parse_default(default_source) if default_source
80
- @limit = (@firebird_type == 'BLOB') ? 10 * 1024 * 1024 : length
81
- @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale
80
+ case @firebird_type
81
+ when 'VARCHAR', 'CHAR'
82
+ @limit = length
83
+ when 'DECIMAL', 'NUMERIC'
84
+ @precision, @scale = precision, scale.abs
85
+ end
86
+ @domain, @sub_type = domain, sub_type
82
87
  end
83
88
 
84
89
  def type
@@ -824,6 +829,11 @@ module ActiveRecord
824
829
  add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
825
830
  add_column_options!(add_column_sql, options)
826
831
  execute(add_column_sql)
832
+ if options[:position]
833
+ # position is 1-based but add 1 to skip id column
834
+ alter_position_sql = "ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} POSITION #{options[:position] + 1}"
835
+ execute(alter_position_sql)
836
+ end
827
837
  end
828
838
 
829
839
  # Changes the column's definition according to the new options.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-fb-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-14 00:00:00.000000000 Z
12
+ date: 2013-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fb
@@ -59,6 +59,6 @@ rubyforge_project:
59
59
  rubygems_version: 1.8.23
60
60
  signing_key:
61
61
  specification_version: 3
62
- summary: ActiveRecord Firebird Adapter for Rails 3. Unlike fb_adapter for Rails 1.x
63
- and 2.x, this version attempts to support migrations.
62
+ summary: ActiveRecord Firebird Adapter for Rails 3 and 4. Unlike fb_adapter for Rails
63
+ 1.x and 2.x, this version attempts to support migrations.
64
64
  test_files: []