db_leftovers 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/db_leftovers.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "db_leftovers"
8
- s.version = "1.1.0"
8
+ s.version = "1.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul A. Jungwirth"]
12
- s.date = "2012-10-06"
12
+ s.date = "2012-10-11"
13
13
  s.description = " Define indexes and foreign keys for your Rails app\n in one place using an easy-to-read DSL,\n then run a rake task to bring your database up-to-date.\n"
14
14
  s.email = "pj@illuminatedcomputing.com"
15
15
  s.extra_rdoc_files = [
@@ -85,7 +85,7 @@ module DBLeftovers
85
85
  @db.execute_add_index(idx)
86
86
  log_new_index(idx, false)
87
87
  end
88
- @new_indexes[truncate_index_name(idx.index_name)] = table_name
88
+ @new_indexes[idx.index_name] = table_name
89
89
  end
90
90
  end
91
91
 
@@ -162,7 +162,7 @@ module DBLeftovers
162
162
  if idx.where_clause
163
163
  # NB: This is O(n*m) where n is your indexes and m is your indexes with WHERE clauses.
164
164
  # But it's hard to believe it matters:
165
- new_idx = @db.lookup_all_indexes[truncate_index_name(idx.index_name)]
165
+ new_idx = @db.lookup_all_indexes[idx.index_name]
166
166
  puts "#{did_what} index: #{idx.index_name} on #{idx.table_name} WHERE #{new_idx.where_clause}"
167
167
  else
168
168
  puts "#{did_what} index: #{idx.index_name} on #{idx.table_name}"
@@ -191,12 +191,8 @@ module DBLeftovers
191
191
  t << chk
192
192
  end
193
193
 
194
- def truncate_index_name(index_name)
195
- index_name[0,63]
196
- end
197
-
198
194
  def index_status(idx)
199
- old = @old_indexes[truncate_index_name(idx.index_name)]
195
+ old = @old_indexes[idx.index_name]
200
196
  if old
201
197
  return old.equals(idx) ? STATUS_EXISTS : STATUS_CHANGED
202
198
  else
@@ -39,7 +39,8 @@ module DBLeftovers
39
39
  private
40
40
 
41
41
  def choose_name(table_name, column_names)
42
- "index_#{table_name}_on_#{column_names.join('_and_')}"
42
+ # Max length in Postgres is 63; in MySQL 64:
43
+ "index_#{table_name}_on_#{column_names.join('_and_')}"[0,63]
43
44
  end
44
45
 
45
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_leftovers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.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: 2012-10-06 00:00:00.000000000 Z
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: 3981883002414035216
150
+ hash: -4583534380635157212
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements: