Skip to content

Commit

Permalink
Merge 45a58a4 into 1af2aa4
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Sep 24, 2022
2 parents 1af2aa4 + 45a58a4 commit 2cc21ee
Showing 1 changed file with 32 additions and 21 deletions.
53 changes: 32 additions & 21 deletions lib/ridgepole/dsl_parser/table_definition.rb
Expand Up @@ -26,53 +26,64 @@ def column(name, type, options = {})
DEFAULT_PRIMARY_KEY_TYPE = :bigint

TYPES = {
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
string: {},
text: {},
integer: {},
# https://github.com/rails/rails/blob/main/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L300-L301
bigint: {},
float: {},
decimal: {},
datetime: {},
timestamp: {},
time: {},
date: {},
binary: {},
boolean: {},
date: {},
datetime: {},
decimal: {},
float: {},
integer: {},
json: {},
string: {},
text: {},
time: {},
timestamp: {},
virtual: {},

# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79
# https://github.com/rails/rails/blob/v6.0.6/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L101
serial: { null: false },
bigserial: { null: false },
# string: {},
# text: {},
# integer: {},
# float: {},
# decimal: {},
# datetime: {},
# time: {},
# date: {},
daterange: {},
numrange: {},
tsrange: {},
tstzrange: {},
int4range: {},
int8range: {},
# binary: {}, # dup key
# boolean: {}, # dup key
# bigint: {}, # dup key
# binary: {},
# boolean: {},
xml: {},
tsvector: {},
hstore: {},
inet: {},
cidr: {},
macaddr: {},
uuid: {},
json: {},
# json: {},
jsonb: {},
ltree: {},
citext: {},
point: {},
line: {},
lseg: {},
box: {},
path: {},
polygon: {},
circle: {},
bit: {},
bit_varying: {},
money: {},

# https://github.com/rails/rails/blob/v5.1.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L184
virtual: {},

# https://github.com/rails/rails/blob/v5.0.4/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L53
# json: {}, # dup key
interval: {},
oid: {},
}.freeze

TYPES.each do |column_type, default_options|
Expand Down

0 comments on commit 2cc21ee

Please sign in to comment.