schema_extractor 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00af36b44554c23c33829b3c21cb5c392e2d15a9
4
- data.tar.gz: 0c9aca168e4f9c53f8a95c20dc1bd44f8aea5182
3
+ metadata.gz: 90ee6103676996cfefaffca5e0b3f2644547b3f0
4
+ data.tar.gz: 0044c7a2680b9d40d4ce281e3b56f74ad9cb73f9
5
5
  SHA512:
6
- metadata.gz: fa8e4f468f32f9ef901a8c1c7f6dddc1e1cdaa698eb2b4e03db30b9062fffe2737c64e3133771ad15369ea9c0f54429673723e3489bdc00082fdcef43d3db055
7
- data.tar.gz: d73cb1ff9a7aebb3eb9fe4fe5b06994eb76f6388f864f37a29fd2636c1fc5eed788f370369d577ef69c01f893e08e5ff6f6590e222bed70efc55577fa9ccc528
6
+ metadata.gz: fffd16573e54f9967c3d256313763a57efcc16a20f9fd23b6931348f106ec5553b4aa59afe857722a036f07c2da6b857019ff5e6f9cb0c2351be009767c7a6da
7
+ data.tar.gz: c9354a30e7e479075a03218db93534b11b5ebcf22b60f1c3512389bf2ebdc387ebd34283b3445ad9c4d511d8630d72deb53b7002f54cebc1a2e6cae0c1f916ad
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # SchemaExtractor
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/schema_extractor`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Extract DB schema and output as specific format.
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,26 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ ```bash
24
+ $ exe/schema_extractor --help
25
+ usage: schema_extractor [options]
26
+ -s, --source Source database type. Supported sources: mysql
27
+ -f, --format Output format. Supported formats: bq, bigquery
28
+ -o, --output Output directory.
29
+ -h, --host Host of database.
30
+ -u, --user User of database.
31
+ -p, --password Password of database.
32
+ -P, --port Port of database.
33
+ -d, --database Database name.
34
+ -v, --version Show version.
35
+ --help Show this message.
36
+ ```
37
+
38
+ Example:
39
+
40
+ ```bash
41
+ $ schema_extractor -s mysql -f bigquery -h 127.0.0.1 -u dbuser -d mydb -p dbpass -o tmp
42
+ ```
26
43
 
27
44
  ## Development
28
45
 
@@ -32,7 +49,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
49
 
33
50
  ## Contributing
34
51
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/schema_extractor.
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nownabe/schema_extractor.
36
53
 
37
54
 
38
55
  ## License
@@ -62,17 +62,17 @@ module SchemaExtractor
62
62
 
63
63
  def detect_type(row)
64
64
  case row["Type"]
65
- when /^date/
65
+ when /^date$/
66
66
  :date
67
- when /^datetime/
67
+ when /^datetime$/
68
68
  :datetime
69
- when /^decimal/
69
+ when /^decimal\(\d+,\d+\)$/
70
70
  :decimal
71
- when /^float/
71
+ when /^float$/
72
72
  :float
73
- when /^bigint/, /^int/, /^smallint/, /^tinyint/
73
+ when /^bigint\(\d+\)$/, /^int\(\d+\)$/, /^smallint\(\d+\)$/, /^tinyint\(\d+\)$/
74
74
  :integer
75
- when /^longtext/, /^text/, /^varchar/
75
+ when /^longtext$/, /^text$/, /^varchar\(\d+\)$/
76
76
  :string
77
77
  else
78
78
  raise UnknownFieldTypeError, "#{row['Type']} is unknown type."
@@ -1,3 +1,3 @@
1
1
  module SchemaExtractor
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.authors = ["nownabe"]
11
11
  spec.email = ["nownabe@gmail.com"]
12
12
 
13
- spec.summary = "Extract DB schema."
13
+ spec.summary = "Extract DB schema as output as specific format."
14
14
  spec.homepage = "https://github.com/nownabe/schema_extractor"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nownabe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2017-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,5 +131,5 @@ rubyforge_project:
131
131
  rubygems_version: 2.6.11
132
132
  signing_key:
133
133
  specification_version: 4
134
- summary: Extract DB schema.
134
+ summary: Extract DB schema as output as specific format.
135
135
  test_files: []