arxutils_sqlite3 0.1.48 → 0.1.50
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -2
- data/.rubocop_todo.yml +209 -109
- data/Gemfile +13 -16
- data/Gemfile.lock +112 -0
- data/Rakefile +12 -58
- data/arxutils_sqlite3.gemspec +4 -4
- data/config/.gitignore +1 -0
- data/config/setting.yml +2 -0
- data/exe/arxutils_sqlite3 +38 -29
- data/lib/arxutils_sqlite3/arx.rb +3 -3
- data/lib/arxutils_sqlite3/cli.rb +48 -27
- data/lib/arxutils_sqlite3/config.rb +96 -72
- data/lib/arxutils_sqlite3/dbutil/dbconnect.rb +4 -26
- data/lib/arxutils_sqlite3/dbutil.rb +0 -1
- data/lib/arxutils_sqlite3/hier.rb +3 -3
- data/lib/arxutils_sqlite3/migrate.rb +59 -53
- data/lib/arxutils_sqlite3/util.rb +2 -1
- data/lib/arxutils_sqlite3/version.rb +1 -1
- data/lib/arxutils_sqlite3.rb +2 -1
- data/lib/arxutils_sqlite3_rake_task.rb +68 -0
- data/lib/{arxutils_sqlite3/dbutil/dbrelation.rb → dbacrecord.rb} +0 -0
- data/lib/template/{relation/relation.tmpl → acrecord/acrecord.tmpl} +1 -1
- data/lib/template/{relation/relation_count.tmpl → acrecord/acrecord_count.tmpl} +0 -0
- data/lib/template/{relation/relation_current.tmpl → acrecord/acrecord_current.tmpl} +0 -0
- data/lib/template/{relation/relation_invalid.tmpl → acrecord/acrecord_invalid.tmpl} +0 -0
- data/lib/template/{relation → acrecord}/base.tmpl +0 -0
- data/lib/template/{relation → acrecord}/current.tmpl +0 -0
- data/lib/template/{relation → acrecord}/db_scheme/db_scheme.yml +0 -0
- data/lib/template/acrecord/db_scheme/db_scheme.yml.sample +48 -0
- data/lib/template/{relation/db_scheme/dbsetup.rb → acrecord/db_scheme/dbsetup.tmpl} +2 -2
- data/lib/template/acrecord/db_scheme/opts.rb.sample +7 -0
- data/lib/template/acrecord/db_scheme/opts.tmpl +7 -0
- data/lib/template/{relation → acrecord}/invalid.tmpl +0 -0
- data/lib/template/{relation → acrecord}/noitem.tmpl +0 -0
- metadata +30 -26
- data/LICENSE.txt +0 -21
- data/lib/template/relation/db_scheme/opts.rb +0 -8
data/Gemfile.lock
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
arxutils_sqlite3 (0.1.50)
|
5
|
+
activerecord (~> 6.1)
|
6
|
+
activesupport
|
7
|
+
simpleoptparse
|
8
|
+
sqlite3
|
9
|
+
ykutils
|
10
|
+
ykxutils
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
activemodel (6.1.7)
|
16
|
+
activesupport (= 6.1.7)
|
17
|
+
activerecord (6.1.7)
|
18
|
+
activemodel (= 6.1.7)
|
19
|
+
activesupport (= 6.1.7)
|
20
|
+
activesupport (6.1.7)
|
21
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
minitest (>= 5.1)
|
24
|
+
tzinfo (~> 2.0)
|
25
|
+
zeitwerk (~> 2.3)
|
26
|
+
ast (2.4.2)
|
27
|
+
concurrent-ruby (1.1.10)
|
28
|
+
diff-lcs (1.5.0)
|
29
|
+
erubi (1.11.0)
|
30
|
+
erubis (2.7.0)
|
31
|
+
filex (0.1.7)
|
32
|
+
erubis
|
33
|
+
messagex
|
34
|
+
i18n (1.12.0)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
json (2.6.2)
|
37
|
+
messagex (0.1.5)
|
38
|
+
minitest (5.16.3)
|
39
|
+
parallel (1.22.1)
|
40
|
+
parser (3.1.2.1)
|
41
|
+
ast (~> 2.4.1)
|
42
|
+
rainbow (3.1.1)
|
43
|
+
rake (13.0.6)
|
44
|
+
regexp_parser (2.5.0)
|
45
|
+
rexml (3.2.5)
|
46
|
+
rspec (3.11.0)
|
47
|
+
rspec-core (~> 3.11.0)
|
48
|
+
rspec-expectations (~> 3.11.0)
|
49
|
+
rspec-mocks (~> 3.11.0)
|
50
|
+
rspec-core (3.11.0)
|
51
|
+
rspec-support (~> 3.11.0)
|
52
|
+
rspec-expectations (3.11.1)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.11.0)
|
55
|
+
rspec-mocks (3.11.1)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.11.0)
|
58
|
+
rspec-support (3.11.1)
|
59
|
+
rubocop (1.36.0)
|
60
|
+
json (~> 2.3)
|
61
|
+
parallel (~> 1.10)
|
62
|
+
parser (>= 3.1.2.1)
|
63
|
+
rainbow (>= 2.2.2, < 4.0)
|
64
|
+
regexp_parser (>= 1.8, < 3.0)
|
65
|
+
rexml (>= 3.2.5, < 4.0)
|
66
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
67
|
+
ruby-progressbar (~> 1.7)
|
68
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
69
|
+
rubocop-ast (1.21.0)
|
70
|
+
parser (>= 3.1.1.0)
|
71
|
+
rubocop-rake (0.6.0)
|
72
|
+
rubocop (~> 1.0)
|
73
|
+
rubocop-rspec (2.13.1)
|
74
|
+
rubocop (~> 1.33)
|
75
|
+
ruby-progressbar (1.11.0)
|
76
|
+
simpleoptparse (0.1.2)
|
77
|
+
sqlite3 (1.5.0-x86_64-linux)
|
78
|
+
tilt (2.0.11)
|
79
|
+
tzinfo (2.0.5)
|
80
|
+
concurrent-ruby (~> 1.0)
|
81
|
+
unicode-display_width (2.3.0)
|
82
|
+
webrick (1.7.0)
|
83
|
+
yard (0.9.28)
|
84
|
+
webrick (~> 1.7.0)
|
85
|
+
ykutils (0.1.6)
|
86
|
+
erubi
|
87
|
+
filex
|
88
|
+
tilt
|
89
|
+
ykxutils (0.1.5)
|
90
|
+
zeitwerk (2.6.0)
|
91
|
+
|
92
|
+
PLATFORMS
|
93
|
+
x86_64-linux
|
94
|
+
|
95
|
+
DEPENDENCIES
|
96
|
+
activerecord (~> 6.1)
|
97
|
+
activesupport
|
98
|
+
arxutils_sqlite3!
|
99
|
+
bundler
|
100
|
+
rake (~> 13.0)
|
101
|
+
rspec (~> 3.0)
|
102
|
+
rubocop (~> 1.7)
|
103
|
+
rubocop-rake
|
104
|
+
rubocop-rspec
|
105
|
+
simpleoptparse
|
106
|
+
sqlite3
|
107
|
+
yard
|
108
|
+
ykutils (> 0.1.3)
|
109
|
+
ykxutils (> 0.1.0)
|
110
|
+
|
111
|
+
BUNDLED WITH
|
112
|
+
2.3.17
|
data/Rakefile
CHANGED
@@ -1,67 +1,21 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
require "rake/testtask"
|
2
|
+
# require "rake/testtask"
|
4
3
|
|
5
|
-
Rake::TestTask.new do |t|
|
6
|
-
t.libs << "test"
|
7
|
-
end
|
4
|
+
# Rake::TestTask.new do |t|
|
5
|
+
# t.libs << "test"
|
6
|
+
# end
|
8
7
|
|
9
|
-
desc "Run test"
|
10
|
-
task default: :test
|
11
|
-
=end
|
8
|
+
# desc "Run test"
|
9
|
+
# task default: :test
|
12
10
|
|
13
|
-
|
14
|
-
task default: %w[delete setup makeconfig migrate integrate]
|
11
|
+
require "rspec/core/rake_task"
|
15
12
|
|
16
|
-
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
17
14
|
|
18
|
-
|
15
|
+
require "rubocop/rake_task"
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
task s: %w[setup]
|
23
|
-
|
24
|
-
task sc: %w[setup makeconfig]
|
25
|
-
|
26
|
-
task dscm: %w[delete setup makeconfig migrate]
|
27
|
-
|
28
|
-
task scm: %w[setup makeconfig migrate]
|
29
|
-
|
30
|
-
task dscmi: %w[delete setup makeconfig migrate integrate]
|
31
|
-
|
32
|
-
task scmi: %w[setup makeconfig migrate integrate]
|
33
|
-
|
34
|
-
task mi: %w[migrate integrate]
|
35
|
-
|
36
|
-
task bmi: %w[delete_db migrate integrate]
|
37
|
-
|
38
|
-
task b: %w[delete_db]
|
39
|
-
|
40
|
-
# コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
|
41
|
-
# プトファイルの生成
|
42
|
-
task :setup do
|
43
|
-
sh "bundle exec arxutils_sqlite3 --cmd=s --klass=Enop"
|
44
|
-
end
|
45
|
-
|
46
|
-
# DB構成情報の生成
|
47
|
-
task :makeconfig do
|
48
|
-
sh "bundle exec arxutils_sqlite3 --cmd=c"
|
49
|
-
end
|
50
|
-
# マイグレート用スクリプトファイルの生成とマイグレートの実行
|
51
|
-
task :migrate do
|
52
|
-
sh "bundle exec arxutils_sqlite3 --cmd=m --yaml=config/db_scheme.yml"
|
53
|
-
end
|
54
|
-
|
55
|
-
task :integrate do
|
56
|
-
sh "bundle exec arxutils_sqlite3 --cmd=i"
|
57
|
-
end
|
58
|
-
|
59
|
-
task :delete do
|
60
|
-
sh "bundle exec arxutils_sqlite3 --cmd=d"
|
61
|
-
end
|
62
|
-
|
63
|
-
task :delete_db do
|
64
|
-
sh "bundle exec arxutils_sqlite3 --cmd=b"
|
65
|
-
end
|
17
|
+
RuboCop::RakeTask.new
|
66
18
|
|
19
|
+
# task default: %i[spec rubocop]
|
67
20
|
|
21
|
+
require "arxutils_sqlite3_rake_task"
|
data/arxutils_sqlite3.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "utility functions for ActiveRecord."
|
13
13
|
spec.homepage = "https://ykominami.github.io/arxutils_sqlite3/"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
18
18
|
|
@@ -31,21 +31,21 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
spec.bindir = "exe"
|
33
33
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
|
-
#p spec.executables
|
34
|
+
# p spec.executables
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
spec.add_runtime_dependency "activesupport"
|
37
37
|
# spec.add_runtime_dependency "erb"
|
38
38
|
# spec.add_runtime_dependency "activerecord", "~> 4.2"
|
39
39
|
|
40
40
|
spec.add_runtime_dependency "activerecord", "~> 6.1"
|
41
|
+
spec.add_runtime_dependency "simpleoptparse"
|
41
42
|
spec.add_runtime_dependency "sqlite3"
|
42
43
|
spec.add_runtime_dependency "ykutils"
|
43
44
|
spec.add_runtime_dependency "ykxutils"
|
44
|
-
spec.add_runtime_dependency "simpleoptparse"
|
45
45
|
# spec.add_development_dependency "bundler", "~> 2.2.10"
|
46
46
|
spec.add_development_dependency "bundler"
|
47
|
-
spec.add_development_dependency "rspec" , "~> 3.0"
|
48
47
|
spec.add_development_dependency "rake", "~> 13.0"
|
48
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
49
49
|
spec.add_development_dependency "rubocop", "~> 1.7"
|
50
50
|
spec.add_development_dependency "rubocop-rake"
|
51
51
|
spec.add_development_dependency "rubocop-rspec"
|
data/config/.gitignore
CHANGED
data/config/setting.yml
ADDED
data/exe/arxutils_sqlite3
CHANGED
@@ -8,42 +8,48 @@ require "ykxutils"
|
|
8
8
|
|
9
9
|
config = Arxutils_Sqlite3::Config.new
|
10
10
|
|
11
|
-
cli = Arxutils_Sqlite3::Cli.new(config)
|
12
|
-
|
13
11
|
config.require_opts_file
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
opts = @opts || {}
|
14
|
+
|
15
|
+
acrecord = opts[:acrecord]
|
16
|
+
if acrecord
|
17
|
+
filename = acrecord[:filename]
|
18
|
+
basename = File.basename(filename)
|
19
|
+
|
20
|
+
begin
|
21
|
+
require basename.to_s
|
22
|
+
rescue LoadError
|
23
|
+
# pp ex.message
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
27
|
+
opts[:db_dir] = Arxutils_Sqlite3::Config::DB_DIR
|
21
28
|
|
22
|
-
klass = nil
|
23
29
|
setting = config.load_setting_yaml_file
|
24
30
|
klass = setting[:klass]
|
25
31
|
|
26
32
|
# DBセットアップクラス
|
27
33
|
config.require_dbsetup_file
|
28
34
|
|
29
|
-
banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|c|m|
|
30
|
-
|
31
|
-
opts = @opts ? @opts : {}
|
32
|
-
opts["dbconfig"] = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
|
35
|
+
banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|b) -y yaml_file --klass=class"
|
33
36
|
|
34
37
|
Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser|
|
35
|
-
parser.on("--cmd X", %w[s c m
|
38
|
+
parser.on("--cmd X", %w[s cds co c f m a d b]) { |x| opts["cmd"] = x }
|
36
39
|
parser.on("-y yaml_file", "--yaml yaml_file") { |x| opts["yaml"] = x }
|
37
40
|
parser.on("--klass klass") { |x| opts["klass"] = x }
|
38
41
|
end
|
39
42
|
klass = opts["klass"] if opts["klass"]
|
40
43
|
|
44
|
+
dbconfig = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
|
41
45
|
env = ENV.fetch("ENV", nil)
|
42
46
|
env ||= "production"
|
43
47
|
|
48
|
+
cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env)
|
49
|
+
|
44
50
|
case opts["cmd"]
|
45
51
|
when "s"
|
46
|
-
config.check_file_exist(Arxutils_Sqlite3::Config::
|
52
|
+
# config.check_file_exist(Arxutils_Sqlite3::Config::SAMPLE_DEST_OPTS_FILE, banner, 10)
|
47
53
|
|
48
54
|
if opts["klass"].nil? || opts["klass"].strip == ""
|
49
55
|
puts banner
|
@@ -51,39 +57,42 @@ when "s"
|
|
51
57
|
end
|
52
58
|
cli.setup(klass)
|
53
59
|
|
60
|
+
when "cds"
|
61
|
+
cli.copy_db_scheme
|
62
|
+
|
63
|
+
when "co"
|
64
|
+
cli.copy_opts_file
|
65
|
+
|
54
66
|
when "c"
|
55
|
-
|
56
|
-
|
57
|
-
cli.makeconfig(dbconfig, relation, banner, 30, opts)
|
67
|
+
acrecord = opts[:acrecord]
|
68
|
+
cli.makeconfig(acrecord, banner, 30, opts)
|
58
69
|
|
59
|
-
when "
|
70
|
+
when "f"
|
60
71
|
yaml_fname = opts["yaml"]
|
61
|
-
|
62
|
-
dbconfig = opts["dbconfig"]
|
72
|
+
acrecord = opts[:acrecord]
|
63
73
|
if yaml_fname.nil? || yaml_fname.strip == ""
|
64
74
|
puts banner
|
65
75
|
exit 40
|
66
76
|
end
|
67
77
|
yaml_pn = Pathname.new(yaml_fname)
|
68
78
|
config.check_file_not_exist(yaml_pn, banner, 55)
|
79
|
+
cli.setup_for_migrate(yaml_pn, acrecord, klass)
|
69
80
|
|
70
|
-
|
81
|
+
when "m"
|
82
|
+
cli.migrate
|
71
83
|
|
72
|
-
when "
|
73
|
-
|
74
|
-
cli.integrate(dbconfig, env)
|
84
|
+
when "a"
|
85
|
+
cli.acr
|
75
86
|
|
76
87
|
when "d"
|
77
88
|
db_scheme_ary = nil
|
78
|
-
|
79
|
-
|
80
|
-
cli.delete(dbconfig, db_scheme_ary, relation)
|
89
|
+
acrecord = opts["acrecord"]
|
90
|
+
cli.delete(db_scheme_ary, acrecord)
|
81
91
|
|
82
92
|
when "b"
|
83
93
|
db_scheme_ary = nil
|
84
|
-
|
85
|
-
|
86
|
-
cli.delete_db(dbconfig, db_scheme_ary, relation)
|
94
|
+
acrecord = opts["acrecord"]
|
95
|
+
cli.delete_db(db_scheme_ary, acrecord)
|
87
96
|
else
|
88
97
|
puts "Invalid command(#{opts["cmd"]}) specified!!"
|
89
98
|
end
|
data/lib/arxutils_sqlite3/arx.rb
CHANGED
@@ -18,11 +18,11 @@ module Arxutils_Sqlite3
|
|
18
18
|
# :items
|
19
19
|
# フィールド名, 型, null許容 の配列
|
20
20
|
# :plural
|
21
|
-
# :
|
21
|
+
# :acrecord
|
22
22
|
@data = data
|
23
23
|
|
24
24
|
# スキーマ設定の:itemsの値を展開後格納するためのStructクラス
|
25
|
-
|
25
|
+
# @field ||= Struct.new("Field", :name, :type, :null)
|
26
26
|
@field ||= Struct.new(:name, :type, :null)
|
27
27
|
|
28
28
|
@data[:ary] = if @data[:items]
|
@@ -35,7 +35,7 @@ module Arxutils_Sqlite3
|
|
35
35
|
# テンプレートファイルを元にした変換結果を返す
|
36
36
|
def create
|
37
37
|
scope = Object.new
|
38
|
-
scope.instance_variable_set(:@data
|
38
|
+
scope.instance_variable_set(:@data, @data)
|
39
39
|
Ykutils::Erubyx.erubi_render_with_template_file(@fname, scope)
|
40
40
|
end
|
41
41
|
end
|
data/lib/arxutils_sqlite3/cli.rb
CHANGED
@@ -1,66 +1,87 @@
|
|
1
1
|
module Arxutils_Sqlite3
|
2
2
|
# CLI用クラス
|
3
3
|
class Cli
|
4
|
-
def initialize(config)
|
4
|
+
def initialize(config, dbconfig, env)
|
5
5
|
@config = config
|
6
|
+
@dbconfig = dbconfig
|
7
|
+
@env = env
|
6
8
|
end
|
7
9
|
|
8
10
|
def setup(klass)
|
11
|
+
# p "make_config_directory"
|
9
12
|
@config.make_config_directory
|
13
|
+
# p "setup_db_scheme_file"
|
10
14
|
@config.setup_db_scheme_file
|
15
|
+
# p "setup_opts_file(#{klass})"
|
11
16
|
@config.setup_opts_file(klass)
|
17
|
+
# p "setup_setting_yaml_file(#{klass})"
|
12
18
|
@config.setup_setting_yaml_file(klass)
|
13
|
-
#db_scheme_ary = nil
|
19
|
+
# db_scheme_ary = nil
|
14
20
|
end
|
15
21
|
|
16
|
-
def
|
22
|
+
def copy_db_scheme
|
23
|
+
# DBスキームファイルが存在しなければ、サンプルファイルをDBスキームファイルとしてコピー
|
24
|
+
@config.copy_db_scheme_file
|
25
|
+
end
|
26
|
+
|
27
|
+
def copy_opts_file
|
28
|
+
# optsファイルが存在しなければ、サンプルファイルをoptsファイルとしてコピー
|
29
|
+
@config.copy_opts_file
|
30
|
+
end
|
31
|
+
|
32
|
+
def makeconfig(acrecord, _banner, _exit_code, opts)
|
17
33
|
db_scheme_ary = nil
|
18
|
-
dbconfig_path = @config.make_dbconfig_path(dbconfig)
|
19
|
-
@config.check_file_exist(dbconfig_path, banner, exit_code)
|
20
|
-
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig,
|
34
|
+
dbconfig_path = @config.make_dbconfig_path(@dbconfig)
|
35
|
+
# @config.check_file_exist(dbconfig_path, banner, exit_code)
|
36
|
+
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, @dbconfig, acrecord)
|
21
37
|
mig.make_dbconfig(opts)
|
22
38
|
end
|
23
39
|
|
24
|
-
def
|
25
|
-
db_scheme_ary = YAML.load_file(
|
26
|
-
dbconfig_path = @config.make_dbconfig_path(dbconfig)
|
40
|
+
def setup_for_migrate(yaml_pn, acrecord, klass)
|
41
|
+
db_scheme_ary = YAML.load_file(yaml_pn)
|
42
|
+
dbconfig_path = @config.make_dbconfig_path(@dbconfig)
|
27
43
|
|
28
44
|
dest_dbsetup_file = @config.get_dest_dbsetup_file
|
29
|
-
@config.make_dbsetup_file(db_scheme_ary,
|
30
|
-
|
31
|
-
connect_time = Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(@config, dbconfig, env)
|
45
|
+
@config.make_dbsetup_file(db_scheme_ary, acrecord, klass, dest_dbsetup_file)
|
32
46
|
|
33
|
-
# マイグレーション用スクリプトの生成、
|
34
|
-
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig,
|
47
|
+
# マイグレーション用スクリプトの生成、acrecordのクラス定義ファイルの生成
|
48
|
+
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, @dbconfig, acrecord)
|
35
49
|
mig.output
|
50
|
+
end
|
51
|
+
|
52
|
+
def migrate
|
53
|
+
# migrate用スクリプトの出力先ディレクトリ名
|
54
|
+
migrate_dir = @config.get_migrate_dir
|
55
|
+
|
56
|
+
Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(@config, @dbconfig, @env)
|
36
57
|
|
37
58
|
# マイグレーション実行
|
38
|
-
ActiveRecord::MigrationContext.new(
|
59
|
+
ActiveRecord::MigrationContext.new(migrate_dir, ActiveRecord::SchemaMigration).up
|
39
60
|
end
|
40
61
|
|
41
|
-
def
|
42
|
-
connect_time = Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(@config, dbconfig, env)
|
62
|
+
def acr
|
63
|
+
connect_time = Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(@config, @dbconfig, @env)
|
43
64
|
Dbsetup.new(connect_time)
|
44
65
|
end
|
45
66
|
|
46
|
-
def delete(
|
67
|
+
def delete(db_scheme_ary, acrecord)
|
47
68
|
config_dir = @config.get_config_dir
|
48
|
-
dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
|
49
|
-
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig,
|
69
|
+
dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, @dbconfig)
|
70
|
+
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, @dbconfig, acrecord)
|
50
71
|
mig.delete_migrate_and_config_and_db
|
51
72
|
end
|
52
73
|
|
53
|
-
def delete_db(
|
54
|
-
config_dir = config.get_config_dir
|
55
|
-
dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
|
56
|
-
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig,
|
74
|
+
def delete_db(db_scheme_ary, acrecord)
|
75
|
+
config_dir = @config.get_config_dir
|
76
|
+
dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, @dbconfig)
|
77
|
+
mig = @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, @dbconfig, acrecord)
|
57
78
|
# mig.delete_migrate_config_and_db
|
58
79
|
mig.delete_db
|
59
80
|
end
|
60
81
|
|
61
|
-
def rm_dbconfig
|
62
|
-
dbconfig_path = @config.make_dbconfig_path(dbconfig)
|
63
|
-
p dbconfig_path
|
82
|
+
def rm_dbconfig
|
83
|
+
dbconfig_path = @config.make_dbconfig_path(@dbconfig)
|
84
|
+
# p dbconfig_path
|
64
85
|
FileUtils.rm_f(dbconfig_path)
|
65
86
|
end
|
66
87
|
end
|