Add new database table and model for targeted_messages
What
Implement the new database table and model for targeted messages
Why
This new feature is being implemented to support targeted messaging capabilities in GitLab. It will require a new database table for the no-code solution to read what users will be targeted.
Requirements
- Create a new database table called
targeted_messages - Develop a corresponding model for the new table
- Implement a join table with users (possibly named
user_targeted_messageor similar)
Implementation Details
Database Table Structure
targeted_messages
CREATE TABLE targeted_message_namespaces (
id bigint NOT NULL,
targeted_message_id bigint NOT NULL,
namespace_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
);
targeted_message_dismissals
CREATE TABLE targeted_message_dismissals (
id bigint NOT NULL,
targeted_message_id bigint NOT NULL,
user_id bigint NOT NULL,
namespace_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
);
targeted_message_namespaces
CREATE TABLE targeted_message_namespaces (
id bigint NOT NULL,
targeted_message_id bigint NOT NULL,
namespace_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
);
Notes
Additional Information
- The new table may have similarities to the existing
broadcast_messagestable - The
target_typefield will be an enum defined in the model layer - The enum will drive priority (first in, first out) for now
- This implementation can be worked on alongside issue #511014 (closed), which will use this new table
Edited by Doug Stull