Commit f8aa9be0 authored by Drew Blessing's avatar Drew Blessing Committed by Adam Hegyi

Create `saml_group_links` database table

Creates a table to store SAML Group Links, similar to LDAP
Group Links.
parent ea70a6e4
# frozen_string_literal: true
class CreateSamlGroupLinks < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
unless table_exists?(:saml_group_links)
with_lock_retries do
create_table :saml_group_links do |t|
t.references :group, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false
t.timestamps_with_timezone
t.integer :access_level, null: false
t.text :group_name, null: false
t.index [:group_id, :group_name], unique: true
end
end
end
add_text_limit :saml_group_links, :group_name, 255
end
def down
with_lock_retries do
drop_table :saml_group_links
end
end
end
823d23d8ce8959762a7cadb883ed6d36a46fedaf238ea955d93136277d55cad5
\ No newline at end of file
......@@ -15752,6 +15752,25 @@ CREATE SEQUENCE routes_id_seq
ALTER SEQUENCE routes_id_seq OWNED BY routes.id;
CREATE TABLE saml_group_links (
id bigint NOT NULL,
group_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
access_level integer NOT NULL,
group_name text NOT NULL,
CONSTRAINT check_1a5ae2ac07 CHECK ((char_length(group_name) <= 255))
);
CREATE SEQUENCE saml_group_links_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE saml_group_links_id_seq OWNED BY saml_group_links.id;
CREATE TABLE saml_providers (
id integer NOT NULL,
group_id integer NOT NULL,
......@@ -17898,6 +17917,8 @@ ALTER TABLE ONLY reviews ALTER COLUMN id SET DEFAULT nextval('reviews_id_seq'::r
ALTER TABLE ONLY routes ALTER COLUMN id SET DEFAULT nextval('routes_id_seq'::regclass);
ALTER TABLE ONLY saml_group_links ALTER COLUMN id SET DEFAULT nextval('saml_group_links_id_seq'::regclass);
ALTER TABLE ONLY saml_providers ALTER COLUMN id SET DEFAULT nextval('saml_providers_id_seq'::regclass);
ALTER TABLE ONLY scim_identities ALTER COLUMN id SET DEFAULT nextval('scim_identities_id_seq'::regclass);
......@@ -19206,6 +19227,9 @@ ALTER TABLE ONLY reviews
ALTER TABLE ONLY routes
ADD CONSTRAINT routes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY saml_group_links
ADD CONSTRAINT saml_group_links_pkey PRIMARY KEY (id);
ALTER TABLE ONLY saml_providers
ADD CONSTRAINT saml_providers_pkey PRIMARY KEY (id);
......@@ -21454,6 +21478,10 @@ CREATE INDEX index_routes_on_path_trigram ON routes USING gin (path gin_trgm_ops
CREATE UNIQUE INDEX index_routes_on_source_type_and_source_id ON routes USING btree (source_type, source_id);
CREATE INDEX index_saml_group_links_on_group_id ON saml_group_links USING btree (group_id);
CREATE UNIQUE INDEX index_saml_group_links_on_group_id_and_group_name ON saml_group_links USING btree (group_id, group_name);
CREATE INDEX index_saml_providers_on_group_id ON saml_providers USING btree (group_id);
CREATE INDEX index_scim_identities_on_group_id ON scim_identities USING btree (group_id);
......@@ -23025,6 +23053,9 @@ ALTER TABLE ONLY clusters_applications_runners
ALTER TABLE ONLY service_desk_settings
ADD CONSTRAINT fk_rails_223a296a85 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY saml_group_links
ADD CONSTRAINT fk_rails_22e312c530 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY group_custom_attributes
ADD CONSTRAINT fk_rails_246e0db83a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment