Skip to content

Commit

Permalink
[Breaking Changes] Update and specify DynamoDB global secondary index…
Browse files Browse the repository at this point in the history
… name
  • Loading branch information
simukappu committed Mar 15, 2020
1 parent 9b8fdce commit ccd84f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/activity_notification/orm/dynamoid/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def group_members
belongs_to_composite_xdb_record :notifier, store_with_associated_records: true

# Mandatory global secondary index to query effectively
global_secondary_index hash_key: :target_key, range_key: :created_at, projected_attributes: :all
global_secondary_index hash_key: :group_owner_id, range_key: :created_at, projected_attributes: :all
global_secondary_index name: :index_target_key_created_at, hash_key: :target_key, range_key: :created_at, projected_attributes: :all
global_secondary_index name: :index_group_owner_id_created_at, hash_key: :group_owner_id, range_key: :created_at, projected_attributes: :all
# Optional global secondary index to sort by created_at
global_secondary_index hash_key: :notifier_key, range_key: :created_at, projected_attributes: :all
global_secondary_index hash_key: :notifiable_key, range_key: :created_at, projected_attributes: :all
global_secondary_index name: :index_notifier_key_created_at, hash_key: :notifier_key, range_key: :created_at, projected_attributes: :all
global_secondary_index name: :index_notifiable_key_created_at, hash_key: :notifiable_key, range_key: :created_at, projected_attributes: :all

validates :target, presence: true
validates :notifiable, presence: true
Expand Down
2 changes: 1 addition & 1 deletion lib/activity_notification/orm/dynamoid/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Subscription
field :unsubscribed_to_email_at, :datetime
field :optional_targets, :raw, default: {}

global_secondary_index hash_key: :target_key, range_key: :created_at, projected_attributes: :all
global_secondary_index name: :index_target_key_created_at, hash_key: :target_key, range_key: :created_at, projected_attributes: :all

validates :target, presence: true
validates :key, presence: true, uniqueness: { scope: :target_key }
Expand Down

0 comments on commit ccd84f7

Please sign in to comment.