active_record_inline_schema 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.5.3 / 2012-04-24
2
+
3
+ * Enhancements
4
+
5
+ * Cache name of the current database to speed things up.
6
+
1
7
  ## 0.5.2 / 2012-04-19
2
8
 
3
9
  * Bug fixes
@@ -15,9 +15,10 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_runtime_dependency 'lock_method'
19
18
  s.add_runtime_dependency 'activesupport'
20
19
  s.add_runtime_dependency "activerecord", ">=3"
20
+ s.add_runtime_dependency 'lock_method'
21
+ s.add_runtime_dependency 'cache_method'
21
22
  # s.add_runtime_dependency "activerecord", "~>3.0" # must use mysql2 ~>0.2 to test
22
23
  # s.add_runtime_dependency "activerecord", "~>3.1"
23
24
  # s.add_runtime_dependency "activerecord", "~>3.2"
@@ -1,5 +1,6 @@
1
1
  require 'set'
2
2
  require 'lock_method'
3
+ require 'cache_method'
3
4
 
4
5
  class ActiveRecordInlineSchema::Config
5
6
  DEFAULT_CREATE_TABLE_OPTIONS = {
@@ -131,20 +132,20 @@ class ActiveRecordInlineSchema::Config
131
132
  end
132
133
  lock_method :apply, :ttl => 60
133
134
 
134
- def as_lock
135
- if connection.respond_to?(:current_database)
136
- [connection.current_database, model.name]
137
- else
138
- model.name
139
- end
140
- end
141
-
142
135
  def clear
143
136
  @ideal_columns = ::Set.new
144
137
  @ideal_indexes = ::Set.new
145
138
  end
146
139
  lock_method :clear, :ttl => 60
147
140
 
141
+ def as_lock
142
+ [current_database, model.name]
143
+ end
144
+
145
+ def as_cache_key
146
+ model.name
147
+ end
148
+
148
149
  private
149
150
 
150
151
  def find_ideal_column(name)
@@ -195,6 +196,13 @@ class ActiveRecordInlineSchema::Config
195
196
  model.connection
196
197
  end
197
198
 
199
+ def current_database
200
+ if connection.respond_to? :current_database
201
+ connection.current_database
202
+ end
203
+ end
204
+ cache_method :current_database, 60
205
+
198
206
  def database_type
199
207
  if mysql?
200
208
  :mysql
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordInlineSchema
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_inline_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,10 +10,10 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-20 00:00:00.000000000 Z
13
+ date: 2012-04-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: lock_method
16
+ name: activesupport
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
@@ -29,7 +29,23 @@ dependencies:
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0'
31
31
  - !ruby/object:Gem::Dependency
32
- name: activesupport
32
+ name: activerecord
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '3'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: lock_method
33
49
  requirement: !ruby/object:Gem::Requirement
34
50
  none: false
35
51
  requirements:
@@ -45,13 +61,13 @@ dependencies:
45
61
  - !ruby/object:Gem::Version
46
62
  version: '0'
47
63
  - !ruby/object:Gem::Dependency
48
- name: activerecord
64
+ name: cache_method
49
65
  requirement: !ruby/object:Gem::Requirement
50
66
  none: false
51
67
  requirements:
52
68
  - - ! '>='
53
69
  - !ruby/object:Gem::Version
54
- version: '3'
70
+ version: '0'
55
71
  type: :runtime
56
72
  prerelease: false
57
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -59,7 +75,7 @@ dependencies:
59
75
  requirements:
60
76
  - - ! '>='
61
77
  - !ruby/object:Gem::Version
62
- version: '3'
78
+ version: '0'
63
79
  description: Specify columns like you would with ActiveRecord migrations and then
64
80
  run .auto_upgrade! Based on the mini_record gem from Davide D'Agostino, it adds
65
81
  fewer aliases, doesn't create timestamps and relationship columns automatically.