_attribute_definitions

in lib/aws-record/record/table_config.rb [458:483]


      def _attribute_definitions
        attribute_definitions = _keys.map do |_type, attr|
          {
            attribute_name: attr.database_name,
            attribute_type: attr.dynamodb_type
          }
        end
        @model_class.global_secondary_indexes.each_value do |attributes|
          gsi_keys = [attributes[:hash_key]]
          gsi_keys << attributes[:range_key] if attributes[:range_key]
          gsi_keys.each do |name|
            attribute = @model_class.attributes.attribute_for(name)
            exists = attribute_definitions.any? do |ad|
              ad[:attribute_name] == attribute.database_name
            end
            next if exists

            attribute_definitions << {
              attribute_name: attribute.database_name,
              attribute_type: attribute.dynamodb_type
            }
          end
        end
        attribute_definitions
      end