db: add subject_id, subject_type columns to mod_actions.
The subject of the mod action is the post, user, or other object the modaction is for.
This commit is contained in:
9
db/migrate/20220925045236_add_subject_to_mod_actions.rb
Normal file
9
db/migrate/20220925045236_add_subject_to_mod_actions.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class AddSubjectToModActions < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column :mod_actions, :subject_type, :string, null: true
|
||||||
|
add_column :mod_actions, :subject_id, :integer, null: true
|
||||||
|
|
||||||
|
add_index :mod_actions, :subject_type
|
||||||
|
add_index :mod_actions, :subject_id
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -993,7 +993,9 @@ CREATE TABLE public.mod_actions (
|
|||||||
description text NOT NULL,
|
description text NOT NULL,
|
||||||
created_at timestamp without time zone NOT NULL,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone NOT NULL,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
category integer NOT NULL
|
category integer NOT NULL,
|
||||||
|
subject_type character varying,
|
||||||
|
subject_id integer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -4396,6 +4398,20 @@ CREATE INDEX index_mod_actions_on_creator_id_and_created_at ON public.mod_action
|
|||||||
CREATE INDEX index_mod_actions_on_description ON public.mod_actions USING gin (description public.gin_trgm_ops);
|
CREATE INDEX index_mod_actions_on_description ON public.mod_actions USING gin (description public.gin_trgm_ops);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_mod_actions_on_subject_id; Type: INDEX; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_mod_actions_on_subject_id ON public.mod_actions USING btree (subject_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_mod_actions_on_subject_type; Type: INDEX; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_mod_actions_on_subject_type ON public.mod_actions USING btree (subject_type);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_mod_actions_on_to_tsvector_pg_catalog_english_description; Type: INDEX; Schema: public; Owner: -
|
-- Name: index_mod_actions_on_to_tsvector_pg_catalog_english_description; Type: INDEX; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -6722,6 +6738,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||||||
('20220921022408'),
|
('20220921022408'),
|
||||||
('20220922014326'),
|
('20220922014326'),
|
||||||
('20220923010905'),
|
('20220923010905'),
|
||||||
('20220924092056');
|
('20220924092056'),
|
||||||
|
('20220925045236');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user