git-fit 0.5.5 → 0.5.6
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/lib/git_fit/db/cli.rb +17 -0
- data/lib/git_fit/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: 7089f5239cfdfa84e26c2d7b6d5cf1b752f058e39c9133d448882b85a71d26eb
|
|
4
|
+
data.tar.gz: c09e5c2c468f4e33623c90e90409130f184a908e93cd601480795c4625f31b44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34e7549e0d4cf4b91f87c73c769e54f3759a7ce9029b9de271d324b1936eefdaa20f38c3a7dd4fd42aef180df7dbaf0d037172a8e9dbbf29ccb19fdb15db8ef4
|
|
7
|
+
data.tar.gz: bb3e13a18df0f9db94888d8dbc590c50eb778dbdf00cd3ac4a9f6b888185966c3b0d204ded94cd46271c27f8da1733adb74ce433929b6262c6fcbfaae29fdf0f
|
data/lib/git_fit/db/cli.rb
CHANGED
|
@@ -11,6 +11,23 @@ module GitFit
|
|
|
11
11
|
rescue => e
|
|
12
12
|
say_status :error, "Migration failed: #{e.message}", :red
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
desc "schema", "Print DB schema DDL derived from migrations"
|
|
16
|
+
option :hash, type: :boolean, desc: "Print sha256 hexdigest instead of DDL"
|
|
17
|
+
def schema
|
|
18
|
+
require "digest"
|
|
19
|
+
db = Sequel.sqlite
|
|
20
|
+
Sequel.extension :migration
|
|
21
|
+
dir = File.expand_path("../../../db/migrations", __dir__)
|
|
22
|
+
Sequel::Migrator.run(db, dir)
|
|
23
|
+
ddl = db.fetch("SELECT sql FROM sqlite_master WHERE sql IS NOT NULL ORDER BY name")
|
|
24
|
+
.map(:sql).join("\n") + "\n"
|
|
25
|
+
if options[:hash]
|
|
26
|
+
puts Digest::SHA256.hexdigest(ddl)
|
|
27
|
+
else
|
|
28
|
+
print ddl
|
|
29
|
+
end
|
|
30
|
+
end
|
|
14
31
|
end
|
|
15
32
|
end
|
|
16
33
|
end
|
data/lib/git_fit/version.rb
CHANGED