blob: a1e10fd364d008c7972062889e7d38b0186869da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module ColumnDumper
def column_spec_for_primary_key(column)
spec = super
if schema_type(column) == :uuid
spec[:default] ||= 'nil'
end
spec
end
# Adds +:array+ option to the default set
def prepare_column_options(column)
spec = super
spec[:array] = 'true' if column.array?
spec
end
# Adds +:array+ as a valid migration key
def migration_keys
super + [:array]
end
private
def default_primary_key?(column)
schema_type(column) == :serial
end
def schema_type(column)
return super unless column.serial?
if column.bigint?
:bigserial
else
:serial
end
end
def schema_expression(column)
super unless column.serial?
end
end
end
end
end
|