schema-evolution-manager 0.9.38 → 0.9.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -2
- data/bin/sem-add +2 -2
- data/bin/sem-config +2 -0
- data/bin/sem-init +2 -1
- data/lib/schema-evolution-manager/args.rb +4 -2
- data/lib/schema-evolution-manager/db.rb +10 -5
- data/lib/schema-evolution-manager/sem_version.rb +4 -3
- data/lib/schema-evolution-manager/version.rb +1 -1
- data/template/README.md +3 -3
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f9aa2e5f4ca0f466a5af46ed97fca2186cdd699ac4e0c5cf05b2e9572aee0583
|
4
|
+
data.tar.gz: 452714b924c36169ddc725fe75ba1315153a27564adce616afb04f8aa5920649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3b69b1dad0e1128683d5c6d880766f766681c9db47aff820f4d798d25d4a278fc01e7e3138f8ae75c0a53501c0ef47c48479614a41187762778eb70e44ed2c8
|
7
|
+
data.tar.gz: 1279727ee5dcc9a99059870cc29ed278e62dd881d544a6a7ac34c9631e882eaea43da06a91de0c90f063ea5ee37dc06cf580dfc429454b6c5d737707eb03781e
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/mbryzek/schema-evolution-manager.svg?branch=
|
1
|
+
[![Build Status](https://travis-ci.org/mbryzek/schema-evolution-manager.svg?branch=main)](https://travis-ci.org/mbryzek/schema-evolution-manager)
|
2
2
|
|
3
3
|
# Schema Evolution Manager (sem)
|
4
4
|
|
@@ -129,7 +129,7 @@ There are two ways to install schema evolution manager:
|
|
129
129
|
|
130
130
|
git clone git://github.com/mbryzek/schema-evolution-manager.git
|
131
131
|
cd schema-evolution-manager
|
132
|
-
git checkout 0.9.
|
132
|
+
git checkout 0.9.45
|
133
133
|
ruby ./configure.rb
|
134
134
|
sudo ./install.rb
|
135
135
|
|
data/bin/sem-add
CHANGED
@@ -23,12 +23,12 @@ scripts_dir = File.join(`pwd`.strip, "scripts")
|
|
23
23
|
SchemaEvolutionManager::Library.ensure_dir!(scripts_dir)
|
24
24
|
|
25
25
|
contents = IO.read(file)
|
26
|
-
now = Time.now.strftime('%Y%m%d-%H%M%S')
|
26
|
+
now = Time.now.utc.strftime('%Y%m%d-%H%M%S')
|
27
27
|
target = File.join(scripts_dir, "#{now}.sql")
|
28
28
|
|
29
29
|
while File.exists?(target)
|
30
30
|
sleep 0.1
|
31
|
-
now = Time.now.strftime('%Y%m%d-%H%M%S')
|
31
|
+
now = Time.now.utc.strftime('%Y%m%d-%H%M%S')
|
32
32
|
target = File.join(scripts_dir, "#{now}.sql")
|
33
33
|
end
|
34
34
|
|
data/bin/sem-config
CHANGED
data/bin/sem-init
CHANGED
@@ -89,7 +89,8 @@ Dir.chdir(args.dir) do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
if SchemaEvolutionManager::Library.git_has_remote?
|
92
|
-
SchemaEvolutionManager::Library.system_or_error("git
|
92
|
+
branch = SchemaEvolutionManager::Library.system_or_error("git symbolic-ref --short HEAD")
|
93
|
+
SchemaEvolutionManager::Library.system_or_error("git push origin #{branch}")
|
93
94
|
end
|
94
95
|
|
95
96
|
end
|
@@ -15,7 +15,8 @@ module SchemaEvolutionManager
|
|
15
15
|
:url => "The connection string for the psql database",
|
16
16
|
:dir => "Path to a directory",
|
17
17
|
:tag => "A git tag (e.g. 0.0.1)",
|
18
|
-
:prefix => "Configure installer to use this prefix"
|
18
|
+
:prefix => "Configure installer to use this prefix",
|
19
|
+
:set => "Passthrough for postgresql --set argument"
|
19
20
|
}
|
20
21
|
|
21
22
|
FLAGS_NO_ARGUMENTS = {
|
@@ -26,7 +27,7 @@ module SchemaEvolutionManager
|
|
26
27
|
}
|
27
28
|
end
|
28
29
|
|
29
|
-
attr_reader :artifact_name, :host, :port, :name, :prefix, :url, :user, :dir, :dry_run, :tag, :password
|
30
|
+
attr_reader :artifact_name, :host, :port, :name, :prefix, :url, :user, :dir, :dry_run, :tag, :password, :set
|
30
31
|
|
31
32
|
# args: Actual string arguments
|
32
33
|
# :required => list of parameters that are required
|
@@ -60,6 +61,7 @@ module SchemaEvolutionManager
|
|
60
61
|
@user = found_arguments.delete(:user)
|
61
62
|
@dir = found_arguments.delete(:dir)
|
62
63
|
@tag = found_arguments.delete(:tag)
|
64
|
+
@set = found_arguments.delete(:set)
|
63
65
|
|
64
66
|
@dry_run = found_arguments.delete(:dry_run)
|
65
67
|
@password = found_arguments.delete(:password)
|
@@ -7,6 +7,10 @@ module SchemaEvolutionManager
|
|
7
7
|
def initialize(url, opts={})
|
8
8
|
@url = Preconditions.check_not_blank(url, "url cannot be blank")
|
9
9
|
password = opts.delete(:password)
|
10
|
+
|
11
|
+
set = opts.delete(:set).to_s.strip
|
12
|
+
@psql_executable_with_options = set.empty? ? "psql" : "psql --set='%s'" % set
|
13
|
+
|
10
14
|
Preconditions.assert_empty_opts(opts)
|
11
15
|
connection_data = ConnectionData.parse_url(@url)
|
12
16
|
|
@@ -28,7 +32,7 @@ module SchemaEvolutionManager
|
|
28
32
|
# executes a simple sql command.
|
29
33
|
def psql_command(sql_command)
|
30
34
|
Preconditions.assert_class(sql_command, String)
|
31
|
-
command = "
|
35
|
+
command = "#{@psql_executable_with_options} --no-align --tuples-only --no-psqlrc --command \"%s\" %s" % [sql_command, @url]
|
32
36
|
Library.system_or_error(command)
|
33
37
|
end
|
34
38
|
|
@@ -71,7 +75,7 @@ module SchemaEvolutionManager
|
|
71
75
|
out << IO.read(path)
|
72
76
|
end
|
73
77
|
|
74
|
-
command = "
|
78
|
+
command = "#{@psql_executable_with_options} --file \"%s\" #{options} %s" % [tmp, @url]
|
75
79
|
|
76
80
|
Library.with_temp_file do |output|
|
77
81
|
result = `#{command} > #{output} 2>&1`.strip
|
@@ -94,7 +98,7 @@ module SchemaEvolutionManager
|
|
94
98
|
# Db. Exists if invalid config.
|
95
99
|
def Db.parse_command_line_config(arg_string)
|
96
100
|
Preconditions.assert_class(arg_string, String)
|
97
|
-
args = Args.new(arg_string, :optional => ['url', 'host', 'user', 'name', 'port'])
|
101
|
+
args = Args.new(arg_string, :optional => ['url', 'host', 'user', 'name', 'port', 'set'])
|
98
102
|
Db.from_args(args)
|
99
103
|
end
|
100
104
|
|
@@ -104,12 +108,13 @@ module SchemaEvolutionManager
|
|
104
108
|
password = opts.delete(:password)
|
105
109
|
Preconditions.assert_empty_opts(opts)
|
106
110
|
|
111
|
+
options = { :password => password, :set => args.set }
|
107
112
|
if args.url
|
108
|
-
Db.new(args.url,
|
113
|
+
Db.new(args.url, options)
|
109
114
|
else
|
110
115
|
base = "%s:%s/%s" % [args.host || "localhost", args.port || ConnectionData::DEFAULT_PORT, args.name]
|
111
116
|
url = args.user ? "%s@%s" % [args.user, base] : base
|
112
|
-
Db.new("postgres://" + url,
|
117
|
+
Db.new("postgres://" + url, options)
|
113
118
|
end
|
114
119
|
end
|
115
120
|
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# File automatically created and updated by util/create-release.rb
|
1
2
|
module SchemaEvolutionManager
|
2
3
|
|
3
|
-
|
4
|
+
module SemVersion
|
4
5
|
|
5
|
-
|
6
|
+
VERSION ||= '0.9.43'
|
6
7
|
|
7
|
-
|
8
|
+
end
|
8
9
|
|
9
10
|
end
|
@@ -74,7 +74,7 @@ module SchemaEvolutionManager
|
|
74
74
|
|
75
75
|
def Version.is_valid?(version_string)
|
76
76
|
Preconditions.check_not_blank(version_string, "version_string cannot be blank")
|
77
|
-
version_string.match(/^\w*\d+\.\d+\.\d+$/)
|
77
|
+
version_string.match(/^\w*\d+\.\d+\.\d+$/) ? true : false
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
data/template/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
To add a new database migration script:
|
2
2
|
|
3
|
-
1. Make sure you have head of
|
4
|
-
git checkout
|
3
|
+
1. Make sure you have head of main:
|
4
|
+
git checkout main
|
5
5
|
git fetch
|
6
|
-
git rebase origin/
|
6
|
+
git rebase origin/main
|
7
7
|
|
8
8
|
2. Create a local branch for your change
|
9
9
|
git checkout -b tmp
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema-evolution-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bryzek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: '["Michael Bryzek"]'
|
14
14
|
email: mbryzek@alum.mit.edu
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- template/dev.rb
|
56
56
|
homepage: https://github.com/gilt/schema-evolution-manager
|
57
57
|
licenses:
|
58
|
-
- Apache
|
58
|
+
- Apache-2.0
|
59
59
|
metadata: {}
|
60
60
|
post_install_message:
|
61
61
|
rdoc_options: []
|
@@ -72,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
|
76
|
-
rubygems_version: 2.5.2
|
75
|
+
rubygems_version: 3.0.3
|
77
76
|
signing_key:
|
78
77
|
specification_version: 4
|
79
78
|
summary: Schema evolution manager is a simple schema migration tool for postgresql
|