sql_migrate 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 198bb3090bb29300eac118f1b961321500ff47eaf9292cacc92fd4be203f6e62
4
- data.tar.gz: 6a4b196f4f729dc2ff9e9a4b519a8ff7c3e614ed7807b849ba0e4162dfb0e502
3
+ metadata.gz: 9020021590c40da7b37566f73c2e32360eba01ca768fe87ea4b2b344f11dfb38
4
+ data.tar.gz: b658a0eda022c5ea163e808a18c929b12feb0ffbb204026fed2e94ea0428ecbd
5
5
  SHA512:
6
- metadata.gz: b3fc80643b565b10ddac1f16ebfa11471ab1fa0219e9f7ad326d68ecb658767717abc6dfc8ed42aaf33a56ccdc8b9d68038c1d7086285fe224716c74ad60bb9f
7
- data.tar.gz: 84640a8ea02f6e83caccadf5d108b67c6b0f3efc6ae94812f7a9f76e20390f158862359abcb65bd2b32e4c285d01c3983c922d2e41b047369db04629f31687de
6
+ metadata.gz: 483d35e1b157886e79f5be5d96c96f7a2a18eb03db9f303e9de7fba1fecd5a37fcd69d239661c0d62a820be0e359a9108664036c11c964790a49f6b1f5ebe12b
7
+ data.tar.gz: 14ff2f083800e4f85b4d991027eb1d6e2af4a8b665210bed97fd1e9de83feace7109636c19954a364021c96adea0edc4eb1875a6e23aa5ab83970799a114667a
data/README.md CHANGED
@@ -9,7 +9,12 @@ $ gem install sql_migrate
9
9
  ## Usage
10
10
 
11
11
  ```
12
- sql_migrate -h mysql.example.com -d dbname path/to/migrations
12
+ $ tree path/to/migrations
13
+ migrations
14
+ ├── 0001_xxxx.sql
15
+ ├── 0002_xxxx.sql
16
+ └── 0003_xxxx.sql
17
+ $ MYSQL_PWD=secret sql_migrate -h mysql.example.com -d dbname path/to/migrations
13
18
  ```
14
19
 
15
20
  ### Options
@@ -35,7 +35,7 @@ module SqlMigrate
35
35
 
36
36
  load_from_config(options.delete(:config)) if options.has_key?(:config)
37
37
  config.merge(options)
38
- config.migrations_path = args.first if args.size.positive?
38
+ config.migration_paths = args unless args.empty?
39
39
 
40
40
  args
41
41
  end
@@ -6,7 +6,7 @@ module SqlMigrate
6
6
  :database,
7
7
  :user,
8
8
  :password,
9
- :migrations_path,
9
+ :migration_paths,
10
10
  :logger,
11
11
  :dryrun,
12
12
  :verbose,
@@ -29,7 +29,7 @@ module SqlMigrate
29
29
  self.host = "localhost"
30
30
  self.port = 3306
31
31
  self.user = "root"
32
- self.migrations_path = "migrations"
32
+ self.migration_paths = ["migrations"]
33
33
  self.logger = default_logger
34
34
  self.dryrun = false
35
35
  self.verbose = false
@@ -14,7 +14,7 @@ module SqlMigrate
14
14
  def migrate
15
15
  create_migrate_versions_if_not_exist
16
16
  versions = applied_versions
17
- migration_files.sort.each do |migration|
17
+ migration_files.each do |migration|
18
18
  version_name = File.basename(migration)
19
19
  next if versions.include?(version_name)
20
20
  logger.info("apply migration #{version_name}")
@@ -46,7 +46,9 @@ module SqlMigrate
46
46
  end
47
47
 
48
48
  def migration_files
49
- Dir.glob(File.join(config.migrations_path, "*"))
49
+ config.migration_paths.map { |path|
50
+ Dir.glob(File.join(File.expand_path(path), "*"))
51
+ }.flatten.sort
50
52
  end
51
53
 
52
54
  private
@@ -1,3 +1,3 @@
1
1
  module SqlMigrate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql_migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - i2bskn