dynomite 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +9 -0
 - data/.rspec +3 -0
 - data/CHANGELOG.md +28 -0
 - data/Gemfile +6 -0
 - data/README.md +141 -0
 - data/Rakefile +2 -0
 - data/bin/console +14 -0
 - data/bin/setup +8 -0
 - data/docs/migrations/long-example.rb +123 -0
 - data/docs/migrations/short-example.rb +36 -0
 - data/dynomite.gemspec +29 -0
 - data/lib/dynomite.rb +23 -0
 - data/lib/dynomite/core.rb +25 -0
 - data/lib/dynomite/db_config.rb +101 -0
 - data/lib/dynomite/erb.rb +53 -0
 - data/lib/dynomite/item.rb +291 -0
 - data/lib/dynomite/log.rb +15 -0
 - data/lib/dynomite/migration.rb +27 -0
 - data/lib/dynomite/migration/common.rb +86 -0
 - data/lib/dynomite/migration/dsl.rb +172 -0
 - data/lib/dynomite/migration/dsl/base_secondary_index.rb +72 -0
 - data/lib/dynomite/migration/dsl/global_secondary_index.rb +4 -0
 - data/lib/dynomite/migration/dsl/local_secondary_index.rb +8 -0
 - data/lib/dynomite/migration/executor.rb +30 -0
 - data/lib/dynomite/migration/generator.rb +68 -0
 - data/lib/dynomite/migration/templates/create_table.rb +32 -0
 - data/lib/dynomite/migration/templates/update_table.rb +26 -0
 - data/lib/dynomite/version.rb +3 -0
 - metadata +141 -0
 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class <%= @migration_class_name %> < Dynomite::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def up
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table :<%= @table_name %> do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.partition_key "<%= @partition_key %>" # required
         
     | 
| 
      
 5 
     | 
    
         
            +
            <% if @sort_key # so extra spaces are not added when generated -%>
         
     | 
| 
      
 6 
     | 
    
         
            +
                  t.sort_key  "<%= @sort_key %>" # optional
         
     | 
| 
      
 7 
     | 
    
         
            +
            <% end -%>
         
     | 
| 
      
 8 
     | 
    
         
            +
                  t.provisioned_throughput(<%= @provisioned_throughput %>) # sets both read and write, defaults to 5 when not set
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  # Instead of using partition_key and sort_key you can set the
         
     | 
| 
      
 11 
     | 
    
         
            +
                  # key schema directly also
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # t.key_schema([
         
     | 
| 
      
 13 
     | 
    
         
            +
                  #     {attribute_name: "id", :key_type=>"HASH"},
         
     | 
| 
      
 14 
     | 
    
         
            +
                  #     {attribute_name: "created_at", :key_type=>"RANGE"}
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #   ])
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # t.attribute_definitions([
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #   {attribute_name: "id", attribute_type: "N"},
         
     | 
| 
      
 18 
     | 
    
         
            +
                  #   {attribute_name: "created_at", attribute_type: "S"}
         
     | 
| 
      
 19 
     | 
    
         
            +
                  # ])
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  # other ways to set provisioned_throughput
         
     | 
| 
      
 22 
     | 
    
         
            +
                  # t.provisioned_throughput(:read, 10)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  # t.provisioned_throughput(:write, 10)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  # t.provisioned_throughput(
         
     | 
| 
      
 25 
     | 
    
         
            +
                  #   read_capacity_units: 5,
         
     | 
| 
      
 26 
     | 
    
         
            +
                  #   write_capacity_units: 5
         
     | 
| 
      
 27 
     | 
    
         
            +
                  # )
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            # More examples: https://github.com/tongueroo/dynomite/tree/master/docs
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class <%= @migration_class_name %> < Dynomite::Migration
         
     | 
| 
      
 2 
     | 
    
         
            +
              def up
         
     | 
| 
      
 3 
     | 
    
         
            +
                update_table :<%= @table_name %> do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.gsi(:create) do |i|
         
     | 
| 
      
 5 
     | 
    
         
            +
                    i.partition_key "<%= @partition_key %>" # required
         
     | 
| 
      
 6 
     | 
    
         
            +
            <% if @sort_key # so extra spaces are not added when generated -%>
         
     | 
| 
      
 7 
     | 
    
         
            +
                    t.sort_key  "<%= @sort_key %>" # optional
         
     | 
| 
      
 8 
     | 
    
         
            +
            <% end -%>
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                    i.provisioned_throughput(5)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  # Examples:
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # t.gsi(:update, "update-me-index") do |i|
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #   i.provisioned_throughput(10)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  # t.gsi(:delete, "delete-me-index")
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  # Must use :create, :update, :delete one at a time in separate migration files.
         
     | 
| 
      
 21 
     | 
    
         
            +
                  # DynamoDB imposes this.
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            # More examples: https://github.com/tongueroo/dynomite/tree/master/docs
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,141 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: dynomite
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.5
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Tung Nguyen
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-08-10 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: activesupport
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: aws-sdk-dynamodb
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: ActiveRecord-ish Dynamodb Model
         
     | 
| 
      
 84 
     | 
    
         
            +
            email:
         
     | 
| 
      
 85 
     | 
    
         
            +
            - tongueroo@gmail.com
         
     | 
| 
      
 86 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 87 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 88 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 89 
     | 
    
         
            +
            files:
         
     | 
| 
      
 90 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 91 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 92 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
      
 93 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 94 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 95 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 96 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 97 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 98 
     | 
    
         
            +
            - docs/migrations/long-example.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - docs/migrations/short-example.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - dynomite.gemspec
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib/dynomite.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/dynomite/core.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/dynomite/db_config.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - lib/dynomite/erb.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/dynomite/item.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/dynomite/log.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/dynomite/migration.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/dynomite/migration/common.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/dynomite/migration/dsl.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - lib/dynomite/migration/dsl/base_secondary_index.rb
         
     | 
| 
      
 111 
     | 
    
         
            +
            - lib/dynomite/migration/dsl/global_secondary_index.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            - lib/dynomite/migration/dsl/local_secondary_index.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - lib/dynomite/migration/executor.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - lib/dynomite/migration/generator.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/dynomite/migration/templates/create_table.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - lib/dynomite/migration/templates/update_table.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/dynomite/version.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            homepage: https://github.com/tongueroo/dynomite
         
     | 
| 
      
 119 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 120 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 121 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 122 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 123 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 125 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 126 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 127 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 128 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 129 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 130 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 131 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 132 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 133 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 134 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 135 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 136 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 137 
     | 
    
         
            +
            rubygems_version: 2.7.6
         
     | 
| 
      
 138 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 139 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 140 
     | 
    
         
            +
            summary: ActiveRecord-ish Dynamodb Model
         
     | 
| 
      
 141 
     | 
    
         
            +
            test_files: []
         
     |