tapsoob 0.3.8-java → 0.3.13-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tapsoob/schema.rb +19 -2
- data/lib/tapsoob/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: cb8a00a3e0e55eebdd6fe0fadd07b36f728f6e7339484ca1dafe33672e08d72a
|
4
|
+
data.tar.gz: 61e763aae7ca21507d9558f652f1ed600dcce77bf53b1b72ceff81990b9b2d85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa22198dfbfbcfb103e7f217a83f6bb7160280d38ecca7fb595573563ac2ebc243a39fa63cd97d67422e08d38cb602b84544db74d6817e415e185e980fad3a5
|
7
|
+
data.tar.gz: 60c9d09e6218b649793a79b38ef521938dade0c4dc072864cd0fc37bbc9aeb46a9d9f6631cf98f2f8e9b7ccf2c7f53b6aed7b4cb6549cd7f20bff33047e7001c
|
data/lib/tapsoob/schema.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'sequel'
|
3
3
|
require 'sequel/extensions/schema_dumper'
|
4
4
|
require 'sequel/extensions/migration'
|
5
|
+
require 'erb'
|
5
6
|
require 'json'
|
6
7
|
|
7
8
|
module Tapsoob
|
@@ -11,7 +12,23 @@ module Tapsoob
|
|
11
12
|
def dump(database_url)
|
12
13
|
db = Sequel.connect(database_url)
|
13
14
|
db.extension :schema_dumper
|
14
|
-
|
15
|
+
template = ERB.new <<-END_MIG
|
16
|
+
Class.new(Sequel::Migration) do
|
17
|
+
def up
|
18
|
+
<% db.tables.each do |table| %>
|
19
|
+
<%= db.dump_table_schema(table, indexes: false) %>
|
20
|
+
<% end %>
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
<% db.tables.each do |table| %>
|
25
|
+
drop_table("<%= table %>", if_exists: true)
|
26
|
+
<% end %>
|
27
|
+
end
|
28
|
+
end
|
29
|
+
END_MIG
|
30
|
+
|
31
|
+
template.result(binding)
|
15
32
|
end
|
16
33
|
|
17
34
|
def dump_table(database_url, table)
|
@@ -21,7 +38,7 @@ module Tapsoob
|
|
21
38
|
<<END_MIG
|
22
39
|
Class.new(Sequel::Migration) do
|
23
40
|
def up
|
24
|
-
#{db.dump_table_schema(table, :
|
41
|
+
#{db.dump_table_schema(table, indexes: false)}
|
25
42
|
end
|
26
43
|
|
27
44
|
def down
|
data/lib/tapsoob/version.rb
CHANGED