lhm 1.0.2 → 1.0.3
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.
- data/CHANGELOG.md +8 -4
- data/lib/lhm/migrator.rb +1 -2
- data/lib/lhm/version.rb +1 -1
- data/spec/fixtures/small_table.ddl +4 -0
- data/spec/integration/lhm_spec.rb +16 -0
- data/spec/unit/migrator_spec.rb +2 -3
- metadata +4 -2
data/CHANGELOG.md
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
-
# 1.0.
|
1
|
+
# 1.0.3 (February 23, 2012)
|
2
|
+
|
3
|
+
* Improve change_column
|
4
|
+
|
5
|
+
# 1.0.2 (February 17, 2012)
|
2
6
|
|
3
7
|
* closes https://github.com/soundcloud/large-hadron-migrator/issues/11
|
4
8
|
this critical bug could cause data loss. table parser was replaced with
|
5
9
|
an implementation that reads directly from information_schema.
|
6
10
|
|
7
|
-
# 1.0.1 (
|
11
|
+
# 1.0.1 (February 09, 2012)
|
8
12
|
|
9
13
|
* released to rubygems
|
10
14
|
|
11
|
-
# 1.0.0 (
|
15
|
+
# 1.0.0 (February 09, 2012)
|
12
16
|
|
13
17
|
* added change_column
|
14
18
|
* final 1.0 release
|
15
19
|
|
16
|
-
# 1.0.0.rc8 (
|
20
|
+
# 1.0.0.rc8 (February 09, 2012)
|
17
21
|
|
18
22
|
* removed spec binaries from gem bins
|
19
23
|
|
data/lib/lhm/migrator.rb
CHANGED
@@ -66,8 +66,7 @@ module Lhm
|
|
66
66
|
# @param [String] name Name of the column to change
|
67
67
|
# @param [String] definition Valid SQL column definition
|
68
68
|
def change_column(name, definition)
|
69
|
-
|
70
|
-
add_column(name, definition)
|
69
|
+
ddl("alter table `%s` modify column `%s` %s" % [@name, name, definition])
|
71
70
|
end
|
72
71
|
|
73
72
|
# Remove a column from a table
|
data/lib/lhm/version.rb
CHANGED
@@ -119,6 +119,22 @@ describe Lhm do
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
it "should change the last column in a table" do
|
123
|
+
table_create(:small_table)
|
124
|
+
|
125
|
+
Lhm.change_table(:small_table) do |t|
|
126
|
+
t.change_column(:id, "int(5)")
|
127
|
+
end
|
128
|
+
|
129
|
+
slave do
|
130
|
+
table_read(:small_table).columns["id"].must_equal({
|
131
|
+
:type => "int(5)",
|
132
|
+
:is_nullable => "NO",
|
133
|
+
:column_default => "0"
|
134
|
+
})
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
122
138
|
describe "parallel" do
|
123
139
|
it "should perserve inserts during migration" do
|
124
140
|
50.times { |n| execute("insert into users set reference = '#{ n }'") }
|
data/spec/unit/migrator_spec.rb
CHANGED
@@ -66,11 +66,10 @@ describe Lhm::Migrator do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should change a column" do
|
69
|
-
@creator.change_column("logins", "INT(
|
69
|
+
@creator.change_column("logins", "INT(11)")
|
70
70
|
|
71
71
|
@creator.statements.must_equal([
|
72
|
-
"alter table `lhmn_alt`
|
73
|
-
"alter table `lhmn_alt` add column `logins` INT(255)"
|
72
|
+
"alter table `lhmn_alt` modify column `logins` INT(11)"
|
74
73
|
])
|
75
74
|
end
|
76
75
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: lhm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- SoundCloud
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2012-02-
|
16
|
+
date: 2012-02-22 00:00:00 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: mysql
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- spec/bootstrap.rb
|
99
99
|
- spec/fixtures/destination.ddl
|
100
100
|
- spec/fixtures/origin.ddl
|
101
|
+
- spec/fixtures/small_table.ddl
|
101
102
|
- spec/fixtures/users.ddl
|
102
103
|
- spec/integration/chunker_spec.rb
|
103
104
|
- spec/integration/entangler_spec.rb
|
@@ -146,6 +147,7 @@ test_files:
|
|
146
147
|
- spec/bootstrap.rb
|
147
148
|
- spec/fixtures/destination.ddl
|
148
149
|
- spec/fixtures/origin.ddl
|
150
|
+
- spec/fixtures/small_table.ddl
|
149
151
|
- spec/fixtures/users.ddl
|
150
152
|
- spec/integration/chunker_spec.rb
|
151
153
|
- spec/integration/entangler_spec.rb
|