dm-migrations 0.10.2 → 1.0.0.rc1
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/.gitignore +36 -0
- data/Gemfile +141 -0
- data/Rakefile +2 -3
- data/VERSION +1 -1
- data/dm-migrations.gemspec +50 -18
- data/lib/dm-migrations.rb +2 -0
- data/lib/dm-migrations/adapters/dm-do-adapter.rb +276 -0
- data/lib/dm-migrations/adapters/dm-mysql-adapter.rb +283 -0
- data/lib/dm-migrations/adapters/dm-oracle-adapter.rb +321 -0
- data/lib/dm-migrations/adapters/dm-postgres-adapter.rb +159 -0
- data/lib/dm-migrations/adapters/dm-sqlite-adapter.rb +96 -0
- data/lib/dm-migrations/adapters/dm-sqlserver-adapter.rb +177 -0
- data/lib/dm-migrations/adapters/dm-yaml-adapter.rb +23 -0
- data/lib/dm-migrations/auto_migration.rb +238 -0
- data/lib/dm-migrations/migration.rb +3 -3
- data/lib/dm-migrations/sql.rb +2 -2
- data/lib/dm-migrations/sql/mysql.rb +3 -3
- data/lib/dm-migrations/sql/{postgresql.rb → postgres.rb} +3 -3
- data/lib/dm-migrations/sql/{sqlite3.rb → sqlite.rb} +3 -3
- data/spec/integration/auto_migration_spec.rb +506 -0
- data/spec/integration/migration_runner_spec.rb +12 -2
- data/spec/integration/migration_spec.rb +28 -14
- data/spec/integration/sql_spec.rb +22 -21
- data/spec/isolated/require_after_setup_spec.rb +30 -0
- data/spec/isolated/require_before_setup_spec.rb +30 -0
- data/spec/isolated/require_spec.rb +25 -0
- data/spec/spec_helper.rb +10 -25
- data/spec/unit/migration_spec.rb +320 -319
- data/spec/unit/sql/{postgresql_spec.rb → postgres_spec.rb} +17 -17
- data/spec/unit/sql/{sqlite3_extensions_spec.rb → sqlite_extensions_spec.rb} +14 -14
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/spec.rake +0 -3
- metadata +72 -32
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
# a dummy class to include the module into
|
4
|
-
class
|
5
|
-
include SQL::
|
4
|
+
class PostgresExtension
|
5
|
+
include SQL::Postgres
|
6
6
|
end
|
7
7
|
|
8
|
-
describe "
|
8
|
+
describe "Postgres Extensions" do
|
9
9
|
before do
|
10
|
-
@pe =
|
10
|
+
@pe = PostgresExtension.new
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should support schema-level transactions' do
|
@@ -20,7 +20,7 @@ describe "SQLite3 Extensions" do
|
|
20
20
|
|
21
21
|
it 'should create a table object from the name' do
|
22
22
|
table = mock('SQLite3 Table')
|
23
|
-
SQL::
|
23
|
+
SQL::Postgres::Table.should_receive(:new).with(@pe, 'users').and_return(table)
|
24
24
|
|
25
25
|
@pe.table('users').should == table
|
26
26
|
end
|
@@ -35,27 +35,27 @@ describe "SQLite3 Extensions" do
|
|
35
35
|
@adapter = mock('adapter', :select => [])
|
36
36
|
@adapter.stub!(:query_table).with('users').and_return([@cs1, @cs2])
|
37
37
|
|
38
|
-
@col1 = mock('
|
39
|
-
@col2 = mock('
|
38
|
+
@col1 = mock('Postgres Column')
|
39
|
+
@col2 = mock('Postgres Column')
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should initialize columns by querying the table' do
|
43
|
-
SQL::
|
44
|
-
SQL::
|
43
|
+
SQL::Postgres::Column.should_receive(:new).with(@cs1).and_return(@col1)
|
44
|
+
SQL::Postgres::Column.should_receive(:new).with(@cs2).and_return(@col2)
|
45
45
|
@adapter.should_receive(:query_table).with('users').and_return([@cs1,@cs2])
|
46
|
-
SQL::
|
46
|
+
SQL::Postgres::Table.new(@adapter, 'users')
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should create SQLite3 Column objects from the returned column structs' do
|
50
|
-
SQL::
|
51
|
-
SQL::
|
52
|
-
SQL::
|
50
|
+
SQL::Postgres::Column.should_receive(:new).with(@cs1).and_return(@col1)
|
51
|
+
SQL::Postgres::Column.should_receive(:new).with(@cs2).and_return(@col2)
|
52
|
+
SQL::Postgres::Table.new(@adapter, 'users')
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should set the @columns to the looked-up columns' do
|
56
|
-
SQL::
|
57
|
-
SQL::
|
58
|
-
t = SQL::
|
56
|
+
SQL::Postgres::Column.should_receive(:new).with(@cs1).and_return(@col1)
|
57
|
+
SQL::Postgres::Column.should_receive(:new).with(@cs2).and_return(@col2)
|
58
|
+
t = SQL::Postgres::Table.new(@adapter, 'users')
|
59
59
|
t.columns.should == [@col1, @col2]
|
60
60
|
end
|
61
61
|
|
@@ -72,7 +72,7 @@ describe "SQLite3 Extensions" do
|
|
72
72
|
:data_type => 'integer',
|
73
73
|
:column_default => 123,
|
74
74
|
:is_nullable => 'NO')
|
75
|
-
@c = SQL::
|
75
|
+
@c = SQL::Postgres::Column.new(@cs)
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'should set the name from the column_name value' do
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
# a dummy class to include the module into
|
4
|
-
class
|
5
|
-
include SQL::
|
4
|
+
class SqliteExtension
|
5
|
+
include SQL::Sqlite
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "SQLite3 Extensions" do
|
9
9
|
before do
|
10
|
-
@se =
|
10
|
+
@se = SqliteExtension.new
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'should support schema-level transactions' do
|
@@ -20,7 +20,7 @@ describe "SQLite3 Extensions" do
|
|
20
20
|
|
21
21
|
it 'should create a table object from the name' do
|
22
22
|
table = mock('SQLite3 Table')
|
23
|
-
SQL::
|
23
|
+
SQL::Sqlite::Table.should_receive(:new).with(@se, 'users').and_return(table)
|
24
24
|
|
25
25
|
@se.table('users').should == table
|
26
26
|
end
|
@@ -50,22 +50,22 @@ describe "SQLite3 Extensions" do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'should initialize columns by querying the table' do
|
53
|
-
SQL::
|
54
|
-
SQL::
|
53
|
+
SQL::Sqlite::Column.should_receive(:new).with(@cs1).and_return(@col1)
|
54
|
+
SQL::Sqlite::Column.should_receive(:new).with(@cs2).and_return(@col2)
|
55
55
|
@adapter.should_receive(:table_info).with('users').and_return([@cs1,@cs2])
|
56
|
-
SQL::
|
56
|
+
SQL::Sqlite::Table.new(@adapter, 'users')
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should create SQLite3 Column objects from the returned column structs' do
|
60
|
-
SQL::
|
61
|
-
SQL::
|
62
|
-
SQL::
|
60
|
+
SQL::Sqlite::Column.should_receive(:new).with(@cs1).and_return(@col1)
|
61
|
+
SQL::Sqlite::Column.should_receive(:new).with(@cs2).and_return(@col2)
|
62
|
+
SQL::Sqlite::Table.new(@adapter, 'users')
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should set the @columns to the looked-up columns' do
|
66
|
-
SQL::
|
67
|
-
SQL::
|
68
|
-
t = SQL::
|
66
|
+
SQL::Sqlite::Column.should_receive(:new).with(@cs1).and_return(@col1)
|
67
|
+
SQL::Sqlite::Column.should_receive(:new).with(@cs2).and_return(@col2)
|
68
|
+
t = SQL::Sqlite::Table.new(@adapter, 'users')
|
69
69
|
t.columns.should == [ @col1, @col2 ]
|
70
70
|
end
|
71
71
|
|
@@ -79,7 +79,7 @@ describe "SQLite3 Extensions" do
|
|
79
79
|
:dflt_value => 123,
|
80
80
|
:pk => true,
|
81
81
|
:notnull => 0)
|
82
|
-
@c = SQL::
|
82
|
+
@c = SQL::Sqlite::Column.new(@cs)
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should set the name from the name value' do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
|
2
|
+
task :local_gemfile do |t|
|
3
|
+
|
4
|
+
root = Pathname(__FILE__).dirname.parent
|
5
|
+
datamapper = root.parent
|
6
|
+
|
7
|
+
source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
|
8
|
+
gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
|
9
|
+
|
10
|
+
root.join('Gemfile.local').open('w') do |f|
|
11
|
+
root.join('Gemfile').open.each do |line|
|
12
|
+
line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
|
13
|
+
line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
|
14
|
+
f.puts line
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/tasks/spec.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- rc1
|
10
|
+
version: 1.0.0.rc1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Paul Sadauskas
|
@@ -9,39 +15,37 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-05-19 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: dm-core
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - ~>
|
22
27
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- rc1
|
33
|
+
version: 1.0.0.rc1
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: rspec
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
40
|
requirements:
|
31
41
|
- - ~>
|
32
42
|
- !ruby/object:Gem::Version
|
33
|
-
|
34
|
-
|
35
|
-
-
|
36
|
-
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 3
|
46
|
+
version: "1.3"
|
37
47
|
type: :development
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.4.0
|
44
|
-
version:
|
48
|
+
version_requirements: *id002
|
45
49
|
description: DataMapper plugin for writing and speccing migrations
|
46
50
|
email: psadauskas [a] gmail [d] com
|
47
51
|
executables: []
|
@@ -52,6 +56,8 @@ extra_rdoc_files:
|
|
52
56
|
- LICENSE
|
53
57
|
- README.rdoc
|
54
58
|
files:
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
55
61
|
- LICENSE
|
56
62
|
- README.rdoc
|
57
63
|
- Rakefile
|
@@ -63,33 +69,46 @@ files:
|
|
63
69
|
- examples/sample_migration.rb
|
64
70
|
- examples/sample_migration_spec.rb
|
65
71
|
- lib/dm-migrations.rb
|
72
|
+
- lib/dm-migrations/adapters/dm-do-adapter.rb
|
73
|
+
- lib/dm-migrations/adapters/dm-mysql-adapter.rb
|
74
|
+
- lib/dm-migrations/adapters/dm-oracle-adapter.rb
|
75
|
+
- lib/dm-migrations/adapters/dm-postgres-adapter.rb
|
76
|
+
- lib/dm-migrations/adapters/dm-sqlite-adapter.rb
|
77
|
+
- lib/dm-migrations/adapters/dm-sqlserver-adapter.rb
|
78
|
+
- lib/dm-migrations/adapters/dm-yaml-adapter.rb
|
79
|
+
- lib/dm-migrations/auto_migration.rb
|
66
80
|
- lib/dm-migrations/migration.rb
|
67
81
|
- lib/dm-migrations/migration_runner.rb
|
68
82
|
- lib/dm-migrations/sql.rb
|
69
83
|
- lib/dm-migrations/sql/column.rb
|
70
84
|
- lib/dm-migrations/sql/mysql.rb
|
71
|
-
- lib/dm-migrations/sql/
|
72
|
-
- lib/dm-migrations/sql/
|
85
|
+
- lib/dm-migrations/sql/postgres.rb
|
86
|
+
- lib/dm-migrations/sql/sqlite.rb
|
73
87
|
- lib/dm-migrations/sql/table.rb
|
74
88
|
- lib/dm-migrations/sql/table_creator.rb
|
75
89
|
- lib/dm-migrations/sql/table_modifier.rb
|
76
90
|
- lib/spec/example/migration_example_group.rb
|
77
91
|
- lib/spec/matchers/migration_matchers.rb
|
92
|
+
- spec/integration/auto_migration_spec.rb
|
78
93
|
- spec/integration/migration_runner_spec.rb
|
79
94
|
- spec/integration/migration_spec.rb
|
80
95
|
- spec/integration/sql_spec.rb
|
96
|
+
- spec/isolated/require_after_setup_spec.rb
|
97
|
+
- spec/isolated/require_before_setup_spec.rb
|
98
|
+
- spec/isolated/require_spec.rb
|
81
99
|
- spec/rcov.opts
|
82
100
|
- spec/spec.opts
|
83
101
|
- spec/spec_helper.rb
|
84
102
|
- spec/unit/migration_spec.rb
|
85
103
|
- spec/unit/sql/column_spec.rb
|
86
|
-
- spec/unit/sql/
|
87
|
-
- spec/unit/sql/
|
104
|
+
- spec/unit/sql/postgres_spec.rb
|
105
|
+
- spec/unit/sql/sqlite_extensions_spec.rb
|
88
106
|
- spec/unit/sql/table_creator_spec.rb
|
89
107
|
- spec/unit/sql/table_modifier_spec.rb
|
90
108
|
- spec/unit/sql/table_spec.rb
|
91
109
|
- spec/unit/sql_spec.rb
|
92
110
|
- tasks/ci.rake
|
111
|
+
- tasks/local_gemfile.rake
|
93
112
|
- tasks/metrics.rake
|
94
113
|
- tasks/spec.rake
|
95
114
|
- tasks/yard.rake
|
@@ -107,20 +126,41 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
126
|
requirements:
|
108
127
|
- - ">="
|
109
128
|
- !ruby/object:Gem::Version
|
129
|
+
segments:
|
130
|
+
- 0
|
110
131
|
version: "0"
|
111
|
-
version:
|
112
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
133
|
requirements:
|
114
|
-
- - "
|
134
|
+
- - ">"
|
115
135
|
- !ruby/object:Gem::Version
|
116
|
-
|
117
|
-
|
136
|
+
segments:
|
137
|
+
- 1
|
138
|
+
- 3
|
139
|
+
- 1
|
140
|
+
version: 1.3.1
|
118
141
|
requirements: []
|
119
142
|
|
120
143
|
rubyforge_project: datamapper
|
121
|
-
rubygems_version: 1.3.
|
144
|
+
rubygems_version: 1.3.6
|
122
145
|
signing_key:
|
123
146
|
specification_version: 3
|
124
147
|
summary: DataMapper plugin for writing and speccing migrations
|
125
|
-
test_files:
|
126
|
-
|
148
|
+
test_files:
|
149
|
+
- spec/integration/auto_migration_spec.rb
|
150
|
+
- spec/integration/migration_runner_spec.rb
|
151
|
+
- spec/integration/migration_spec.rb
|
152
|
+
- spec/integration/sql_spec.rb
|
153
|
+
- spec/isolated/require_after_setup_spec.rb
|
154
|
+
- spec/isolated/require_before_setup_spec.rb
|
155
|
+
- spec/isolated/require_spec.rb
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
- spec/unit/migration_spec.rb
|
158
|
+
- spec/unit/sql/column_spec.rb
|
159
|
+
- spec/unit/sql/postgres_spec.rb
|
160
|
+
- spec/unit/sql/sqlite_extensions_spec.rb
|
161
|
+
- spec/unit/sql/table_creator_spec.rb
|
162
|
+
- spec/unit/sql/table_modifier_spec.rb
|
163
|
+
- spec/unit/sql/table_spec.rb
|
164
|
+
- spec/unit/sql_spec.rb
|
165
|
+
- examples/sample_migration.rb
|
166
|
+
- examples/sample_migration_spec.rb
|