dohmysql 0.2.4 → 0.2.5

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.
Files changed (2) hide show
  1. data/lib/doh/mysql/database_creator.rb +10 -7
  2. metadata +2 -2
@@ -93,15 +93,18 @@ private
93
93
 
94
94
  def apply_migrates(dbh, source_db)
95
95
  apply_files = find_files("#{source_db}/migrate/*_apply.sql")
96
- apply_files.sort! do |valx, valy|
97
- if valx.end_with?('_before_apply.sql')
98
- -1
99
- elsif valy.end_with?('_before_apply.sql')
100
- 1
101
- else
102
- valx <=> valy
96
+ migrates = apply_files.collect {|path| File.basename(path).slice(0..-11)}
97
+
98
+ migrates.each do |name|
99
+ base, divider, _ = name.partition('_after')
100
+ next if divider.empty?
101
+
102
+ if migrates.include?("#{base}_before")
103
+ file_ending = "#{name}_apply.sql"
104
+ apply_files.delete_if {|path| path.end_with?(file_ending)}
103
105
  end
104
106
  end
107
+
105
108
  DohDb.load_sql(@connector.config, apply_files)
106
109
  apply_files.each do |path|
107
110
  migrate_name = File.basename(path).slice(0..-11)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dohmysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-28 00:00:00.000000000 Z
13
+ date: 2012-08-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dohroot