Sha256: 8e585080bbf239cffb18f9a827ba48963f4dc5480260e3918d2b39604238f824

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

class CreateCommentsMigration < Dynomite::Migration
  def up
    create_table :comments do |t|
      t.partition_key "post_id:string" # required
      t.sort_key  "created_at:string" # optional
      t.provisioned_throughput(1) # sets both read and write, defaults to 5 when not set

      t.lsi do |i|
        i.partition_key "post_id:string"
        i.sort_key "updated_at:string" # required for lsi
        i.provisioned_throughput(2)
      end

      # t.gsi do |i|
      #   i.partition_key "post_id:string"
      #   i.sort_key "deleted_at:string" # optional for gsi
      #   i.provisioned_throughput(2)
      # end
    end
  end
end

class UpdateCommentsMigration < Dynomite::Migration
  def up
    update_table :comments do |t|
      t.gsi(:create) do |i|
        i.partition_key "post_id:string"
        i.sort_key "flagged_at:string" # optional for gsi
        i.provisioned_throughput(3)
      end

      t.gsi(:update, "update-me-index") do |i|
        i.provisioned_throughput(5)
      end

      t.gsi(:delete, "delete-me-index")
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
dynomite-1.2.7 docs/migrations/short-example.rb
dynomite-1.2.6 docs/migrations/short-example.rb
dynomite-1.2.5 docs/migrations/short-example.rb
dynomite-1.2.4 docs/migrations/short-example.rb
dynomite-1.2.3 docs/migrations/short-example.rb
dynomite-1.2.2 docs/migrations/short-example.rb
dynomite-1.2.1 docs/migrations/short-example.rb
dynomite-1.2.0 docs/migrations/short-example.rb
dynomite-1.1.1 docs/migrations/short-example.rb
jets-1.4.10 vendor/dynomite/docs/migrations/short-example.rb
dynomite-1.1.0 docs/migrations/short-example.rb