convergence 0.1.9 → 0.2.0

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: a839465d475a50eae409d5ca2b011c87bc8901c7
4
- data.tar.gz: 49f17cd9ba7ed95ad89eee5482023fed50efd405
3
+ metadata.gz: 4f2334253e9274a1c650066b277fdc914ca7abfb
4
+ data.tar.gz: 48991cf3b53a652e09a7e3bb8093054bd416094c
5
5
  SHA512:
6
- metadata.gz: 442ac80d6c3ad2e9fb556d7ba7e275e3cc9cdbd74a55b8925ec436bef64abbb02ae689ac18eed61aebb0a551c70608a1d14a27841fa5be3e17336cce5f59a324
7
- data.tar.gz: 82136a25f4c36988b5bc1e7accbcb16571888b056cf9387ab8c1d3943ee7bdd1c31c4859eb22a85fab8f91d615c3584c46ad5173f3f42e50c068176b467c9738
6
+ metadata.gz: 7133646cdcd831b6ea8d15db42d4de4b9bc0ce6e2bd73abbca90cd6266ed9ef5596314cf3b01ef8f4639ce4a4ee88d98fa6deabc6b031e9d3d90833c8de7749d
7
+ data.tar.gz: c234b3e5bae60a0004f2f5c0399fdaf2f87016df45ad235ed5fdf28807a4d83b61ffa120a490847a020c9af99c69096a0beb0dab230c3200892b3b6bbaf6571d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- convergence (0.1.9)
4
+ convergence (0.2.0)
5
5
  diff-lcs
6
6
  diffy
7
7
  mysql2
@@ -36,7 +36,7 @@ GEM
36
36
  rb-inotify (>= 0.9)
37
37
  lumberjack (1.0.9)
38
38
  method_source (0.8.2)
39
- mysql2 (0.4.4)
39
+ mysql2 (0.4.5)
40
40
  parser (2.2.0.pre.5)
41
41
  ast (>= 1.1, < 3.0)
42
42
  slop (~> 3.4, >= 3.4.5)
@@ -88,4 +88,4 @@ DEPENDENCIES
88
88
  rubocop
89
89
 
90
90
  BUNDLED WITH
91
- 1.12.5
91
+ 1.13.6
@@ -1,3 +1,4 @@
1
+ require 'mysql2'
1
2
  class Convergence::DatabaseConnector::MysqlConnector
2
3
  attr_reader :config
3
4
 
@@ -1,4 +1,3 @@
1
- require 'mysql2'
2
1
  class Convergence::Dumper::MysqlSchemaDumper
3
2
  def initialize(connector)
4
3
  @connector = connector
@@ -139,6 +138,9 @@ class Convergence::Dumper::MysqlSchemaDumper
139
138
  limit = column_type.scan(/\d+/)[0]
140
139
  options.merge!(limit: limit) unless limit.nil?
141
140
  end
141
+ if column_type.downcase.include?('unsigned')
142
+ options.merge!(unsigned: true)
143
+ end
142
144
  options.merge!(extra: column['EXTRA']) unless column['EXTRA'].empty?
143
145
  options.merge!(comment: column['COLUMN_COMMENT']) unless column['COLUMN_COMMENT'].empty?
144
146
  [data_type, column_name, options]
@@ -152,6 +152,9 @@ DROP TABLE `#{table_name}`;
152
152
  if column.options[:precision] && column.options[:scale]
153
153
  sql += "(#{column.options[:precision]}, #{column.options[:scale]})"
154
154
  end
155
+ if column.options[:unsigned]
156
+ sql += ' UNSIGNED'
157
+ end
155
158
  if column.options[:character_set]
156
159
  sql += " CHARACTER SET #{column.options[:character_set]}"
157
160
  end
@@ -1,3 +1,3 @@
1
1
  module Convergence
2
- VERSION = '0.1.9'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -147,7 +147,7 @@ describe Convergence::DSL do
147
147
  let(:table_to) do
148
148
  Convergence::Table.new('table1').tap do |t|
149
149
  t.int('id', primary_key: true)
150
- t.varchar('name', limit: 300, null: true)
150
+ t.varchar('name', limit: 300, null: true, unsigned: true)
151
151
 
