Skip to content

Global Secondary Index Migration while inheriting table data #140

@thomaswitt

Description

@thomaswitt

When creating a GSI I have to define read_capacity_units, otherwise an error is raised. By default, global secondary indexes inherit the capacity settings of the base table. Global secondary indexes can have a different capacity mode only when the base table is in provisioned capacity mode.

This should bereflected, so it should be possible to just define t.global_secondary_index(:gsi_name) without supplying any request units.

E.g.

class BlogPost
  set_table_name "blogger"
  string_attr :hk, hash_key: true
  string_attr :rk, range_key: true
  string_attr :name
  string_attr :slug
  global_secondary_index(:slug_gsi,
                         hash_key: :hk,
                         range_key: :slug,
                         projection: { projection_type: 'KEYS_ONLY' })

    table_config = Aws::Record::TableConfig.define do |t|
      t.model_class(BlogPost)
      t.billing_mode 'PAY_PER_REQUEST'
      t.global_secondary_index(:slug_gsi)
    end
    table_config.migrate!
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigatingIssue is being investigated and/or work is in progress to resolve the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions