paraphraser 0.1.10 → 0.2.0
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/VERSION +1 -1
- data/lib/paraphraser/convertor.rb +26 -13
- data/lib/paraphraser/railties/paraphraser.rake +0 -1
- data/paraphraser.gemspec +2 -2
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -11,7 +11,10 @@ module Paraphraser
|
|
11
11
|
|
12
12
|
def convert
|
13
13
|
with_activerecord_stubbed do
|
14
|
-
migrations.each
|
14
|
+
migrations.each do |migration|
|
15
|
+
announce "#{migration.version} : #{migration.name}"
|
16
|
+
migration.migrate(direction)
|
17
|
+
end
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
@@ -26,26 +29,36 @@ module Paraphraser
|
|
26
29
|
end
|
27
30
|
|
28
31
|
def with_activerecord_stubbed(&block)
|
29
|
-
|
32
|
+
ActiveRecord::Migration.verbose = false
|
33
|
+
apply_overrides
|
30
34
|
yield
|
31
|
-
reset_stubs
|
32
35
|
end
|
33
36
|
|
34
|
-
def
|
35
|
-
connection.class.send(:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
def apply_overrides
|
38
|
+
connection.class.send(:define_method, :execute) do |sql, name = nil, skip_logging = false|
|
39
|
+
print "#{sql};\n"
|
40
|
+
STDOUT.flush
|
41
|
+
end
|
42
|
+
connection.class.send(:define_method, :initialize_schema_migrations_table) { }
|
43
|
+
connection.class.send(:define_method, :tables) { |*args| [] }
|
44
|
+
connection.class.send(:define_method, :index_name_exists?) {|*args| false }
|
45
|
+
connection.class.send(:define_method, :rename_column) do |table_name, column_name, new_column_name|
|
46
|
+
execute "ALTER TABLE #{quote_table_name(table_name)} RENAME COLUMN #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}"
|
47
|
+
end
|
48
|
+
connection.class.send(:define_method, :change_column) do |table_name, column_name, type, options = {}|
|
49
|
+
execute "ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
|
50
|
+
end
|
51
|
+
connection.class.send(:define_method, :change_column_default) do |table_name, column_name, default|
|
52
|
+
execute "ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} SET DEFAULT #{quote(default)}"
|
40
53
|
end
|
41
54
|
end
|
42
55
|
|
43
|
-
def
|
44
|
-
|
56
|
+
def announce(text)
|
57
|
+
length = [0, 90 - text.length].max
|
58
|
+
print "\n-- %s %s\n" % [text, "-" * length]
|
45
59
|
end
|
46
|
-
|
60
|
+
|
47
61
|
end
|
48
62
|
|
49
63
|
end
|
50
64
|
end
|
51
|
-
|
data/paraphraser.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{paraphraser}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Vinay Patel"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-30}
|
13
13
|
s.description = %q{provides a rake task to convert migrations to sql statements for *the dba*.}
|
14
14
|
s.email = %q{mail@vinayvinay.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Vinay Patel
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-30 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
hash:
|
88
|
+
hash: 498993587
|
89
89
|
segments:
|
90
90
|
- 0
|
91
91
|
version: "0"
|