diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-16 00:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-16 00:08:59 +0300 |
commit | 367e7db836dd84ee39adcca18d973c1d530088aa (patch) | |
tree | ade004c21cda52721546ad67de82455b6fbe1618 /db | |
parent | fb994e98ecce2a1f1dfaa87c9c3de8535815813b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20201027101010_create_user_follow_users.rb | 24 | ||||
-rw-r--r-- | db/schema_migrations/20201027101010 | 1 | ||||
-rw-r--r-- | db/structure.sql | 18 |
3 files changed, 42 insertions, 1 deletions
diff --git a/db/migrate/20201027101010_create_user_follow_users.rb b/db/migrate/20201027101010_create_user_follow_users.rb new file mode 100644 index 00000000000..7c1f831f3b2 --- /dev/null +++ b/db/migrate/20201027101010_create_user_follow_users.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateUserFollowUsers < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + execute <<~SQL + CREATE TABLE user_follow_users ( + follower_id integer not null references users (id) on delete cascade, + followee_id integer not null references users (id) on delete cascade, + PRIMARY KEY (follower_id, followee_id) + ); + CREATE INDEX ON user_follow_users (followee_id); + SQL + end + end + + def down + drop_table :user_follow_users + end +end diff --git a/db/schema_migrations/20201027101010 b/db/schema_migrations/20201027101010 new file mode 100644 index 00000000000..68628373757 --- /dev/null +++ b/db/schema_migrations/20201027101010 @@ -0,0 +1 @@ +d6b324e808265c4ba8b6216c77b7abfa96b4b8b4c9fbd8d0a15240548526c4f3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 91efc451e20..5d27baaab02 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -17751,6 +17751,11 @@ CREATE SEQUENCE user_details_user_id_seq ALTER SEQUENCE user_details_user_id_seq OWNED BY user_details.user_id; +CREATE TABLE user_follow_users ( + follower_id integer NOT NULL, + followee_id integer NOT NULL +); + CREATE TABLE user_highest_roles ( user_id bigint NOT NULL, updated_at timestamp with time zone NOT NULL, @@ -20917,6 +20922,9 @@ ALTER TABLE ONLY user_custom_attributes ALTER TABLE ONLY user_details ADD CONSTRAINT user_details_pkey PRIMARY KEY (user_id); +ALTER TABLE ONLY user_follow_users + ADD CONSTRAINT user_follow_users_pkey PRIMARY KEY (follower_id, followee_id); + ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id); @@ -23774,6 +23782,8 @@ CREATE UNIQUE INDEX uniq_pkgs_debian_project_distributions_project_id_and_suite CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); +CREATE INDEX user_follow_users_followee_id_idx ON user_follow_users USING btree (followee_id); + CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnerability_occurrence_pipelines USING btree (occurrence_id, pipeline_id); @@ -26194,6 +26204,12 @@ ALTER TABLE ONLY u2f_registrations ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; ALTER TABLE product_analytics_events_experimental - ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;-- schema_migrations.version information is no longer stored in this file, + ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + +ALTER TABLE ONLY user_follow_users + ADD CONSTRAINT user_follow_users_followee_id_fkey FOREIGN KEY (followee_id) REFERENCES users(id) ON DELETE CASCADE; + +ALTER TABLE ONLY user_follow_users + ADD CONSTRAINT user_follow_users_follower_id_fkey FOREIGN KEY (follower_id) REFERENCES users(id) ON DELETE CASCADE;-- schema_migrations.version information is no longer stored in this file, -- but instead tracked in the db/schema_migrations directory -- see https://gitlab.com/gitlab-org/gitlab/-/issues/218590 for details |