From affb3a964d1127b2c5683da0a817b2a827b520e5 Mon Sep 17 00:00:00 2001 From: Carlos Silva Date: Fri, 30 Dec 2022 03:17:06 -0300 Subject: [PATCH] Fix #74 by updating the create table method --- lib/torque/postgresql/adapter/schema_creation.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/torque/postgresql/adapter/schema_creation.rb b/lib/torque/postgresql/adapter/schema_creation.rb index 535f2ff..af23509 100644 --- a/lib/torque/postgresql/adapter/schema_creation.rb +++ b/lib/torque/postgresql/adapter/schema_creation.rb @@ -13,21 +13,15 @@ def visit_TableDefinition(o) statements << accept(o.primary_keys) if o.primary_keys if supports_indexes_in_create? - statements.concat(o.indexes.map do |column_name, options| - index_in_create(o.name, column_name, options) - end) + statements.concat(o.indexes.map { |c, o| index_in_create(o.name, c, o) }) end if supports_foreign_keys? - statements.concat(o.foreign_keys.map do |to_table, options| - foreign_key_in_create(o.name, to_table, options) - end) + statements.concat(o.foreign_keys.map { |fk| accept fk }) end if respond_to?(:supports_check_constraints?) && supports_check_constraints? - statements.concat(o.check_constraints.map do |expression, options| - check_constraint_in_create(o.name, expression, options) - end) + statements.concat(o.check_constraints.map { |chk| accept chk }) end create_sql << "(#{statements.join(', ')})" \