activerecord-native_db_types_override 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,19 +23,16 @@ Then run:
23
23
 
24
24
  In your config/environment.rb or an environment specific configuration, you may specify one or more options in the config hash that will be merged into the default types. The act of configuring does the hash merge/activation of changes.
25
25
 
26
- Some gems may require the adapter prior to this point, so it may not need to be required, but we do not load the Rails adapters in the NativeDbTypesOverride gem because all are most likely not needed.
27
-
28
- Note: I left the Ruby 1.8 hashrocket notation to show it shouldn't matter. Feel free to use 1.9+ hash syntax.
26
+ If using Ruby 1.8.x, use hashrocket notation instead for the following examples.
29
27
 
30
28
  #### PostgreSQL
31
29
 
32
30
  For example, if you want Rails to use the timestamptz type for all datetimes and timestamps created by migrations, you could use:
33
31
 
34
- require 'active_record/connection_adapters/postgresql_adapter'
35
32
  NativeDbTypesOverride.configure({
36
- :postgres => {
37
- :datetime => { :name => "timestamptz" },
38
- :timestamp => { :name => "timestamptz" }
33
+ postgres: {
34
+ datetime: { name: "timestamptz" },
35
+ timestamp: { name: "timestamptz" }
39
36
  }
40
37
  })
41
38
 
@@ -46,8 +43,8 @@ See [PostgreSQLAdapter][postgres_adapter] for the default types.
46
43
  For the MySQL/MySQL2 adapters, maybe you could change boolean to a string type:
47
44
 
48
45
  NativeDbTypesOverride.configure({
49
- :mysql => {
50
- :boolean => { :name => "varchar", :limit => 1 }
46
+ mysql: {
47
+ boolean: { name: "varchar", limit: 1 }
51
48
  }
52
49
  })
53
50
 
@@ -58,8 +55,8 @@ See [AbstractMysqlAdapter][mysql_adapter] for the default types.
58
55
  Maybe you need to extend the default string limit from 255 to 4096:
59
56
 
60
57
  NativeDbTypesOverride.configure({
61
- :sqlite => {
62
- :string => { :name => "varchar", :limit => 4096 }
58
+ sqlite: {
59
+ string: { :name: "varchar", limit: 4096 }
63
60
  }
64
61
  })
65
62
 
@@ -76,10 +73,10 @@ In addition, it's native_database_types method can define boolean as VARCHAR2 (1
76
73
  However, if you need to make another change like making datetime and timestamp store timezones *and* you want to emulate_booleans_from_strings, just ensure that you define the boolean shown in the following example rather than using OracleEnhancedAdapter's emulate_booleans_from_strings option:
77
74
 
78
75
  NativeDbTypesOverride.configure({
79
- :oracle => {
80
- :datetime => { :name => "TIMESTAMP WITH TIMEZONE" },
81
- :timestamp => { :name => "TIMESTAMP WITH TIMEZONE" },
82
- :boolean => { :name => "VARCHAR2", :limit => 1 }
76
+ oracle: {
77
+ datetime: { name: "TIMESTAMP WITH TIMEZONE" },
78
+ timestamp: { name: "TIMESTAMP WITH TIMEZONE" },
79
+ boolean: { name: "VARCHAR2", limit: 1 }
83
80
  }
84
81
  })
85
82
 
@@ -96,8 +93,8 @@ Be sure to add a require for the adapter, if it has not been loaded already prio
96
93
  require 'active_record/connection_adapters/postgresql_adapter'
97
94
  NativeDbTypesOverride.configure({
98
95
  ActiveRecord::ConnectionAdapters::PostgreSQLAdapter => {
99
- :datetime => { :name => "timestamptz" },
100
- :timestamp => { :name => "timestamptz" }
96
+ datetime: { name: "timestamptz" },
97
+ timestamp: { name: "timestamptz" }
101
98
  }
102
99
  })
103
100
 
@@ -1,3 +1,3 @@
1
1
  module NativeDbTypesOverride
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-native_db_types_override
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: