Make user_id column unique on user_statuses

This commit is contained in:
Kira 2019-08-27 15:44:23 -07:00
parent b5f6b6d422
commit 4fe2e02fa4
2 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,11 @@
class AddUserStatusIndexing < ActiveRecord::Migration[5.2]
def up
remove_index :user_statuses, :user_id
add_index :user_statuses, :user_id, unique: true
end
def down
remove_index :user_statuses, :user_id
add_index :user_statuses, :user_id
end
end

View File

@ -4866,7 +4866,7 @@ CREATE INDEX index_user_name_change_requests_on_user_id ON public.user_name_chan
-- Name: index_user_statuses_on_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_user_statuses_on_user_id ON public.user_statuses USING btree (user_id);
CREATE UNIQUE INDEX index_user_statuses_on_user_id ON public.user_statuses USING btree (user_id);
--
@ -5246,6 +5246,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190801210547'),
('20190804010156'),
('20190810064211'),
('20190815131908');
('20190815131908'),
('20190827223818');