152
152
  t.index('name')
153
153
  end
@@ -158,6 +158,7 @@ describe Convergence::DSL do
158
158
  expect(results[:change_column]['name']).not_to be_nil
159
159
  expect(results[:change_column]['name'][:limit]).to eq('300')
160
160
  expect(results[:change_column]['name'][:null]).to eq('true')
161
+ expect(results[:change_column]['name'][:unsigned]).to eq('true')
161
162
  end
162
163
  end
163
164
 
@@ -8,6 +8,7 @@ describe Convergence::DSL do
8
8
  t.varchar "email"
9
9
  t.varchar "first_name"
10
10
  t.varchar "last_name"
11
+ t.int "age", unsigned: true
11
12
  t.datetime "created_at", null: true
12
13
 
13
14
  t.index 'email', length: 100
@@ -60,6 +61,7 @@ describe Convergence::DSL do
60
61
  expect(columns['id'].options[:null]).to be_falsy
61
62
  expect(columns['id'].options[:limit]).to eq(11)
62
63
  expect(columns['id'].options[:extra]).to eq('auto_increment')
64
+ expect(columns['age'].options[:unsigned]).to be_truthy
63
65
  end
64
66
 
65
67
  it 'should be able to parse indexes' do
@@ -63,6 +63,10 @@ describe Convergence::Dumper::MysqlSchemaDumper do
63
63
  expect(subject['papers'].columns['title1'].options[:null]).to be_falsy
64
64
  expect(subject['authors'].columns['created_at'].options[:null]).to be_truthy
65
65
  end
66
+
67
+ it 'should be dump unsigned definition' do
68
+ expect(subject['authors'].columns['age'].options[:unsigned]).to be_truthy
69
+ end
66
70
  end
67
71
  end
68
72
 
@@ -2,6 +2,7 @@ create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
4
  t.varchar "add_column", null: true, limit: 110
5
+ t.int "age", unsigned: true
5
6
  t.datetime "created_at", null: true
6
7
  t.datetime "updated_at", null: true
7
8
 
@@ -1,6 +1,7 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
+ t.int "age", unsigned: true
4
5
  t.datetime "created_at", null: true
5
6
  t.datetime "updated_at", null: true
6
7
 
@@ -1,6 +1,7 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
+ t.int "age", unsigned: true
4
5
  t.datetime "created_at", null: true, comment: 'Created At'
5
6
  t.datetime "updated_at", null: true
6
7
 
@@ -1,6 +1,7 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
+ t.int "age", unsigned: true
4
5
  t.datetime "created_at", null: true
5
6
  t.datetime "updated_at", null: true
6
7
 
@@ -1,6 +1,7 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "Author Table" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
+ t.int "age", unsigned: true
4
5
  t.datetime "created_at", null: true
5
6
  t.datetime "updated_at", null: true
6
7
 
@@ -1,6 +1,7 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
+ t.int "age", unsigned: true
4
5
  t.datetime "created_at", null: true
5
6
  t.datetime "updated_at", null: true
6
7
 
@@ -1,6 +1,7 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
3
  t.varchar "name", limit: 110
4
+ t.int "age", unsigned: true
4
5
  t.datetime "created_at", null: true
5
6
  t.datetime "updated_at", null: true
6
7
 
@@ -1,5 +1,6 @@
1
1
  create_table "authors", collate: "utf8_general_ci", comment: "" do |t|
2
2
  t.int "id", primary_key: true, extra: "auto_increment"
3
+ t.int "age", unsigned: true
3
4
  t.datetime "created_at", null: true
4
5
  t.datetime "updated_at", null: true
5
6
 
@@ -14,6 +14,7 @@ CREATE TABLE `papers` (
14
14
  CREATE TABLE `authors` (
15
15
  `id` int(11) NOT NULL AUTO_INCREMENT,
16
16
  `name` varchar(110) NOT NULL,
17
+ `age` int(11) UNSIGNED NOT NULL,
17
18
  `created_at` datetime DEFAULT NULL,
18
19
  `updated_at` datetime DEFAULT NULL,
19
20
  PRIMARY KEY (`id`),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convergence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinsuke Nishio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-17 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2