rack-app-sequel 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rack/app/sequel/migration/cli/rollback.rb +26 -7
- data/lib/rack/app/sequel/runner.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c746438bf92e9674dca0e9a68f229e220149a6a
|
4
|
+
data.tar.gz: bc7d8b3840cd24954e8399af692d03bbcfb161e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49f0a0416c0e06084e50e081bfbf4ec7e0a429119302b45ba616b894241595c957ba03f8c414d2b68b0972d5ac8a56fe0657267f27a4e0aee87626fd6da01c53
|
7
|
+
data.tar.gz: 1774794071a976d2481f61fad68618af35b52ad0c1fedcd0609f6b749037419bf35c9e576d376437bd9b01aa3f6e2fe0535ac7e24d94b7cc6efe0095414a3656
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
@@ -1,9 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Rack::App::SeQueL::Runner.setup_command(self)
|
1
|
+
command 'db:rollback' do
|
2
|
+
description "Rollback the database N steps (you can specify the version with `db:rollback [STEP_COUNT]`"
|
4
3
|
|
5
|
-
|
6
|
-
# exit(Rack::App::SeQueL::Runner.new(options, migration_config).run)
|
7
|
-
# end
|
4
|
+
Rack::App::SeQueL::Runner.setup_command(self, :target)
|
8
5
|
|
9
|
-
|
6
|
+
action do |step=1|
|
7
|
+
step = Integer(step)
|
8
|
+
|
9
|
+
if step == 0
|
10
|
+
migration_config[:target] = 0
|
11
|
+
end
|
12
|
+
|
13
|
+
Rack::App::SeQueL.open_connection do |connection|
|
14
|
+
row = connection[:schema_migrations]
|
15
|
+
.order(Sequel.desc(:filename))
|
16
|
+
.offset(step).first
|
17
|
+
|
18
|
+
unless row.nil?
|
19
|
+
migration_config[:target] = Integer(row[:filename].match(/^([\d]+)/)[0])
|
20
|
+
end
|
21
|
+
end unless migration_config[:target]
|
22
|
+
|
23
|
+
migration_config[:target] || abort("target version not found")
|
24
|
+
|
25
|
+
exit(Rack::App::SeQueL::Runner.new(options, migration_config).run)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
class Rack::App::SeQueL::Runner
|
2
2
|
|
3
|
-
def self.setup_command(command)
|
3
|
+
def self.setup_command(command, *excludes)
|
4
4
|
command.class_eval do
|
5
5
|
|
6
6
|
option '-a', '--allow_missing_migration_files', 'In some cases, you may want to allow a migration in the database that does not exist in the filesystem' do
|
7
7
|
migration_config[:allow_missing_migration_files] = true
|
8
|
-
end
|
8
|
+
end unless excludes.include?(:allow_missing_migration_files)
|
9
9
|
|
10
10
|
option '-c', '--current [CURRENT_VERION]', 'Set the current version of the database for the execution' do |current_database_version|
|
11
11
|
migration_config[:current] = current_database_version
|
12
|
-
end
|
12
|
+
end unless excludes.include?(:current)
|
13
13
|
|
14
14
|
# option '-r', '--relative [MIGRATION_COUNT]', 'Run the given number of migrations, with a positive number being migrations to migrate up, and a negative number being migrations to migrate down (IntegerMigrator only).' do |value|
|
15
15
|
# migration_config[:relative] = value.to_i
|
@@ -17,7 +17,7 @@ class Rack::App::SeQueL::Runner
|
|
17
17
|
|
18
18
|
option '-t', '--target [TIMESTAMP]', 'The target version to which to migrate. If not given, migrates to the maximum version.' do |target_version|
|
19
19
|
migration_config[:target] = target_version
|
20
|
-
end
|
20
|
+
end unless excludes.include?(:target)
|
21
21
|
|
22
22
|
option '-m', '--path-to-migration-patches [DIR_PATH]', "set to check what directory should be used for db migrations (default: #{Rack::App::SeQueL::Migration::DEFAULT_DIRECTORY})" do |new_migration_directory|
|
23
23
|
options[:migration_directory] = new_migration_directory
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app-sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|