sequel_migration_builder 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sequel/migration_builder.rb +5 -1
- data/spec/migration_builder_spec.rb +17 -0
- metadata +3 -4
- data/sequel_migration_builder.gemspec +0 -67
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -102,7 +102,7 @@ module Sequel
|
|
102
102
|
# Generates an individual create_table statement.
|
103
103
|
#
|
104
104
|
def create_table_statement(table_name, table)
|
105
|
-
add_line "create_table #{table_name.inspect} do"
|
105
|
+
add_line "create_table #{table_name.inspect}#{options_str(table)} do"
|
106
106
|
indent do
|
107
107
|
table[:columns].map {|c| Schema::DbColumn.build_from_hash(c) }.each do |column|
|
108
108
|
add_line column.define_statement
|
@@ -119,6 +119,10 @@ module Sequel
|
|
119
119
|
|
120
120
|
attr_reader :result
|
121
121
|
|
122
|
+
def options_str(table)
|
123
|
+
", " + table[:table_options].inspect.gsub(/^\{|\}$/,'').gsub("=>", " => ") if table[:table_options]
|
124
|
+
end
|
125
|
+
|
122
126
|
def table_names(tables)
|
123
127
|
tables.keys.map {|n| n.to_s }.sort.map {|n| n.to_sym }
|
124
128
|
end
|
@@ -89,6 +89,23 @@ END
|
|
89
89
|
should == expected.strip
|
90
90
|
end
|
91
91
|
|
92
|
+
it "should add the table options do the create_table statement" do
|
93
|
+
mock_db = mock(:database)
|
94
|
+
mock_db.should_receive(:tables).at_least(:once).and_return([])
|
95
|
+
table = {
|
96
|
+
:table_options => {:engine => "myisam"},
|
97
|
+
:columns => [{:name => :foo, :column_type => :integer}]
|
98
|
+
}
|
99
|
+
|
100
|
+
expected = <<-END
|
101
|
+
create_table :example_table, :engine => "myisam" do
|
102
|
+
integer :foo, :null => false
|
103
|
+
end
|
104
|
+
END
|
105
|
+
|
106
|
+
Sequel::MigrationBuilder.new(mock_db).create_table_statement(:example_table, table).join("\n").
|
107
|
+
should == expected.strip
|
108
|
+
end
|
92
109
|
|
93
110
|
context "when a table needs to be altered" do
|
94
111
|
before :each do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Roland Swingler
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-15 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -65,7 +65,6 @@ files:
|
|
65
65
|
- lib/sequel/schema/alter_table_operations.rb
|
66
66
|
- lib/sequel/schema/db_column.rb
|
67
67
|
- lib/sequel/schema/db_schema_parser.rb
|
68
|
-
- sequel_migration_builder.gemspec
|
69
68
|
- spec/alter_table_operations_spec.rb
|
70
69
|
- spec/db_column_spec.rb
|
71
70
|
- spec/db_schema_parser_spec.rb
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{sequel_migration_builder}
|
8
|
-
s.version = "0.0.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Roland Swingler"]
|
12
|
-
s.date = %q{2010-06-13}
|
13
|
-
s.description = %q{Build Sequel Migrations based on the differences between two schemas}
|
14
|
-
s.email = %q{roland.swingler@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/sequel/migration_builder.rb",
|
27
|
-
"lib/sequel/schema/alter_table_operations.rb",
|
28
|
-
"lib/sequel/schema/db_column.rb",
|
29
|
-
"lib/sequel/schema/db_schema_parser.rb",
|
30
|
-
"sequel_migration_builder.gemspec",
|
31
|
-
"spec/alter_table_operations_spec.rb",
|
32
|
-
"spec/db_column_spec.rb",
|
33
|
-
"spec/db_schema_parser_spec.rb",
|
34
|
-
"spec/migration_builder_spec.rb",
|
35
|
-
"spec/spec.opts",
|
36
|
-
"spec/spec_helper.rb"
|
37
|
-
]
|
38
|
-
s.homepage = %q{http://github.com/knaveofdiamonds/sequel_migration_builder}
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
40
|
-
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.3.6}
|
42
|
-
s.summary = %q{Build Sequel Migrations based on the differences between two schemas}
|
43
|
-
s.test_files = [
|
44
|
-
"spec/alter_table_operations_spec.rb",
|
45
|
-
"spec/db_column_spec.rb",
|
46
|
-
"spec/db_schema_parser_spec.rb",
|
47
|
-
"spec/migration_builder_spec.rb",
|
48
|
-
"spec/spec_helper.rb"
|
49
|
-
]
|
50
|
-
|
51
|
-
if s.respond_to? :specification_version then
|
52
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
|
-
s.specification_version = 3
|
54
|
-
|
55
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<sequel>, [">= 3.12.0"])
|
57
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
-
else
|
59
|
-
s.add_dependency(%q<sequel>, [">= 3.12.0"])
|
60
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
61
|
-
end
|
62
|
-
else
|
63
|
-
s.add_dependency(%q<sequel>, [">= 3.12.0"])
|
64
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|