2b8d41a752
To prevent people missing a notification they care about when we ship the subscriptions feature, we'll start out with everything toggled on (which matches the previous behaviour). People can then opt out as they like.
19 lines
644 B
Ruby
19 lines
644 B
Ruby
class CreateSubscriptions < ActiveRecord::Migration[8.1]
|
|
def change
|
|
create_table :subscriptions do |t|
|
|
t.references :subscribable, polymorphic: true, null: false, index: true
|
|
t.references :user, null: false, foreign_key: true
|
|
|
|
t.timestamps
|
|
|
|
t.index [ :subscribable_type, :subscribable_id, :user_id ], unique: true
|
|
end
|
|
|
|
# Subscribe everyone to their current buckets to start with
|
|
execute "
|
|
insert into subscriptions (subscribable_type, subscribable_id, user_id, created_at, updated_at)
|
|
select 'Bucket', bucket_id, user_id, current_timestamp, current_timestamp from accesses;
|
|
"
|
|
end
|
|
end
|