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:
evazion
2022-09-25 00:03:52 -05:00
parent 718c4d121b
commit 9026875776
2 changed files with 28 additions and 2 deletions

View 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

View File

@@ -993,7 +993,9 @@ CREATE TABLE public.mod_actions (
description text NOT NULL,
created_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);
--
-- 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: -
--
@@ -6722,6 +6738,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220921022408'),
('20220922014326'),
('20220923010905'),
('20220924092056');
('20220924092056'),
('20220925045236');