dynamodb_model 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/migrations/long-example.rb +51 -0
- data/lib/dynamodb_model/item.rb +2 -1
- data/lib/dynamodb_model/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9158215874b48548a2277c47f0c8631154003c0d
|
4
|
+
data.tar.gz: 14286fcd10167671f71bea13b3a7004ce3297838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cac64e834aa90c2a32a0c02daa5dc140855efeb30991e32909455b0b9ba9c3cd00889d62b0abd40dc0479c3c5b40018c19a436effd9f995f04474fc3bd386c9
|
7
|
+
data.tar.gz: 6a542fbb159fd1ea0b807661bfeda3bad08e6f7ea363aacd023fed3e7a2aa901ded383218d9256e27fc48b40164114ac220a453d8cd2ed9119fc8d9589e5dd6a
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.2]
|
7
|
+
- to_json for json rendering
|
8
|
+
|
6
9
|
## [1.0.1]
|
7
10
|
- Check dynamodb local is running when configured
|
8
11
|
|
@@ -1,9 +1,60 @@
|
|
1
|
+
# Note: table name created will be namespaced based on
|
2
|
+
# DynamodbModel::Migration.table_namespace. This can be set in
|
3
|
+
# config/dynamodb.yml
|
4
|
+
#
|
5
|
+
# development:
|
6
|
+
# table_namespace: "mynamespace"
|
7
|
+
#
|
8
|
+
# This results in:
|
9
|
+
# create_table "posts"
|
10
|
+
# Produces:
|
11
|
+
# table name: "mynamespace-posts"
|
12
|
+
#
|
13
|
+
# When you're in a in Jets project you can set the namespace based on
|
14
|
+
# Jets.config.table_namespace, which is based on the project name and
|
15
|
+
# a short version of the environment. Example:
|
16
|
+
#
|
17
|
+
# `config/dynamodb.yml`:
|
18
|
+
# development:
|
19
|
+
# table_namespace: <%= Jets.config.table_namespace %>
|
20
|
+
#
|
21
|
+
# If your project_name is demo and environment is production:
|
22
|
+
# create_table "posts" => table name: "demo-prod-posts"
|
23
|
+
#
|
24
|
+
# If your project_name is proj and environment is staging:
|
25
|
+
# create_table "posts" => table name: "demo-stag-posts"
|
26
|
+
#
|
27
|
+
# If your project_name is proj and environment is development:
|
28
|
+
# create_table "posts" => table name: "demo-dev-posts"
|
29
|
+
#
|
30
|
+
# If the table_namespace is set to a blank string or nil, then a namespace
|
31
|
+
# will not be prepended at all.
|
32
|
+
|
1
33
|
class CreateCommentsMigration < DynamodbModel::Migration
|
2
34
|
def up
|
3
35
|
create_table :comments do |t|
|
4
36
|
t.partition_key "post_id:string" # required
|
5
37
|
t.sort_key "created_at:string" # optional
|
6
38
|
t.provisioned_throughput(5) # sets both read and write, defaults to 5 when not set
|
39
|
+
|
40
|
+
# Instead of using partition_key and sort_key you can set the
|
41
|
+
# key schema directly also
|
42
|
+
# t.key_schema([
|
43
|
+
# {attribute_name: "id", :key_type=>"HASH"},
|
44
|
+
# {attribute_name: "created_at", :key_type=>"RANGE"}
|
45
|
+
# ])
|
46
|
+
# t.attribute_definitions([
|
47
|
+
# {attribute_name: "id", attribute_type: "N"},
|
48
|
+
# {attribute_name: "created_at", attribute_type: "S"}
|
49
|
+
# ])
|
50
|
+
|
51
|
+
# other ways to set provisioned_throughput
|
52
|
+
# t.provisioned_throughput(:read, 10)
|
53
|
+
# t.provisioned_throughput(:write, 10)
|
54
|
+
# t.provisioned_throughput(
|
55
|
+
# read_capacity_units: 5,
|
56
|
+
# write_capacity_units: 5
|
57
|
+
# )
|
7
58
|
end
|
8
59
|
end
|
9
60
|
end
|
data/lib/dynamodb_model/item.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamodb_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.6.13
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: ActiveRecord-ish Dynamodb Model
|