_attribute_definitions

in lib/aws-record/record/table_config.rb [482:507]


      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 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
            unless exists
              attribute_definitions << {
                attribute_name: attribute.database_name,
                attribute_type: attribute.dynamodb_type
              }
            end
          end
        end
        attribute_definitions
      end