docbrown/db/migrate/20190925171050_create_user_blocks.rb
Andy Zhao 73caa9a864 New Feature: Block Users (#4411)
* Prevent need for eager loading

* Add initial implementation of user block

* Remove debugger oops

* Add index and foreign keys for user_block table

* Use private method instead of exists

* Move channel handling logic to service object

* Update styling a bit

* Use profileDropdown file for future proofing

* Remove commented out code

* Render json: { result } for all endpoints

* Add statuses for sad paths

* Add better sad path handling in the JS

* Remove accidentally committed spec file

* Don't wait for DOM to load block button

* Use equality for accuracy in slug query

* Add status code for unauthorized requests

* Add missing comma sigh
2019-10-23 17:14:28 -04:00

15 lines
483 B
Ruby

class CreateUserBlocks < ActiveRecord::Migration[5.2]
def change
create_table :user_blocks do |t|
t.bigint :blocked_id, null: false
t.bigint :blocker_id, null: false
t.string :config, null: false, default: "default"
t.timestamps null: false
end
add_index :user_blocks, %i[blocked_id blocker_id], unique: true
add_foreign_key :user_blocks, :users, column: :blocker_id
add_foreign_key :user_blocks, :users, column: :blocked_id
end
end