ovirt_metrics 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/connection_adapters/ovirt_postgresql_adapter.rb +30 -0
- data/lib/ovirt_metrics.rb +4 -1
- data/lib/ovirt_metrics/version.rb +1 -1
- metadata +3 -35
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/column.rb +0 -15
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/database_statements.rb +0 -170
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/explain_pretty_printer.rb +0 -42
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid.rb +0 -31
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/array.rb +0 -70
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/bit.rb +0 -52
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/bit_varying.rb +0 -13
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/bytea.rb +0 -15
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/cidr.rb +0 -48
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/date_time.rb +0 -21
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/decimal.rb +0 -13
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/enum.rb +0 -19
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/hstore.rb +0 -59
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/inet.rb +0 -13
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/json.rb +0 -10
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/jsonb.rb +0 -23
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/money.rb +0 -39
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/point.rb +0 -43
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/rails_5_1_point.rb +0 -50
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/range.rb +0 -93
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/specialized_string.rb +0 -15
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/type_map_initializer.rb +0 -109
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/uuid.rb +0 -21
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/vector.rb +0 -26
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/xml.rb +0 -28
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/quoting.rb +0 -116
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/referential_integrity.rb +0 -49
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/schema_definitions.rb +0 -180
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/schema_dumper.rb +0 -47
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/schema_statements.rb +0 -682
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/type_metadata.rb +0 -35
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/utils.rb +0 -77
- data/lib/active_record/connection_adapters/ovirt_legacy_postgresql_adapter.rb +0 -856
data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/specialized_string.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module OID # :nodoc:
|
5
|
-
class SpecializedString < Type::String # :nodoc:
|
6
|
-
attr_reader :type
|
7
|
-
|
8
|
-
def initialize(type)
|
9
|
-
@type = type
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/active_record/connection_adapters/ovirt_legacy_postgresql/oid/type_map_initializer.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module OID # :nodoc:
|
5
|
-
# This class uses the data from PostgreSQL pg_type table to build
|
6
|
-
# the OID -> Type mapping.
|
7
|
-
# - OID is an integer representing the type.
|
8
|
-
# - Type is an OID::Type object.
|
9
|
-
# This class has side effects on the +store+ passed during initialization.
|
10
|
-
class TypeMapInitializer # :nodoc:
|
11
|
-
def initialize(store)
|
12
|
-
@store = store
|
13
|
-
end
|
14
|
-
|
15
|
-
def run(records)
|
16
|
-
nodes = records.reject { |row| @store.key? row['oid'].to_i }
|
17
|
-
mapped, nodes = nodes.partition { |row| @store.key? row['typname'] }
|
18
|
-
ranges, nodes = nodes.partition { |row| row['typtype'] == 'r'.freeze }
|
19
|
-
enums, nodes = nodes.partition { |row| row['typtype'] == 'e'.freeze }
|
20
|
-
domains, nodes = nodes.partition { |row| row['typtype'] == 'd'.freeze }
|
21
|
-
arrays, nodes = nodes.partition { |row| row['typinput'] == 'array_in'.freeze }
|
22
|
-
composites, nodes = nodes.partition { |row| row['typelem'].to_i != 0 }
|
23
|
-
|
24
|
-
mapped.each { |row| register_mapped_type(row) }
|
25
|
-
enums.each { |row| register_enum_type(row) }
|
26
|
-
domains.each { |row| register_domain_type(row) }
|
27
|
-
arrays.each { |row| register_array_type(row) }
|
28
|
-
ranges.each { |row| register_range_type(row) }
|
29
|
-
composites.each { |row| register_composite_type(row) }
|
30
|
-
end
|
31
|
-
|
32
|
-
def query_conditions_for_initial_load(type_map)
|
33
|
-
known_type_names = type_map.keys.map { |n| "'#{n}'" }
|
34
|
-
known_type_types = %w('r' 'e' 'd')
|
35
|
-
<<-SQL % [known_type_names.join(", "), known_type_types.join(", ")]
|
36
|
-
WHERE
|
37
|
-
t.typname IN (%s)
|
38
|
-
OR t.typtype IN (%s)
|
39
|
-
OR t.typinput = 'array_in(cstring,oid,integer)'::regprocedure
|
40
|
-
OR t.typelem != 0
|
41
|
-
SQL
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
def register_mapped_type(row)
|
46
|
-
alias_type row['oid'], row['typname']
|
47
|
-
end
|
48
|
-
|
49
|
-
def register_enum_type(row)
|
50
|
-
register row['oid'], OID::Enum.new
|
51
|
-
end
|
52
|
-
|
53
|
-
def register_array_type(row)
|
54
|
-
register_with_subtype(row['oid'], row['typelem'].to_i) do |subtype|
|
55
|
-
OID::Array.new(subtype, row['typdelim'])
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def register_range_type(row)
|
60
|
-
register_with_subtype(row['oid'], row['rngsubtype'].to_i) do |subtype|
|
61
|
-
OID::Range.new(subtype, row['typname'].to_sym)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def register_domain_type(row)
|
66
|
-
if base_type = @store.lookup(row["typbasetype"].to_i)
|
67
|
-
register row['oid'], base_type
|
68
|
-
else
|
69
|
-
warn "unknown base type (OID: #{row["typbasetype"]}) for domain #{row["typname"]}."
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def register_composite_type(row)
|
74
|
-
if subtype = @store.lookup(row['typelem'].to_i)
|
75
|
-
register row['oid'], OID::Vector.new(row['typdelim'], subtype)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def register(oid, oid_type = nil, &block)
|
80
|
-
oid = assert_valid_registration(oid, oid_type || block)
|
81
|
-
if block_given?
|
82
|
-
@store.register_type(oid, &block)
|
83
|
-
else
|
84
|
-
@store.register_type(oid, oid_type)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def alias_type(oid, target)
|
89
|
-
oid = assert_valid_registration(oid, target)
|
90
|
-
@store.alias_type(oid, target)
|
91
|
-
end
|
92
|
-
|
93
|
-
def register_with_subtype(oid, target_oid)
|
94
|
-
if @store.key?(target_oid)
|
95
|
-
register(oid) do |_, *args|
|
96
|
-
yield @store.lookup(target_oid, *args)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def assert_valid_registration(oid, oid_type)
|
102
|
-
raise ArgumentError, "can't register nil type for OID #{oid}" if oid_type.nil?
|
103
|
-
oid.to_i
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module OID # :nodoc:
|
5
|
-
class Uuid < Type::Value # :nodoc:
|
6
|
-
ACCEPTABLE_UUID = %r{\A\{?([a-fA-F0-9]{4}-?){8}\}?\z}x
|
7
|
-
|
8
|
-
alias_method :serialize, :deserialize
|
9
|
-
|
10
|
-
def type
|
11
|
-
:uuid
|
12
|
-
end
|
13
|
-
|
14
|
-
def cast(value)
|
15
|
-
value.to_s[ACCEPTABLE_UUID, 0]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module OID # :nodoc:
|
5
|
-
class Vector < Type::Value # :nodoc:
|
6
|
-
attr_reader :delim, :subtype
|
7
|
-
|
8
|
-
# +delim+ corresponds to the `typdelim` column in the pg_types
|
9
|
-
# table. +subtype+ is derived from the `typelem` column in the
|
10
|
-
# pg_types table.
|
11
|
-
def initialize(delim, subtype)
|
12
|
-
@delim = delim
|
13
|
-
@subtype = subtype
|
14
|
-
end
|
15
|
-
|
16
|
-
# FIXME: this should probably split on +delim+ and use +subtype+
|
17
|
-
# to cast the values. Unfortunately, the current Rails behavior
|
18
|
-
# is to just return the string.
|
19
|
-
def cast(value)
|
20
|
-
value
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module OID # :nodoc:
|
5
|
-
class Xml < Type::String # :nodoc:
|
6
|
-
def type
|
7
|
-
:xml
|
8
|
-
end
|
9
|
-
|
10
|
-
def serialize(value)
|
11
|
-
return unless value
|
12
|
-
Data.new(super)
|
13
|
-
end
|
14
|
-
|
15
|
-
class Data # :nodoc:
|
16
|
-
def initialize(value)
|
17
|
-
@value = value
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_s
|
21
|
-
@value
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,116 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module Quoting
|
5
|
-
# Escapes binary strings for bytea input to the database.
|
6
|
-
def escape_bytea(value)
|
7
|
-
@connection.escape_bytea(value) if value
|
8
|
-
end
|
9
|
-
|
10
|
-
# Unescapes bytea output from a database to the binary string it represents.
|
11
|
-
# NOTE: This is NOT an inverse of escape_bytea! This is only to be used
|
12
|
-
# on escaped binary output from database drive.
|
13
|
-
def unescape_bytea(value)
|
14
|
-
@connection.unescape_bytea(value) if value
|
15
|
-
end
|
16
|
-
|
17
|
-
# Quotes strings for use in SQL input.
|
18
|
-
def quote_string(s) #:nodoc:
|
19
|
-
@connection.escape(s)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Checks the following cases:
|
23
|
-
#
|
24
|
-
# - table_name
|
25
|
-
# - "table.name"
|
26
|
-
# - schema_name.table_name
|
27
|
-
# - schema_name."table.name"
|
28
|
-
# - "schema.name".table_name
|
29
|
-
# - "schema.name"."table.name"
|
30
|
-
def quote_table_name(name) # :nodoc:
|
31
|
-
@quoted_table_names[name] ||= Utils.extract_schema_qualified_name(name.to_s).quoted
|
32
|
-
end
|
33
|
-
|
34
|
-
# Quotes schema names for use in SQL queries.
|
35
|
-
def quote_schema_name(name)
|
36
|
-
PGconn.quote_ident(name)
|
37
|
-
end
|
38
|
-
|
39
|
-
def quote_table_name_for_assignment(table, attr)
|
40
|
-
quote_column_name(attr)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Quotes column names for use in SQL queries.
|
44
|
-
def quote_column_name(name) # :nodoc:
|
45
|
-
@quoted_column_names[name] ||= PGconn.quote_ident(super)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Quote date/time values for use in SQL input.
|
49
|
-
def quoted_date(value) #:nodoc:
|
50
|
-
if value.year <= 0
|
51
|
-
bce_year = format("%04d", -value.year + 1)
|
52
|
-
super.sub(/^-?\d+/, bce_year) + " BC"
|
53
|
-
else
|
54
|
-
super
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def quote_default_expression(value, column) # :nodoc:
|
59
|
-
if value.is_a?(Proc)
|
60
|
-
value.call
|
61
|
-
elsif column.type == :uuid && value =~ /\(\)/
|
62
|
-
value # Does not quote function default values for UUID columns
|
63
|
-
elsif column.respond_to?(:array?)
|
64
|
-
value = type_cast_from_column(column, value)
|
65
|
-
quote(value)
|
66
|
-
else
|
67
|
-
super
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def lookup_cast_type_from_column(column) # :nodoc:
|
72
|
-
type_map.lookup(column.oid, column.fmod, column.sql_type)
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def _quote(value)
|
78
|
-
case value
|
79
|
-
when Type::Binary::Data
|
80
|
-
"'#{escape_bytea(value.to_s)}'"
|
81
|
-
when OID::Xml::Data
|
82
|
-
"xml '#{quote_string(value.to_s)}'"
|
83
|
-
when OID::Bit::Data
|
84
|
-
if value.binary?
|
85
|
-
"B'#{value}'"
|
86
|
-
elsif value.hex?
|
87
|
-
"X'#{value}'"
|
88
|
-
end
|
89
|
-
when Float
|
90
|
-
if value.infinite? || value.nan?
|
91
|
-
"'#{value}'"
|
92
|
-
else
|
93
|
-
super
|
94
|
-
end
|
95
|
-
else
|
96
|
-
super
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def _type_cast(value)
|
101
|
-
case value
|
102
|
-
when Type::Binary::Data
|
103
|
-
# Return a bind param hash with format as binary.
|
104
|
-
# See http://deveiate.org/code/pg/PGconn.html#method-i-exec_prepared-doc
|
105
|
-
# for more information
|
106
|
-
{ value: value.to_s, format: 1 }
|
107
|
-
when OID::Xml::Data, OID::Bit::Data
|
108
|
-
value.to_s
|
109
|
-
else
|
110
|
-
super
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module ReferentialIntegrity # :nodoc:
|
5
|
-
def supports_disable_referential_integrity? # :nodoc:
|
6
|
-
true
|
7
|
-
end
|
8
|
-
|
9
|
-
def disable_referential_integrity # :nodoc:
|
10
|
-
if supports_disable_referential_integrity?
|
11
|
-
original_exception = nil
|
12
|
-
|
13
|
-
begin
|
14
|
-
transaction(requires_new: true) do
|
15
|
-
execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";"))
|
16
|
-
end
|
17
|
-
rescue ActiveRecord::ActiveRecordError => e
|
18
|
-
original_exception = e
|
19
|
-
end
|
20
|
-
|
21
|
-
begin
|
22
|
-
yield
|
23
|
-
rescue ActiveRecord::InvalidForeignKey => e
|
24
|
-
warn <<-WARNING
|
25
|
-
WARNING: Rails was not able to disable referential integrity.
|
26
|
-
|
27
|
-
This is most likely caused due to missing permissions.
|
28
|
-
Rails needs superuser privileges to disable referential integrity.
|
29
|
-
|
30
|
-
cause: #{original_exception.try(:message)}
|
31
|
-
|
32
|
-
WARNING
|
33
|
-
raise e
|
34
|
-
end
|
35
|
-
|
36
|
-
begin
|
37
|
-
transaction(requires_new: true) do
|
38
|
-
execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";"))
|
39
|
-
end
|
40
|
-
rescue ActiveRecord::ActiveRecordError
|
41
|
-
end
|
42
|
-
else
|
43
|
-
yield
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,180 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module ConnectionAdapters
|
3
|
-
module OvirtLegacyPostgreSQL
|
4
|
-
module ColumnMethods
|
5
|
-
# Defines the primary key field.
|
6
|
-
# Use of the native PostgreSQL UUID type is supported, and can be used
|
7
|
-
# by defining your tables as such:
|
8
|
-
#
|
9
|
-
# create_table :stuffs, id: :uuid do |t|
|
10
|
-
# t.string :content
|
11
|
-
# t.timestamps
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# By default, this will use the +uuid_generate_v4()+ function from the
|
15
|
-
# +uuid-ossp+ extension, which MUST be enabled on your database. To enable
|
16
|
-
# the +uuid-ossp+ extension, you can use the +enable_extension+ method in your
|
17
|
-
# migrations. To use a UUID primary key without +uuid-ossp+ enabled, you can
|
18
|
-
# set the +:default+ option to +nil+:
|
19
|
-
#
|
20
|
-
# create_table :stuffs, id: false do |t|
|
21
|
-
# t.primary_key :id, :uuid, default: nil
|
22
|
-
# t.uuid :foo_id
|
23
|
-
# t.timestamps
|
24
|
-
# end
|
25
|
-
#
|
26
|
-
# You may also pass a different UUID generation function from +uuid-ossp+
|
27
|
-
# or another library.
|
28
|
-
#
|
29
|
-
# Note that setting the UUID primary key default value to +nil+ will
|
30
|
-
# require you to assure that you always provide a UUID value before saving
|
31
|
-
# a record (as primary keys cannot be +nil+). This might be done via the
|
32
|
-
# +SecureRandom.uuid+ method and a +before_save+ callback, for instance.
|
33
|
-
def primary_key(name, type = :primary_key, **options)
|
34
|
-
options[:default] = options.fetch(:default, 'uuid_generate_v4()') if type == :uuid
|
35
|
-
super
|
36
|
-
end
|
37
|
-
|
38
|
-
def bigserial(*args, **options)
|
39
|
-
args.each { |name| column(name, :bigserial, options) }
|
40
|
-
end
|
41
|
-
|
42
|
-
def bit(*args, **options)
|
43
|
-
args.each { |name| column(name, :bit, options) }
|
44
|
-
end
|
45
|
-
|
46
|
-
def bit_varying(*args, **options)
|
47
|
-
args.each { |name| column(name, :bit_varying, options) }
|
48
|
-
end
|
49
|
-
|
50
|
-
def cidr(*args, **options)
|
51
|
-
args.each { |name| column(name, :cidr, options) }
|
52
|
-
end
|
53
|
-
|
54
|
-
def citext(*args, **options)
|
55
|
-
args.each { |name| column(name, :citext, options) }
|
56
|
-
end
|
57
|
-
|
58
|
-
def daterange(*args, **options)
|
59
|
-
args.each { |name| column(name, :daterange, options) }
|
60
|
-
end
|
61
|
-
|
62
|
-
def hstore(*args, **options)
|
63
|
-
args.each { |name| column(name, :hstore, options) }
|
64
|
-
end
|
65
|
-
|
66
|
-
def inet(*args, **options)
|
67
|
-
args.each { |name| column(name, :inet, options) }
|
68
|
-
end
|
69
|
-
|
70
|
-
def int4range(*args, **options)
|
71
|
-
args.each { |name| column(name, :int4range, options) }
|
72
|
-
end
|
73
|
-
|
74
|
-
def int8range(*args, **options)
|
75
|
-
args.each { |name| column(name, :int8range, options) }
|
76
|
-
end
|
77
|
-
|
78
|
-
def json(*args, **options)
|
79
|
-
args.each { |name| column(name, :json, options) }
|
80
|
-
end
|
81
|
-
|
82
|
-
def jsonb(*args, **options)
|
83
|
-
args.each { |name| column(name, :jsonb, options) }
|
84
|
-
end
|
85
|
-
|
86
|
-
def ltree(*args, **options)
|
87
|
-
args.each { |name| column(name, :ltree, options) }
|
88
|
-
end
|
89
|
-
|
90
|
-
def macaddr(*args, **options)
|
91
|
-
args.each { |name| column(name, :macaddr, options) }
|
92
|
-
end
|
93
|
-
|
94
|
-
def money(*args, **options)
|
95
|
-
args.each { |name| column(name, :money, options) }
|
96
|
-
end
|
97
|
-
|
98
|
-
def numrange(*args, **options)
|
99
|
-
args.each { |name| column(name, :numrange, options) }
|
100
|
-
end
|
101
|
-
|
102
|
-
def point(*args, **options)
|
103
|
-
args.each { |name| column(name, :point, options) }
|
104
|
-
end
|
105
|
-
|
106
|
-
def line(*args, **options)
|
107
|
-
args.each { |name| column(name, :line, options) }
|
108
|
-
end
|
109
|
-
|
110
|
-
def lseg(*args, **options)
|
111
|
-
args.each { |name| column(name, :lseg, options) }
|
112
|
-
end
|
113
|
-
|
114
|
-
def box(*args, **options)
|
115
|
-
args.each { |name| column(name, :box, options) }
|
116
|
-
end
|
117
|
-
|
118
|
-
def path(*args, **options)
|
119
|
-
args.each { |name| column(name, :path, options) }
|
120
|
-
end
|
121
|
-
|
122
|
-
def polygon(*args, **options)
|
123
|
-
args.each { |name| column(name, :polygon, options) }
|
124
|
-
end
|
125
|
-
|
126
|
-
def circle(*args, **options)
|
127
|
-
args.each { |name| column(name, :circle, options) }
|
128
|
-
end
|
129
|
-
|
130
|
-
def serial(*args, **options)
|
131
|
-
args.each { |name| column(name, :serial, options) }
|
132
|
-
end
|
133
|
-
|
134
|
-
def tsrange(*args, **options)
|
135
|
-
args.each { |name| column(name, :tsrange, options) }
|
136
|
-
end
|
137
|
-
|
138
|
-
def tstzrange(*args, **options)
|
139
|
-
args.each { |name| column(name, :tstzrange, options) }
|
140
|
-
end
|
141
|
-
|
142
|
-
def tsvector(*args, **options)
|
143
|
-
args.each { |name| column(name, :tsvector, options) }
|
144
|
-
end
|
145
|
-
|
146
|
-
def uuid(*args, **options)
|
147
|
-
args.each { |name| column(name, :uuid, options) }
|
148
|
-
end
|
149
|
-
|
150
|
-
def xml(*args, **options)
|
151
|
-
args.each { |name| column(name, :xml, options) }
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
class ColumnDefinition < ActiveRecord::ConnectionAdapters::ColumnDefinition
|
156
|
-
attr_accessor :array
|
157
|
-
end
|
158
|
-
|
159
|
-
class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
|
160
|
-
include ColumnMethods
|
161
|
-
|
162
|
-
def new_column_definition(name, type, options) # :nodoc:
|
163
|
-
column = super
|
164
|
-
column.array = options[:array]
|
165
|
-
column
|
166
|
-
end
|
167
|
-
|
168
|
-
private
|
169
|
-
|
170
|
-
def create_column_definition(name, type)
|
171
|
-
OvirtLegacyPostgreSQL::ColumnDefinition.new name, type
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
class Table < ActiveRecord::ConnectionAdapters::Table
|
176
|
-
include ColumnMethods
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|