ridgepole 0.6.6.beta → 0.6.6.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ridgepole.rb +2 -0
- data/lib/ridgepole/dsl_parser.rb +0 -251
- data/lib/ridgepole/dsl_parser/context.rb +121 -0
- data/lib/ridgepole/dsl_parser/table_definition.rb +132 -0
- data/lib/ridgepole/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0df6fb1b72b3ab0c234c0f8b72c216dcff83b8c8
|
4
|
+
data.tar.gz: bf7df0782ede514d34dfaa0338b208b25b70005c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc45bcdfc390d0f8fb556ca0e3fd8c3825cfea3de88acf76e5436fc96288aea717e141b97a4afd1ff61a17655b9636bf5e57aecef5f2f90cb14460e674610c64
|
7
|
+
data.tar.gz: '088b3823dcdd796f3f8b1d49b78135f37a0afe8c479552ca63ddd33983fe37c9f5697e38b85cb7024e0d7ee773e8c32bafc20a850674046c584f818f770fb4a8'
|
data/lib/ridgepole.rb
CHANGED
@@ -18,6 +18,8 @@ require 'ridgepole/default_limit'
|
|
18
18
|
require 'ridgepole/delta'
|
19
19
|
require 'ridgepole/diff'
|
20
20
|
require 'ridgepole/dsl_parser'
|
21
|
+
require 'ridgepole/dsl_parser/context'
|
22
|
+
require 'ridgepole/dsl_parser/table_definition'
|
21
23
|
require 'ridgepole/dumper'
|
22
24
|
require 'ridgepole/execute_expander'
|
23
25
|
require 'ridgepole/external_sql_executer'
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -1,255 +1,4 @@
|
|
1
1
|
class Ridgepole::DSLParser
|
2
|
-
class Context
|
3
|
-
class TableDefinition
|
4
|
-
attr_reader :__definition
|
5
|
-
|
6
|
-
def initialize(table_name, base)
|
7
|
-
@__definition = {}
|
8
|
-
@table_name = table_name
|
9
|
-
@base = base
|
10
|
-
end
|
11
|
-
|
12
|
-
def column(name, type, options = {})
|
13
|
-
name = name.to_s
|
14
|
-
|
15
|
-
@__definition[name] = {
|
16
|
-
:type => type,
|
17
|
-
:options => options,
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
TYPES = [
|
22
|
-
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
|
23
|
-
:string,
|
24
|
-
:text,
|
25
|
-
:integer,
|
26
|
-
:bigint,
|
27
|
-
:float,
|
28
|
-
:decimal,
|
29
|
-
:datetime,
|
30
|
-
:timestamp,
|
31
|
-
:time,
|
32
|
-
:date,
|
33
|
-
:binary,
|
34
|
-
:boolean,
|
35
|
-
|
36
|
-
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79
|
37
|
-
:daterange,
|
38
|
-
:numrange,
|
39
|
-
:tsrange,
|
40
|
-
:tstzrange,
|
41
|
-
:int4range,
|
42
|
-
:int8range,
|
43
|
-
:binary,
|
44
|
-
:boolean,
|
45
|
-
:bigint,
|
46
|
-
:xml,
|
47
|
-
:tsvector,
|
48
|
-
:hstore,
|
49
|
-
:inet,
|
50
|
-
:cidr,
|
51
|
-
:macaddr,
|
52
|
-
:uuid,
|
53
|
-
:json,
|
54
|
-
:jsonb,
|
55
|
-
:ltree,
|
56
|
-
:citext,
|
57
|
-
:point,
|
58
|
-
:bit,
|
59
|
-
:bit_varying,
|
60
|
-
:money,
|
61
|
-
].uniq
|
62
|
-
|
63
|
-
TYPES.each do |column_type|
|
64
|
-
define_method column_type do |*args|
|
65
|
-
options = args.extract_options!
|
66
|
-
column_names = args
|
67
|
-
column_names.each {|name| column(name, column_type, options) }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
ALIAS_TYPES = {
|
72
|
-
# https://github.com/rails/rails/blob/v5.0.0.rc1/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb
|
73
|
-
tinyblob: [:blob, {limit: 255}],
|
74
|
-
mediumblob: [:binary, {limit: 16777215}],
|
75
|
-
longblob: [:binary, {limit: 4294967295}],
|
76
|
-
tinytext: [:text, {limit: 255}],
|
77
|
-
mediumtext: [:text, {limit: 16777215}],
|
78
|
-
longtext: [:text, {limit: 4294967295}],
|
79
|
-
unsigned_integer: [:integer, {unsigned: true}],
|
80
|
-
unsigned_bigint: [:bigint, {unsigned: true}],
|
81
|
-
unsigned_float: [:float, {limit: 24, unsigned: true}],
|
82
|
-
unsigned_decimal: [:decimal, {precision: 10, unsigned: true}],
|
83
|
-
}
|
84
|
-
|
85
|
-
# XXX:
|
86
|
-
def blob(*args)
|
87
|
-
options = args.extract_options!
|
88
|
-
options = {limit: 65535}.merge(options)
|
89
|
-
column_names = args
|
90
|
-
|
91
|
-
column_names.each do |name|
|
92
|
-
column_type = (0..0xff).include?(options[:limit]) ? :blob : :binary
|
93
|
-
column(name, column_type, options)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
ALIAS_TYPES.each do |alias_type, (column_type, default_options)|
|
98
|
-
define_method alias_type do |*args|
|
99
|
-
options = args.extract_options!
|
100
|
-
options = default_options.merge(options)
|
101
|
-
column_names = args
|
102
|
-
column_names.each {|name| column(name, column_type, options) }
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def index(name, options = {})
|
107
|
-
@base.add_index(@table_name, name, options)
|
108
|
-
end
|
109
|
-
|
110
|
-
def timestamps(*args)
|
111
|
-
options = {:null => false}.merge(args.extract_options!)
|
112
|
-
column(:created_at, :datetime, options)
|
113
|
-
column(:updated_at, :datetime, options)
|
114
|
-
end
|
115
|
-
|
116
|
-
def references(*args)
|
117
|
-
options = args.extract_options!
|
118
|
-
polymorphic = options.delete(:polymorphic)
|
119
|
-
index_options = options.delete(:index)
|
120
|
-
type = options.delete(:type) || :integer
|
121
|
-
|
122
|
-
args.each do |col|
|
123
|
-
column("#{col}_id", type, options)
|
124
|
-
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) if polymorphic
|
125
|
-
if index_options
|
126
|
-
index("#{col}_id", index_options.is_a?(Hash) ? index_options : {})
|
127
|
-
index("#{col}_type", index_options.is_a?(Hash) ? index_options : {}) if polymorphic
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
alias :belongs_to :references
|
132
|
-
end
|
133
|
-
|
134
|
-
attr_reader :__definition
|
135
|
-
attr_reader :__execute
|
136
|
-
|
137
|
-
def initialize(opts = {})
|
138
|
-
@__working_dir = File.expand_path(opts[:path] ? File.dirname(opts[:path]) : Dir.pwd)
|
139
|
-
@__definition = {}
|
140
|
-
@__execute = []
|
141
|
-
end
|
142
|
-
|
143
|
-
def self.eval(dsl, opts = {})
|
144
|
-
ctx = self.new(opts)
|
145
|
-
|
146
|
-
if opts[:path]
|
147
|
-
ctx.instance_eval(dsl, opts[:path])
|
148
|
-
else
|
149
|
-
ctx.instance_eval(dsl)
|
150
|
-
end
|
151
|
-
|
152
|
-
[ctx.__definition, ctx.__execute]
|
153
|
-
end
|
154
|
-
|
155
|
-
def create_table(table_name, options = {})
|
156
|
-
table_name = table_name.to_s
|
157
|
-
table_definition = TableDefinition.new(table_name, self)
|
158
|
-
|
159
|
-
if options[:primary_key] and options[:primary_key].is_a?(Symbol)
|
160
|
-
options[:primary_key] = options[:primary_key].to_s
|
161
|
-
end
|
162
|
-
|
163
|
-
yield(table_definition)
|
164
|
-
@__definition[table_name] ||= {}
|
165
|
-
|
166
|
-
if @__definition[table_name][:definition]
|
167
|
-
raise "Table `#{table_name}` already defined"
|
168
|
-
end
|
169
|
-
|
170
|
-
@__definition[table_name][:definition] = table_definition.__definition
|
171
|
-
options.delete(:force)
|
172
|
-
@__definition[table_name][:options] = options
|
173
|
-
end
|
174
|
-
|
175
|
-
def add_index(table_name, column_name, options = {})
|
176
|
-
table_name = table_name.to_s
|
177
|
-
# Keep column_name for expression index support
|
178
|
-
# https://github.com/rails/rails/pull/23393
|
179
|
-
unless column_name.is_a?(String) && /\W/ === column_name
|
180
|
-
column_name = [column_name].flatten.map {|i| i.to_s }
|
181
|
-
end
|
182
|
-
options[:name] = options[:name].to_s if options[:name]
|
183
|
-
@__definition[table_name] ||= {}
|
184
|
-
@__definition[table_name][:indices] ||= {}
|
185
|
-
idx = options[:name] || column_name
|
186
|
-
|
187
|
-
if @__definition[table_name][:indices][idx]
|
188
|
-
raise "Index `#{table_name}(#{idx})` already defined"
|
189
|
-
end
|
190
|
-
|
191
|
-
if options[:length].is_a?(Numeric)
|
192
|
-
index_length = options[:length]
|
193
|
-
options[:length] = {}
|
194
|
-
|
195
|
-
column_name.each do |col|
|
196
|
-
options[:length][col] = index_length
|
197
|
-
end
|
198
|
-
|
199
|
-
# XXX: fix for https://github.com/rails/rails/commit/5025fd3a99c68f95bdd6fd43f382c62e9653236b
|
200
|
-
if ActiveRecord::VERSION::MAJOR >= 6 or (ActiveRecord::VERSION::MAJOR == 5 and (ActiveRecord::VERSION::MINOR >= 1 or ActiveRecord::VERSION::TINY >= 1))
|
201
|
-
options[:length] = options[:length].symbolize_keys
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
@__definition[table_name][:indices][idx] = {
|
206
|
-
:column_name => column_name,
|
207
|
-
:options => options,
|
208
|
-
}
|
209
|
-
end
|
210
|
-
|
211
|
-
def add_foreign_key(from_table, to_table, options = {})
|
212
|
-
unless options[:name]
|
213
|
-
raise "Foreign key name in `#{from_table}` is undefined"
|
214
|
-
end
|
215
|
-
|
216
|
-
from_table = from_table.to_s
|
217
|
-
to_table = to_table.to_s
|
218
|
-
options[:name] = options[:name].to_s
|
219
|
-
@__definition[from_table] ||= {}
|
220
|
-
@__definition[from_table][:foreign_keys] ||= {}
|
221
|
-
idx = options[:name]
|
222
|
-
|
223
|
-
if @__definition[from_table][:foreign_keys][idx]
|
224
|
-
raise "Foreign Key `#{from_table}(#{idx})` already defined"
|
225
|
-
end
|
226
|
-
|
227
|
-
@__definition[from_table][:foreign_keys][idx] = {
|
228
|
-
:to_table => to_table,
|
229
|
-
:options => options,
|
230
|
-
}
|
231
|
-
end
|
232
|
-
|
233
|
-
def require(file)
|
234
|
-
schemafile = (file =~ %r|\A/|) ? file : File.join(@__working_dir, file)
|
235
|
-
|
236
|
-
if File.exist?(schemafile)
|
237
|
-
instance_eval(File.read(schemafile), schemafile)
|
238
|
-
elsif File.exist?(schemafile + '.rb')
|
239
|
-
instance_eval(File.read(schemafile + '.rb'), schemafile + '.rb')
|
240
|
-
else
|
241
|
-
Kernel.require(file)
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
def execute(sql, name = nil, &cond)
|
246
|
-
@__execute << {
|
247
|
-
:sql => sql,
|
248
|
-
:condition => cond,
|
249
|
-
}
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
2
|
def initialize(options = {})
|
254
3
|
@options = options
|
255
4
|
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
class Ridgepole::DSLParser
|
2
|
+
class Context
|
3
|
+
attr_reader :__definition
|
4
|
+
attr_reader :__execute
|
5
|
+
|
6
|
+
def initialize(opts = {})
|
7
|
+
@__working_dir = File.expand_path(opts[:path] ? File.dirname(opts[:path]) : Dir.pwd)
|
8
|
+
@__definition = {}
|
9
|
+
@__execute = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.eval(dsl, opts = {})
|
13
|
+
ctx = self.new(opts)
|
14
|
+
|
15
|
+
if opts[:path]
|
16
|
+
ctx.instance_eval(dsl, opts[:path])
|
17
|
+
else
|
18
|
+
ctx.instance_eval(dsl)
|
19
|
+
end
|
20
|
+
|
21
|
+
[ctx.__definition, ctx.__execute]
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_table(table_name, options = {})
|
25
|
+
table_name = table_name.to_s
|
26
|
+
table_definition = TableDefinition.new(table_name, self)
|
27
|
+
|
28
|
+
if options[:primary_key] and options[:primary_key].is_a?(Symbol)
|
29
|
+
options[:primary_key] = options[:primary_key].to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
yield(table_definition)
|
33
|
+
@__definition[table_name] ||= {}
|
34
|
+
|
35
|
+
if @__definition[table_name][:definition]
|
36
|
+
raise "Table `#{table_name}` already defined"
|
37
|
+
end
|
38
|
+
|
39
|
+
@__definition[table_name][:definition] = table_definition.__definition
|
40
|
+
options.delete(:force)
|
41
|
+
@__definition[table_name][:options] = options
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_index(table_name, column_name, options = {})
|
45
|
+
table_name = table_name.to_s
|
46
|
+
# Keep column_name for expression index support
|
47
|
+
# https://github.com/rails/rails/pull/23393
|
48
|
+
unless column_name.is_a?(String) && /\W/ === column_name
|
49
|
+
column_name = [column_name].flatten.map {|i| i.to_s }
|
50
|
+
end
|
51
|
+
options[:name] = options[:name].to_s if options[:name]
|
52
|
+
@__definition[table_name] ||= {}
|
53
|
+
@__definition[table_name][:indices] ||= {}
|
54
|
+
idx = options[:name] || column_name
|
55
|
+
|
56
|
+
if @__definition[table_name][:indices][idx]
|
57
|
+
raise "Index `#{table_name}(#{idx})` already defined"
|
58
|
+
end
|
59
|
+
|
60
|
+
if options[:length].is_a?(Numeric)
|
61
|
+
index_length = options[:length]
|
62
|
+
options[:length] = {}
|
63
|
+
|
64
|
+
column_name.each do |col|
|
65
|
+
options[:length][col] = index_length
|
66
|
+
end
|
67
|
+
|
68
|
+
# XXX: fix for https://github.com/rails/rails/commit/5025fd3a99c68f95bdd6fd43f382c62e9653236b
|
69
|
+
if ActiveRecord::VERSION::MAJOR >= 6 or (ActiveRecord::VERSION::MAJOR == 5 and (ActiveRecord::VERSION::MINOR >= 1 or ActiveRecord::VERSION::TINY >= 1))
|
70
|
+
options[:length] = options[:length].symbolize_keys
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
@__definition[table_name][:indices][idx] = {
|
75
|
+
:column_name => column_name,
|
76
|
+
:options => options,
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
def add_foreign_key(from_table, to_table, options = {})
|
81
|
+
unless options[:name]
|
82
|
+
raise "Foreign key name in `#{from_table}` is undefined"
|
83
|
+
end
|
84
|
+
|
85
|
+
from_table = from_table.to_s
|
86
|
+
to_table = to_table.to_s
|
87
|
+
options[:name] = options[:name].to_s
|
88
|
+
@__definition[from_table] ||= {}
|
89
|
+
@__definition[from_table][:foreign_keys] ||= {}
|
90
|
+
idx = options[:name]
|
91
|
+
|
92
|
+
if @__definition[from_table][:foreign_keys][idx]
|
93
|
+
raise "Foreign Key `#{from_table}(#{idx})` already defined"
|
94
|
+
end
|
95
|
+
|
96
|
+
@__definition[from_table][:foreign_keys][idx] = {
|
97
|
+
:to_table => to_table,
|
98
|
+
:options => options,
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
def require(file)
|
103
|
+
schemafile = (file =~ %r|\A/|) ? file : File.join(@__working_dir, file)
|
104
|
+
|
105
|
+
if File.exist?(schemafile)
|
106
|
+
instance_eval(File.read(schemafile), schemafile)
|
107
|
+
elsif File.exist?(schemafile + '.rb')
|
108
|
+
instance_eval(File.read(schemafile + '.rb'), schemafile + '.rb')
|
109
|
+
else
|
110
|
+
Kernel.require(file)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def execute(sql, name = nil, &cond)
|
115
|
+
@__execute << {
|
116
|
+
:sql => sql,
|
117
|
+
:condition => cond,
|
118
|
+
}
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
class Ridgepole::DSLParser
|
2
|
+
class TableDefinition
|
3
|
+
attr_reader :__definition
|
4
|
+
|
5
|
+
def initialize(table_name, base)
|
6
|
+
@__definition = {}
|
7
|
+
@table_name = table_name
|
8
|
+
@base = base
|
9
|
+
end
|
10
|
+
|
11
|
+
def column(name, type, options = {})
|
12
|
+
name = name.to_s
|
13
|
+
|
14
|
+
@__definition[name] = {
|
15
|
+
:type => type,
|
16
|
+
:options => options,
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
TYPES = [
|
21
|
+
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
|
22
|
+
:string,
|
23
|
+
:text,
|
24
|
+
:integer,
|
25
|
+
:bigint,
|
26
|
+
:float,
|
27
|
+
:decimal,
|
28
|
+
:datetime,
|
29
|
+
:timestamp,
|
30
|
+
:time,
|
31
|
+
:date,
|
32
|
+
:binary,
|
33
|
+
:boolean,
|
34
|
+
|
35
|
+
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79
|
36
|
+
:daterange,
|
37
|
+
:numrange,
|
38
|
+
:tsrange,
|
39
|
+
:tstzrange,
|
40
|
+
:int4range,
|
41
|
+
:int8range,
|
42
|
+
:binary,
|
43
|
+
:boolean,
|
44
|
+
:bigint,
|
45
|
+
:xml,
|
46
|
+
:tsvector,
|
47
|
+
:hstore,
|
48
|
+
:inet,
|
49
|
+
:cidr,
|
50
|
+
:macaddr,
|
51
|
+
:uuid,
|
52
|
+
:json,
|
53
|
+
:jsonb,
|
54
|
+
:ltree,
|
55
|
+
:citext,
|
56
|
+
:point,
|
57
|
+
:bit,
|
58
|
+
:bit_varying,
|
59
|
+
:money,
|
60
|
+
].uniq
|
61
|
+
|
62
|
+
TYPES.each do |column_type|
|
63
|
+
define_method column_type do |*args|
|
64
|
+
options = args.extract_options!
|
65
|
+
column_names = args
|
66
|
+
column_names.each {|name| column(name, column_type, options) }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
ALIAS_TYPES = {
|
71
|
+
# https://github.com/rails/rails/blob/v5.0.0.rc1/activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb
|
72
|
+
tinyblob: [:blob, {limit: 255}],
|
73
|
+
mediumblob: [:binary, {limit: 16777215}],
|
74
|
+
longblob: [:binary, {limit: 4294967295}],
|
75
|
+
tinytext: [:text, {limit: 255}],
|
76
|
+
mediumtext: [:text, {limit: 16777215}],
|
77
|
+
longtext: [:text, {limit: 4294967295}],
|
78
|
+
unsigned_integer: [:integer, {unsigned: true}],
|
79
|
+
unsigned_bigint: [:bigint, {unsigned: true}],
|
80
|
+
unsigned_float: [:float, {limit: 24, unsigned: true}],
|
81
|
+
unsigned_decimal: [:decimal, {precision: 10, unsigned: true}],
|
82
|
+
}
|
83
|
+
|
84
|
+
# XXX:
|
85
|
+
def blob(*args)
|
86
|
+
options = args.extract_options!
|
87
|
+
options = {limit: 65535}.merge(options)
|
88
|
+
column_names = args
|
89
|
+
|
90
|
+
column_names.each do |name|
|
91
|
+
column_type = (0..0xff).include?(options[:limit]) ? :blob : :binary
|
92
|
+
column(name, column_type, options)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
ALIAS_TYPES.each do |alias_type, (column_type, default_options)|
|
97
|
+
define_method alias_type do |*args|
|
98
|
+
options = args.extract_options!
|
99
|
+
options = default_options.merge(options)
|
100
|
+
column_names = args
|
101
|
+
column_names.each {|name| column(name, column_type, options) }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def index(name, options = {})
|
106
|
+
@base.add_index(@table_name, name, options)
|
107
|
+
end
|
108
|
+
|
109
|
+
def timestamps(*args)
|
110
|
+
options = {:null => false}.merge(args.extract_options!)
|
111
|
+
column(:created_at, :datetime, options)
|
112
|
+
column(:updated_at, :datetime, options)
|
113
|
+
end
|
114
|
+
|
115
|
+
def references(*args)
|
116
|
+
options = args.extract_options!
|
117
|
+
polymorphic = options.delete(:polymorphic)
|
118
|
+
index_options = options.delete(:index)
|
119
|
+
type = options.delete(:type) || :integer
|
120
|
+
|
121
|
+
args.each do |col|
|
122
|
+
column("#{col}_id", type, options)
|
123
|
+
column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) if polymorphic
|
124
|
+
if index_options
|
125
|
+
index("#{col}_id", index_options.is_a?(Hash) ? index_options : {})
|
126
|
+
index("#{col}_type", index_options.is_a?(Hash) ? index_options : {}) if polymorphic
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
alias :belongs_to :references
|
131
|
+
end
|
132
|
+
end
|
data/lib/ridgepole/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.6.
|
4
|
+
version: 0.6.6.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -226,6 +226,8 @@ files:
|
|
226
226
|
- lib/ridgepole/delta.rb
|
227
227
|
- lib/ridgepole/diff.rb
|
228
228
|
- lib/ridgepole/dsl_parser.rb
|
229
|
+
- lib/ridgepole/dsl_parser/context.rb
|
230
|
+
- lib/ridgepole/dsl_parser/table_definition.rb
|
229
231
|
- lib/ridgepole/dumper.rb
|
230
232
|
- lib/ridgepole/execute_expander.rb
|
231
233
|
- lib/ridgepole/ext/abstract_mysql_adapter/disable_table_options.rb
|