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 +4 -4
- data/README.md +6 -1
- data/lib/sql_migrate/cli.rb +1 -1
- data/lib/sql_migrate/config.rb +2 -2
- data/lib/sql_migrate/migrator.rb +4 -2
- data/lib/sql_migrate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9020021590c40da7b37566f73c2e32360eba01ca768fe87ea4b2b344f11dfb38
|
4
|
+
data.tar.gz: b658a0eda022c5ea163e808a18c929b12feb0ffbb204026fed2e94ea0428ecbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lib/sql_migrate/cli.rb
CHANGED
data/lib/sql_migrate/config.rb
CHANGED
@@ -6,7 +6,7 @@ module SqlMigrate
|
|
6
6
|
:database,
|
7
7
|
:user,
|
8
8
|
:password,
|
9
|
-
:
|
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.
|
32
|
+
self.migration_paths = ["migrations"]
|
33
33
|
self.logger = default_logger
|
34
34
|
self.dryrun = false
|
35
35
|
self.verbose = false
|
data/lib/sql_migrate/migrator.rb
CHANGED
@@ -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.
|
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
|
-
|
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
|
data/lib/sql_migrate/version.rb
CHANGED