CREATE SCHEMA gitlab_partitions_dynamic;

COMMENT ON SCHEMA gitlab_partitions_dynamic IS 'Schema to hold partitions managed dynamically from the application, e.g. for time space partitioning.';

CREATE SCHEMA gitlab_partitions_static;

COMMENT ON SCHEMA gitlab_partitions_static IS 'Schema to hold static partitions, e.g. for hash partitioning';

CREATE EXTENSION IF NOT EXISTS btree_gist;

CREATE EXTENSION IF NOT EXISTS pg_trgm;

CREATE FUNCTION assign_ci_runner_machines_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_runner_machines_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_ci_runner_taggings_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_runner_taggings_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_ci_runners_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_runners_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_build_tags_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('p_ci_build_tags_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_builds_execution_configs_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('p_ci_builds_execution_configs_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_builds_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_builds_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_job_annotations_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('p_ci_job_annotations_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_job_artifacts_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_job_artifacts_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_pipeline_variables_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_pipeline_variables_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_pipelines_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_pipelines_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_ci_stages_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('ci_stages_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_duo_workflows_checkpoints_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('p_duo_workflows_checkpoints_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_p_knowledge_graph_tasks_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('p_knowledge_graph_tasks_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION assign_zoekt_tasks_id_value() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."id" IS NOT NULL THEN
  RAISE WARNING 'Manually assigning ids is not allowed, the value will be ignored';
END IF;
NEW."id" := nextval('zoekt_tasks_id_seq'::regclass);
RETURN NEW;

END
$$;

CREATE FUNCTION delete_associated_project_namespace() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
DELETE FROM namespaces
WHERE namespaces.id = OLD.project_namespace_id AND
namespaces.type = 'Project';
RETURN NULL;

END
$$;

CREATE TABLE namespaces (
    id bigint NOT NULL,
    name character varying NOT NULL,
    path character varying NOT NULL,
    owner_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    type character varying DEFAULT 'User'::character varying NOT NULL,
    description character varying DEFAULT ''::character varying NOT NULL,
    avatar character varying,
    membership_lock boolean DEFAULT false,
    share_with_group_lock boolean DEFAULT false,
    visibility_level integer DEFAULT 20 NOT NULL,
    request_access_enabled boolean DEFAULT true NOT NULL,
    ldap_sync_status character varying DEFAULT 'ready'::character varying NOT NULL,
    ldap_sync_error character varying,
    ldap_sync_last_update_at timestamp without time zone,
    ldap_sync_last_successful_update_at timestamp without time zone,
    ldap_sync_last_sync_at timestamp without time zone,
    description_html text,
    lfs_enabled boolean,
    parent_id bigint,
    shared_runners_minutes_limit integer,
    repository_size_limit bigint,
    require_two_factor_authentication boolean DEFAULT false NOT NULL,
    two_factor_grace_period integer DEFAULT 48 NOT NULL,
    cached_markdown_version integer,
    project_creation_level integer,
    runners_token character varying,
    file_template_project_id bigint,
    saml_discovery_token character varying,
    runners_token_encrypted character varying,
    custom_project_templates_group_id bigint,
    auto_devops_enabled boolean,
    extra_shared_runners_minutes_limit integer,
    last_ci_minutes_notification_at timestamp with time zone,
    last_ci_minutes_usage_notification_level integer,
    subgroup_creation_level integer DEFAULT 1,
    max_pages_size integer,
    max_artifacts_size integer,
    mentions_disabled boolean,
    default_branch_protection smallint,
    max_personal_access_token_lifetime integer,
    push_rule_id bigint,
    shared_runners_enabled boolean DEFAULT true NOT NULL,
    allow_descendants_override_disabled_shared_runners boolean DEFAULT false NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    organization_id bigint,
    CONSTRAINT check_2eae3bdf93 CHECK ((organization_id IS NOT NULL))
);

CREATE FUNCTION find_namespaces_by_id(namespaces_id bigint) RETURNS namespaces
    LANGUAGE plpgsql STABLE COST 1 PARALLEL SAFE
    AS $$
BEGIN
  return (SELECT namespaces FROM namespaces WHERE id = namespaces_id LIMIT 1);
END;
$$;

CREATE TABLE projects (
    id bigint NOT NULL,
    name character varying,
    path character varying,
    description text,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    creator_id bigint,
    namespace_id bigint NOT NULL,
    last_activity_at timestamp without time zone,
    import_url character varying,
    visibility_level integer DEFAULT 0 NOT NULL,
    archived boolean DEFAULT false NOT NULL,
    avatar character varying,
    merge_requests_template text,
    star_count integer DEFAULT 0 NOT NULL,
    merge_requests_rebase_enabled boolean DEFAULT false,
    import_type character varying,
    import_source character varying,
    approvals_before_merge integer DEFAULT 0 NOT NULL,
    reset_approvals_on_push boolean DEFAULT true,
    merge_requests_ff_only_enabled boolean DEFAULT false,
    issues_template text,
    mirror boolean DEFAULT false NOT NULL,
    mirror_last_update_at timestamp without time zone,
    mirror_last_successful_update_at timestamp without time zone,
    mirror_user_id bigint,
    shared_runners_enabled boolean DEFAULT true NOT NULL,
    runners_token character varying,
    build_allow_git_fetch boolean DEFAULT true NOT NULL,
    build_timeout integer DEFAULT 3600 NOT NULL,
    mirror_trigger_builds boolean DEFAULT false NOT NULL,
    pending_delete boolean DEFAULT false,
    public_builds boolean DEFAULT true NOT NULL,
    last_repository_check_failed boolean,
    last_repository_check_at timestamp without time zone,
    only_allow_merge_if_pipeline_succeeds boolean DEFAULT false NOT NULL,
    has_external_issue_tracker boolean,
    repository_storage character varying DEFAULT 'default'::character varying NOT NULL,
    repository_read_only boolean,
    request_access_enabled boolean DEFAULT true NOT NULL,
    has_external_wiki boolean,
    ci_config_path character varying,
    lfs_enabled boolean,
    description_html text,
    only_allow_merge_if_all_discussions_are_resolved boolean,
    repository_size_limit bigint,
    printing_merge_request_link_enabled boolean DEFAULT true NOT NULL,
    auto_cancel_pending_pipelines integer DEFAULT 1 NOT NULL,
    service_desk_enabled boolean DEFAULT true,
    cached_markdown_version integer,
    delete_error text,
    last_repository_updated_at timestamp without time zone,
    disable_overriding_approvers_per_merge_request boolean,
    storage_version smallint,
    resolve_outdated_diff_discussions boolean,
    remote_mirror_available_overridden boolean,
    only_mirror_protected_branches boolean,
    pull_mirror_available_overridden boolean,
    jobs_cache_index integer,
    external_authorization_classification_label character varying,
    mirror_overwrites_diverged_branches boolean,
    pages_https_only boolean DEFAULT true,
    external_webhook_token character varying,
    packages_enabled boolean,
    merge_requests_author_approval boolean DEFAULT false,
    pool_repository_id bigint,
    runners_token_encrypted character varying,
    bfg_object_map character varying,
    detected_repository_languages boolean,
    merge_requests_disable_committers_approval boolean,
    require_password_to_approve boolean,
    emails_disabled boolean,
    max_pages_size integer,
    max_artifacts_size integer,
    pull_mirror_branch_prefix character varying(50),
    remove_source_branch_after_merge boolean,
    marked_for_deletion_at date,
    marked_for_deletion_by_user_id bigint,
    autoclose_referenced_issues boolean,
    suggestion_commit_message character varying(255),
    project_namespace_id bigint,
    hidden boolean DEFAULT false NOT NULL,
    organization_id bigint,
    CONSTRAINT check_1a6f946a8a CHECK ((organization_id IS NOT NULL)),
    CONSTRAINT check_fa75869cb1 CHECK ((project_namespace_id IS NOT NULL))
);

CREATE FUNCTION find_projects_by_id(projects_id bigint) RETURNS projects
    LANGUAGE plpgsql STABLE COST 1 PARALLEL SAFE
    AS $$
BEGIN
  return (SELECT projects FROM projects WHERE id = projects_id LIMIT 1);
END;
$$;

CREATE TABLE users (
    id bigint NOT NULL,
    email character varying DEFAULT ''::character varying NOT NULL,
    encrypted_password character varying DEFAULT ''::character varying NOT NULL,
    reset_password_token character varying,
    reset_password_sent_at timestamp without time zone,
    remember_created_at timestamp without time zone,
    sign_in_count integer DEFAULT 0,
    current_sign_in_at timestamp without time zone,
    last_sign_in_at timestamp without time zone,
    current_sign_in_ip character varying,
    last_sign_in_ip character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    name character varying,
    admin boolean DEFAULT false NOT NULL,
    projects_limit integer NOT NULL,
    failed_attempts integer DEFAULT 0,
    locked_at timestamp without time zone,
    username character varying,
    can_create_group boolean DEFAULT true NOT NULL,
    can_create_team boolean DEFAULT true NOT NULL,
    state character varying,
    color_scheme_id bigint DEFAULT 1 NOT NULL,
    password_expires_at timestamp without time zone,
    created_by_id bigint,
    last_credential_check_at timestamp without time zone,
    avatar character varying,
    confirmation_token character varying,
    confirmed_at timestamp without time zone,
    confirmation_sent_at timestamp without time zone,
    unconfirmed_email character varying,
    hide_no_ssh_key boolean DEFAULT false,
    admin_email_unsubscribed_at timestamp without time zone,
    notification_email character varying,
    hide_no_password boolean DEFAULT false,
    password_automatically_set boolean DEFAULT false,
    encrypted_otp_secret character varying,
    encrypted_otp_secret_iv character varying,
    encrypted_otp_secret_salt character varying,
    otp_required_for_login boolean DEFAULT false NOT NULL,
    otp_backup_codes text,
    public_email character varying,
    dashboard integer DEFAULT 0,
    project_view integer DEFAULT 2,
    consumed_timestep integer,
    layout integer DEFAULT 0,
    hide_project_limit boolean DEFAULT false,
    note text,
    unlock_token character varying,
    otp_grace_period_started_at timestamp without time zone,
    external boolean DEFAULT false,
    incoming_email_token character varying,
    auditor boolean DEFAULT false NOT NULL,
    require_two_factor_authentication_from_group boolean DEFAULT false NOT NULL,
    two_factor_grace_period integer DEFAULT 48 NOT NULL,
    last_activity_on date,
    notified_of_own_activity boolean DEFAULT false,
    preferred_language character varying,
    theme_id smallint,
    accepted_term_id bigint,
    feed_token character varying,
    private_profile boolean DEFAULT false NOT NULL,
    roadmap_layout smallint,
    include_private_contributions boolean,
    commit_email character varying,
    group_view integer,
    managing_group_id bigint,
    first_name character varying(255),
    last_name character varying(255),
    static_object_token character varying(255),
    role smallint,
    user_type smallint DEFAULT 0,
    static_object_token_encrypted text,
    otp_secret_expires_at timestamp with time zone,
    onboarding_in_progress boolean DEFAULT false NOT NULL,
    color_mode_id smallint DEFAULT 1 NOT NULL,
    composite_identity_enforced boolean DEFAULT false NOT NULL,
    organization_id bigint DEFAULT 1 NOT NULL,
    CONSTRAINT check_061f6f1c91 CHECK ((project_view IS NOT NULL)),
    CONSTRAINT check_0dd5948e38 CHECK ((user_type IS NOT NULL)),
    CONSTRAINT check_3a60c18afc CHECK ((hide_no_password IS NOT NULL)),
    CONSTRAINT check_693c6f3aab CHECK ((hide_no_ssh_key IS NOT NULL)),
    CONSTRAINT check_7bde697e8e CHECK ((char_length(static_object_token_encrypted) <= 255)),
    CONSTRAINT check_c737c04b87 CHECK ((notified_of_own_activity IS NOT NULL))
);

CREATE FUNCTION find_users_by_id(users_id bigint) RETURNS users
    LANGUAGE plpgsql STABLE COST 1 PARALLEL SAFE
    AS $$
BEGIN
  return (SELECT users FROM users WHERE id = users_id LIMIT 1);
END;
$$;

CREATE FUNCTION function_for_trigger_03be0f8add7e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."all_unarchived_project_ids" := NEW."all_active_project_ids";
  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_1baf8c8e1f66() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."pre_receive_secret_detection_enabled" := NEW."secret_push_protection_available";
  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_7d6a4f5b82c2() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."all_active_project_ids" := NEW."all_unarchived_project_ids";
  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_7f41427eda69() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."secret_push_protection_available" := NEW."pre_receive_secret_detection_enabled";
  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_7fbecfcdf89a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."pre_receive_secret_detection_enabled" := NEW."secret_push_protection_enabled";
  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_897f35481f9a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."secret_push_protection_enabled" := NEW."pre_receive_secret_detection_enabled";
  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_b9839c6d713f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  IF NEW."pre_receive_secret_detection_enabled" IS NOT DISTINCT FROM 'false' AND NEW."secret_push_protection_available" IS DISTINCT FROM 'false' THEN
    NEW."pre_receive_secret_detection_enabled" = NEW."secret_push_protection_available";
  END IF;

  IF NEW."secret_push_protection_available" IS NOT DISTINCT FROM 'false' AND NEW."pre_receive_secret_detection_enabled" IS DISTINCT FROM 'false' THEN
    NEW."secret_push_protection_available" = NEW."pre_receive_secret_detection_enabled";
  END IF;

  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_cbecfadbc3e8() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  IF NEW."pre_receive_secret_detection_enabled" IS NOT DISTINCT FROM 'false' AND NEW."secret_push_protection_enabled" IS DISTINCT FROM 'false' THEN
    NEW."pre_receive_secret_detection_enabled" = NEW."secret_push_protection_enabled";
  END IF;

  IF NEW."secret_push_protection_enabled" IS NOT DISTINCT FROM 'false' AND NEW."pre_receive_secret_detection_enabled" IS DISTINCT FROM 'false' THEN
    NEW."secret_push_protection_enabled" = NEW."pre_receive_secret_detection_enabled";
  END IF;

  RETURN NEW;
END
$$;

CREATE FUNCTION function_for_trigger_de99bb993511() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  IF NEW."all_active_project_ids" IS NOT DISTINCT FROM '{}' AND NEW."all_unarchived_project_ids" IS DISTINCT FROM '{}' THEN
    NEW."all_active_project_ids" = NEW."all_unarchived_project_ids";
  END IF;

  IF NEW."all_unarchived_project_ids" IS NOT DISTINCT FROM '{}' AND NEW."all_active_project_ids" IS DISTINCT FROM '{}' THEN
    NEW."all_unarchived_project_ids" = NEW."all_active_project_ids";
  END IF;

  RETURN NEW;
END
$$;

CREATE FUNCTION gitlab_schema_prevent_write() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF COALESCE(NULLIF(current_setting(CONCAT('lock_writes.', TG_TABLE_NAME), true), ''), 'true') THEN
      RAISE EXCEPTION 'Table: "%" is write protected within this Gitlab database.', TG_TABLE_NAME
        USING ERRCODE = 'modifying_sql_data_not_permitted',
        HINT = 'Make sure you are using the right database connection';
    END IF;
    RETURN NEW;
END
$$;

CREATE FUNCTION insert_catalog_resource_sync_event() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
INSERT INTO p_catalog_resource_sync_events (catalog_resource_id, project_id)
SELECT id, OLD.id FROM catalog_resources
WHERE project_id = OLD.id;
RETURN NULL;

END
$$;

CREATE FUNCTION insert_into_loose_foreign_keys_deleted_records() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  INSERT INTO loose_foreign_keys_deleted_records
  (fully_qualified_table_name, primary_key_value)
  SELECT TG_TABLE_SCHEMA || '.' || TG_TABLE_NAME, old_table.id FROM old_table;

  RETURN NULL;
END
$$;

CREATE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  INSERT INTO loose_foreign_keys_deleted_records
  (fully_qualified_table_name, primary_key_value)
  SELECT current_schema() || '.' || TG_ARGV[0], old_table.id FROM old_table;

  RETURN NULL;
END
$$;

CREATE FUNCTION insert_namespaces_sync_event() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
INSERT INTO namespaces_sync_events (namespace_id)
VALUES(COALESCE(NEW.id, OLD.id));
RETURN NULL;

END
$$;

CREATE FUNCTION insert_or_update_vulnerability_reads() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
  severity smallint;
  state smallint;
  report_type smallint;
  resolved_on_default_branch boolean;
  present_on_default_branch boolean;
  has_issues boolean;
  has_merge_request boolean;
BEGIN
  IF (SELECT current_setting('vulnerability_management.dont_execute_db_trigger', true) = 'true') THEN
    RETURN NULL;
  END IF;

  IF (NEW.vulnerability_id IS NULL AND (TG_OP = 'INSERT' OR TG_OP = 'UPDATE')) THEN
    RETURN NULL;
  END IF;

  IF (TG_OP = 'UPDATE' AND OLD.vulnerability_id IS NOT NULL AND NEW.vulnerability_id IS NOT NULL) THEN
    RETURN NULL;
  END IF;

  SELECT
    vulnerabilities.severity, vulnerabilities.state, vulnerabilities.report_type, vulnerabilities.resolved_on_default_branch, vulnerabilities.present_on_default_branch
  INTO
    severity, state, report_type, resolved_on_default_branch, present_on_default_branch
  FROM
    vulnerabilities
  WHERE
    vulnerabilities.id = NEW.vulnerability_id;

  IF present_on_default_branch IS NOT true THEN
    RETURN NULL;
  END IF;

  SELECT
    EXISTS (SELECT 1 FROM vulnerability_issue_links WHERE vulnerability_issue_links.vulnerability_id = NEW.vulnerability_id)
  INTO
    has_issues;

  SELECT
    EXISTS (SELECT 1 FROM vulnerability_merge_request_links WHERE vulnerability_merge_request_links.vulnerability_id = NEW.vulnerability_id)
  INTO
    has_merge_request;

  INSERT INTO vulnerability_reads (vulnerability_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues, has_merge_request)
    VALUES (NEW.vulnerability_id, NEW.project_id, NEW.scanner_id, report_type, severity, state, resolved_on_default_branch, NEW.uuid::uuid, NEW.location->>'image', NEW.location->'kubernetes_resource'->>'agent_id', CAST(NEW.location->'kubernetes_resource'->>'agent_id' AS bigint), has_issues, has_merge_request)
    ON CONFLICT(vulnerability_id) DO NOTHING;
  RETURN NULL;
END
$$;

CREATE FUNCTION insert_projects_sync_event() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
INSERT INTO projects_sync_events (project_id)
VALUES(COALESCE(NEW.id, OLD.id));
RETURN NULL;

END
$$;

CREATE FUNCTION insert_vulnerability_reads_from_vulnerability() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
  scanner_id bigint;
  uuid uuid;
  location_image text;
  cluster_agent_id text;
  casted_cluster_agent_id bigint;
  has_issues boolean;
  has_merge_request boolean;
BEGIN
  IF (SELECT current_setting('vulnerability_management.dont_execute_db_trigger', true) = 'true') THEN
    RETURN NULL;
  END IF;

  SELECT
    v_o.scanner_id, v_o.uuid, v_o.location->>'image', v_o.location->'kubernetes_resource'->>'agent_id', CAST(v_o.location->'kubernetes_resource'->>'agent_id' AS bigint)
  INTO
    scanner_id, uuid, location_image, cluster_agent_id, casted_cluster_agent_id
  FROM
    vulnerability_occurrences v_o
  WHERE
    v_o.vulnerability_id = NEW.id
  LIMIT 1;

  SELECT
    EXISTS (SELECT 1 FROM vulnerability_issue_links WHERE vulnerability_issue_links.vulnerability_id = NEW.id)
  INTO
    has_issues;

  SELECT
    EXISTS (SELECT 1 FROM vulnerability_merge_request_links WHERE vulnerability_merge_request_links.vulnerability_id = NEW.id)
  INTO
    has_merge_request;

  INSERT INTO vulnerability_reads (vulnerability_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues, has_merge_request)
    VALUES (NEW.id, NEW.project_id, scanner_id, NEW.report_type, NEW.severity, NEW.state, NEW.resolved_on_default_branch, uuid::uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues, has_merge_request)
    ON CONFLICT(vulnerability_id) DO NOTHING;
  RETURN NULL;
END
$$;

CREATE FUNCTION next_traversal_ids_sibling(traversal_ids bigint[]) RETURNS bigint[]
    LANGUAGE plpgsql IMMUTABLE STRICT
    AS $$
BEGIN
  return traversal_ids[1:array_length(traversal_ids, 1)-1] ||
  ARRAY[traversal_ids[array_length(traversal_ids, 1)]+1];
END;
$$;

CREATE FUNCTION nullify_merge_request_metrics_build_data() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF (OLD.pipeline_id IS NOT NULL) AND (NEW.pipeline_id IS NULL) THEN
  NEW.latest_build_started_at = NULL;
  NEW.latest_build_finished_at = NULL;
END IF;
RETURN NEW;

END
$$;

CREATE FUNCTION postgres_pg_stat_activity_autovacuum() RETURNS TABLE(query text, query_start timestamp with time zone)
    LANGUAGE sql SECURITY DEFINER
    SET search_path TO 'pg_catalog', 'pg_temp'
    AS $$
  SELECT query, query_start
  FROM pg_stat_activity
  WHERE datname = current_database()
    AND state = 'active'
    AND backend_type = 'autovacuum worker'
$$;

CREATE FUNCTION prevent_delete_of_default_organization() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF OLD.id = 1 THEN
  RAISE EXCEPTION 'Deletion of the default Organization is not allowed.';
END IF;
RETURN OLD;

END
$$;

CREATE FUNCTION set_has_external_issue_tracker() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE projects SET has_external_issue_tracker = (
  EXISTS
  (
    SELECT 1
    FROM integrations
    WHERE project_id = COALESCE(NEW.project_id, OLD.project_id)
      AND active = TRUE
      AND category = 'issue_tracker'
  )
)
WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id);
RETURN NULL;

END
$$;

CREATE FUNCTION set_has_external_wiki() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE projects SET has_external_wiki = COALESCE(NEW.active, FALSE)
WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id);
RETURN NULL;

END
$$;

CREATE FUNCTION set_has_issues_on_vulnerability_reads() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE
  vulnerability_reads
SET
  has_issues = true
WHERE
  vulnerability_id = NEW.vulnerability_id AND has_issues IS FALSE;
RETURN NULL;

END
$$;

CREATE FUNCTION set_has_merge_request_on_vulnerability_reads() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE
  vulnerability_reads
SET
  has_merge_request = true
WHERE
  vulnerability_id = NEW.vulnerability_id AND has_merge_request IS FALSE;
RETURN NULL;

END
$$;

CREATE FUNCTION sync_issues_dates_with_work_item_dates_sources() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE
  issues
SET
  start_date = NEW.start_date,
  due_date = NEW.due_date
WHERE
  issues.id = NEW.issue_id;

RETURN NULL;

END
$$;

CREATE FUNCTION sync_namespace_to_group_push_rules() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
  push_rule RECORD;
BEGIN
  IF NEW.type != 'Group' THEN
    RETURN NEW;
  END IF;

  IF OLD.push_rule_id IS NOT NULL AND NEW.push_rule_id IS NULL THEN
    DELETE FROM group_push_rules WHERE group_id = NEW.id;
    RETURN NEW;
  END IF;

  IF NEW.push_rule_id IS NOT NULL AND (OLD.push_rule_id IS NULL OR OLD.push_rule_id != NEW.push_rule_id) THEN
    SELECT * INTO push_rule FROM push_rules WHERE id = NEW.push_rule_id;

    IF FOUND THEN
      INSERT INTO group_push_rules (
        group_id,
        max_file_size,
        member_check,
        prevent_secrets,
        commit_committer_name_check,
        deny_delete_tag,
        reject_unsigned_commits,
        commit_committer_check,
        reject_non_dco_commits,
        commit_message_regex,
        branch_name_regex,
        commit_message_negative_regex,
        author_email_regex,
        file_name_regex,
        created_at,
        updated_at
      ) VALUES (
        NEW.id,
        push_rule.max_file_size,
        push_rule.member_check,
        push_rule.prevent_secrets,
        push_rule.commit_committer_name_check,
        push_rule.deny_delete_tag,
        push_rule.reject_unsigned_commits,
        push_rule.commit_committer_check,
        push_rule.reject_non_dco_commits,
        push_rule.commit_message_regex,
        push_rule.branch_name_regex,
        push_rule.commit_message_negative_regex,
        push_rule.author_email_regex,
        push_rule.file_name_regex,
        push_rule.created_at,
        push_rule.updated_at
      )
      ON CONFLICT (group_id) DO UPDATE SET
        max_file_size = push_rule.max_file_size,
        member_check = push_rule.member_check,
        prevent_secrets = push_rule.prevent_secrets,
        reject_unsigned_commits = push_rule.reject_unsigned_commits,
        commit_committer_check = push_rule.commit_committer_check,
        deny_delete_tag = push_rule.deny_delete_tag,
        reject_non_dco_commits = push_rule.reject_non_dco_commits,
        commit_committer_name_check = push_rule.commit_committer_name_check,
        commit_message_regex = push_rule.commit_message_regex,
        branch_name_regex = push_rule.branch_name_regex,
        commit_message_negative_regex = push_rule.commit_message_negative_regex,
        author_email_regex = push_rule.author_email_regex,
        file_name_regex = push_rule.file_name_regex,
        updated_at = push_rule.updated_at;
    END IF;
  END IF;

  RETURN NEW;
END;
$$;

CREATE FUNCTION sync_organization_push_rules_on_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
  BEGIN
    IF (OLD.organization_id IS NOT NULL AND OLD.is_sample = true) THEN
      DELETE FROM organization_push_rules WHERE organization_id = OLD.organization_id;
    END IF;
    RETURN OLD;
  END;
$$;

CREATE FUNCTION sync_organization_push_rules_on_insert_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
 BEGIN
    IF (NEW.organization_id IS NOT NULL AND NEW.is_sample = TRUE) THEN
      INSERT INTO organization_push_rules (
        organization_id,
        max_file_size,
        member_check,
        prevent_secrets,
        reject_unsigned_commits,
        commit_committer_check,
        deny_delete_tag,
        reject_non_dco_commits,
        commit_committer_name_check,
        commit_message_regex,
        branch_name_regex,
        commit_message_negative_regex,
        author_email_regex,
        file_name_regex,
        created_at,
        updated_at
      ) VALUES (
        NEW.organization_id,
        NEW.max_file_size,
        NEW.member_check,
        NEW.prevent_secrets,
        NEW.reject_unsigned_commits,
        NEW.commit_committer_check,
        NEW.deny_delete_tag,
        NEW.reject_non_dco_commits,
        NEW.commit_committer_name_check,
        NEW.commit_message_regex,
        NEW.branch_name_regex,
        NEW.commit_message_negative_regex,
        NEW.author_email_regex,
        NEW.file_name_regex,
        NEW.created_at,
        NEW.updated_at
      )
      ON CONFLICT (organization_id) DO UPDATE SET
        max_file_size = NEW.max_file_size,
        member_check = NEW.member_check,
        prevent_secrets = NEW.prevent_secrets,
        reject_unsigned_commits = NEW.reject_unsigned_commits,
        commit_committer_check = NEW.commit_committer_check,
        deny_delete_tag = NEW.deny_delete_tag,
        reject_non_dco_commits = NEW.reject_non_dco_commits,
        commit_committer_name_check = NEW.commit_committer_name_check,
        commit_message_regex = NEW.commit_message_regex,
        branch_name_regex = NEW.branch_name_regex,
        commit_message_negative_regex = NEW.commit_message_negative_regex,
        author_email_regex = NEW.author_email_regex,
        file_name_regex = NEW.file_name_regex,
        updated_at = NEW.updated_at;
    END IF;
   RETURN NEW;
  END;
 $$;

CREATE FUNCTION sync_packages_composer_with_composer_metadata() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE "packages_composer_packages"
    SET target_sha = NEW.target_sha,
        composer_json = NEW.composer_json,
        version_cache_sha = NEW.version_cache_sha
    WHERE id = NEW.package_id;
RETURN NULL;

END
$$;

CREATE FUNCTION sync_packages_composer_with_packages() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF (COALESCE(NEW.package_type, OLD.package_type) = 6) THEN
  IF (TG_OP = 'INSERT') THEN
    INSERT INTO "packages_composer_packages" (id, project_id, created_at, updated_at, name, version, creator_id, status, last_downloaded_at, status_message)
      VALUES (NEW.id, NEW.project_id, NEW.created_at, NEW.updated_at, NEW.name, NEW.version, NEW.creator_id, NEW.status, NEW.last_downloaded_at, NEW.status_message);
  ELSIF (TG_OP = 'UPDATE') THEN
    UPDATE "packages_composer_packages"
        SET project_id = NEW.project_id,
            updated_at = NEW.updated_at,
            name = NEW.name,
            version = NEW.version,
            creator_id = NEW.creator_id,
            status = NEW.status,
            last_downloaded_at = NEW.last_downloaded_at,
            status_message = NEW.status_message
        WHERE id = OLD.id;
  ELSIF (TG_OP = 'DELETE') THEN
    DELETE FROM "packages_composer_packages" WHERE id = OLD.id;
  END IF;
END IF;
RETURN NULL;

END
$$;

CREATE FUNCTION sync_project_authorizations_to_migration_table() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN
  INSERT INTO project_authorizations_for_migration (project_id, user_id, access_level)
  VALUES (NEW.project_id, NEW.user_id, NEW.access_level::smallint)
  ON CONFLICT (project_id, user_id) DO UPDATE
    SET access_level = NEW.access_level::smallint;
  RETURN NEW;

ELSIF (TG_OP = 'DELETE') THEN
  DELETE FROM project_authorizations_for_migration
  WHERE project_id = OLD.project_id AND user_id = OLD.user_id;
  RETURN OLD;
END IF;

RETURN NULL;

END
$$;

CREATE FUNCTION sync_push_rules_to_group_push_rules() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  UPDATE group_push_rules
  SET
    max_file_size = NEW.max_file_size,
    member_check = NEW.member_check,
    prevent_secrets = NEW.prevent_secrets,
    commit_committer_name_check = NEW.commit_committer_name_check,
    deny_delete_tag = NEW.deny_delete_tag,
    reject_unsigned_commits = NEW.reject_unsigned_commits,
    commit_committer_check = NEW.commit_committer_check,
    reject_non_dco_commits = NEW.reject_non_dco_commits,
    commit_message_regex = NEW.commit_message_regex,
    branch_name_regex = NEW.branch_name_regex,
    commit_message_negative_regex = NEW.commit_message_negative_regex,
    author_email_regex = NEW.author_email_regex,
    file_name_regex = NEW.file_name_regex,
    updated_at = NEW.updated_at
  FROM namespaces
  WHERE
    namespaces.push_rule_id = NEW.id
    AND namespaces.type = 'Group'
    AND group_push_rules.group_id = namespaces.id;

  RETURN NEW;
END;
$$;

CREATE FUNCTION sync_redirect_routes_namespace_id() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."source_type" = 'Namespace' THEN
  NEW."namespace_id" = NEW."source_id";
ELSIF NEW."source_type" = 'Project' THEN
  NEW."namespace_id" = (SELECT project_namespace_id FROM projects WHERE id = NEW.source_id);
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION table_sync_function_40ecbfb353() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF (TG_OP = 'DELETE') THEN
  DELETE FROM uploads_9ba88c4165 where "id" = OLD."id";
ELSIF (TG_OP = 'UPDATE') THEN
  UPDATE uploads_9ba88c4165
  SET "size" = NEW."size",
    "model_id" = NEW."model_id",
    "uploaded_by_user_id" = NEW."uploaded_by_user_id",
    "organization_id" = NEW."organization_id",
    "namespace_id" = NEW."namespace_id",
    "project_id" = NEW."project_id",
    "created_at" = NEW."created_at",
    "store" = NEW."store",
    "version" = NEW."version",
    "path" = NEW."path",
    "checksum" = NEW."checksum",
    "model_type" = NEW."model_type",
    "uploader" = NEW."uploader",
    "mount_point" = NEW."mount_point",
    "secret" = NEW."secret"
  WHERE uploads_9ba88c4165."id" = NEW."id";
ELSIF (TG_OP = 'INSERT') THEN
  INSERT INTO uploads_9ba88c4165 ("id",
    "size",
    "model_id",
    "uploaded_by_user_id",
    "organization_id",
    "namespace_id",
    "project_id",
    "created_at",
    "store",
    "version",
    "path",
    "checksum",
    "model_type",
    "uploader",
    "mount_point",
    "secret")
  VALUES (NEW."id",
    NEW."size",
    NEW."model_id",
    NEW."uploaded_by_user_id",
    NEW."organization_id",
    NEW."namespace_id",
    NEW."project_id",
    NEW."created_at",
    NEW."store",
    NEW."version",
    NEW."path",
    NEW."checksum",
    NEW."model_type",
    NEW."uploader",
    NEW."mount_point",
    NEW."secret");
END IF;
RETURN NULL;

END
$$;

COMMENT ON FUNCTION table_sync_function_40ecbfb353() IS 'Partitioning migration: table sync for uploads table';

CREATE FUNCTION table_sync_function_d452a5847a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF (TG_OP = 'DELETE') THEN
  DELETE FROM sent_notifications_7abbf02cb6 where "id" = OLD."id";
ELSIF (TG_OP = 'UPDATE') THEN
  UPDATE sent_notifications_7abbf02cb6
  SET "project_id" = NEW."project_id",
    "noteable_id" = NEW."noteable_id",
    "noteable_type" = NEW."noteable_type",
    "recipient_id" = NEW."recipient_id",
    "commit_id" = NEW."commit_id",
    "reply_key" = NEW."reply_key",
    "in_reply_to_discussion_id" = NEW."in_reply_to_discussion_id",
    "issue_email_participant_id" = NEW."issue_email_participant_id",
    "namespace_id" = NEW."namespace_id",
    "created_at" = NEW."created_at"
  WHERE sent_notifications_7abbf02cb6."id" = NEW."id";
ELSIF (TG_OP = 'INSERT') THEN
  INSERT INTO sent_notifications_7abbf02cb6 ("project_id",
    "noteable_id",
    "noteable_type",
    "recipient_id",
    "commit_id",
    "reply_key",
    "in_reply_to_discussion_id",
    "id",
    "issue_email_participant_id",
    "namespace_id",
    "created_at")
  VALUES (NEW."project_id",
    NEW."noteable_id",
    NEW."noteable_type",
    NEW."recipient_id",
    NEW."commit_id",
    NEW."reply_key",
    NEW."in_reply_to_discussion_id",
    NEW."id",
    NEW."issue_email_participant_id",
    NEW."namespace_id",
    NEW."created_at");
END IF;
RETURN NULL;

END
$$;

COMMENT ON FUNCTION table_sync_function_d452a5847a() IS 'Partitioning migration: table sync for sent_notifications table';

CREATE FUNCTION timestamp_coalesce(t1 timestamp with time zone, t2 anyelement) RETURNS timestamp without time zone
    LANGUAGE plpgsql IMMUTABLE
    AS $$
BEGIN
  RETURN COALESCE(t1::TIMESTAMP, t2);
END;
$$;

CREATE FUNCTION trigger_009314eae986() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."protected_branch_project_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_01b3fc052119() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_02450faab875() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_occurrences"
  WHERE "vulnerability_occurrences"."id" = NEW."occurrence_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_038fe84feff7() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_05cc4448a8aa() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."protected_branch_namespace_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_05ce163deddf() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0a1b0adcf686() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_debian_project_distributions"
  WHERE "packages_debian_project_distributions"."id" = NEW."distribution_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0a29d4d42b62() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "approval_project_rules"
  WHERE "approval_project_rules"."id" = NEW."approval_project_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0aea02e5a699() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."protected_branch_project_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0af180e1ec89() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_debian_project_components"
  WHERE "packages_debian_project_components"."id" = NEW."component_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0c326daf67cf() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."namespace_id"
  FROM "analytics_cycle_analytics_group_value_streams"
  WHERE "analytics_cycle_analytics_group_value_streams"."id" = NEW."value_stream_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0d96daa4d734() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "bulk_import_exports"
  WHERE "bulk_import_exports"."id" = NEW."export_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0da002390fdc() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "operations_feature_flags"
  WHERE "operations_feature_flags"."id" = NEW."feature_flag_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0ddb594934c9() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "incident_management_oncall_rotations"
  WHERE "incident_management_oncall_rotations"."id" = NEW."oncall_rotation_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0e13f214e504() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_0f38e5af9adf() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ml_candidates"
  WHERE "ml_candidates"."id" = NEW."candidate_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_13d4aa8fe3dd() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_14a39509be0a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_1513378d715d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_158ac875f254() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "approval_group_rules"
  WHERE "approval_group_rules"."id" = NEW."approval_group_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_174b23fa3dfb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "approval_project_rules"
  WHERE "approval_project_rules"."id" = NEW."approval_project_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_18bc439a6741() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_1c0f1ca199a3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ci_resource_groups"
  WHERE "ci_resource_groups"."id" = NEW."resource_group_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_1ed40f4d5f4e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_1eda1bc6ef53() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "merge_request_diffs"
  WHERE "merge_request_diffs"."id" = NEW."merge_request_diff_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_1f57c71a69fb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."snippet_organization_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_206cbe2dc1a2() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_207005e8e995() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "operations_feature_flags"
  WHERE "operations_feature_flags"."id" = NEW."feature_flag_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_218433b4faa5() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_package_files"
  WHERE "packages_package_files"."id" = NEW."package_file_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_219952df8fc4() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."blocking_merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_22262f5f16d8() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."author_id_convert_to_bigint" := NEW."author_id";
  NEW."closed_by_id_convert_to_bigint" := NEW."closed_by_id";
  NEW."duplicated_to_id_convert_to_bigint" := NEW."duplicated_to_id";
  NEW."id_convert_to_bigint" := NEW."id";
  NEW."last_edited_by_id_convert_to_bigint" := NEW."last_edited_by_id";
  NEW."milestone_id_convert_to_bigint" := NEW."milestone_id";
  NEW."moved_to_id_convert_to_bigint" := NEW."moved_to_id";
  NEW."project_id_convert_to_bigint" := NEW."project_id";
  NEW."promoted_to_epic_id_convert_to_bigint" := NEW."promoted_to_epic_id";
  NEW."updated_by_id_convert_to_bigint" := NEW."updated_by_id";
  RETURN NEW;
END;
$$;

CREATE FUNCTION trigger_238f37f25bb2() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "boards_epic_lists"
  WHERE "boards_epic_lists"."id" = NEW."epic_list_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_243aecba8654() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_site_profiles"
  WHERE "dast_site_profiles"."id" = NEW."dast_site_profile_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_248cafd363ff() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_2514245c7fc5() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_site_profiles"
  WHERE "dast_site_profiles"."id" = NEW."dast_site_profile_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_25c44c30884f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."work_item_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_25d35f02ab55() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ml_candidates"
  WHERE "ml_candidates"."id" = NEW."candidate_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_25fe4f7da510() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerabilities"
  WHERE "vulnerabilities"."id" = NEW."vulnerability_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_29128c51c7c6() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_pre_scan_verifications"
  WHERE "dast_pre_scan_verifications"."id" = NEW."dast_pre_scan_verification_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_292097dea85c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "terraform_state_versions"
  WHERE "terraform_state_versions"."id" = NEW."terraform_state_version_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_2a994bb5629f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "alert_management_alerts"
  WHERE "alert_management_alerts"."id" = NEW."alert_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_2b8fdc9b4a4e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ml_experiments"
  WHERE "ml_experiments"."id" = NEW."experiment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_2cb7e7147818() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "notes"
  WHERE "notes"."id" = NEW."note_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_2dafd0d13605() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "pages_domains"
  WHERE "pages_domains"."id" = NEW."pages_domain_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_2e4861e8640c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_package_files"
  WHERE "packages_package_files"."id" = NEW."package_file_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_30209d0fba3e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "alert_management_alerts"
  WHERE "alert_management_alerts"."id" = NEW."alert_management_alert_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_309294c3b889() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."snippet_project_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_363d0fd35f2c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_dependency_links"
  WHERE "packages_dependency_links"."id" = NEW."dependency_link_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3691f9f6a69f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "cluster_agents"
  WHERE "cluster_agents"."id" = NEW."cluster_agent_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_36cb404f9a02() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."organization_id"
  FROM "bulk_import_entities"
  WHERE "bulk_import_entities"."id" = NEW."bulk_import_entity_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_388de55cd36c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "p_ci_builds"
  WHERE "p_ci_builds"."id" = NEW."build_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_38bfee591e40() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "dependency_proxy_blobs"
  WHERE "dependency_proxy_blobs"."id" = NEW."dependency_proxy_blob_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_397d1b13068e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3be1956babdb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."snippet_organization_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3c1a5f58a668() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "incident_management_oncall_rotations"
  WHERE "incident_management_oncall_rotations"."id" = NEW."rotation_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3d1a58344b29() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "alert_management_alerts"
  WHERE "alert_management_alerts"."id" = NEW."alert_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3e067fa9bfe3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "incident_management_timeline_event_tags"
  WHERE "incident_management_timeline_event_tags"."id" = NEW."timeline_event_tag_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3f28a0bfdb16() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_3fe922f4db67() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerabilities"
  WHERE "vulnerabilities"."id" = NEW."vulnerability_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_41eaf23bf547() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "releases"
  WHERE "releases"."id" = NEW."release_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_43484cb41aca() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "project_wiki_repositories"
  WHERE "project_wiki_repositories"."id" = NEW."project_wiki_repository_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_44558add1625() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_44ff19ad0ab2() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_468b8554e533() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_scanners"
  WHERE "vulnerability_scanners"."id" = NEW."scanner_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_46ebe375f632() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_47b402bdab5f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "bulk_import_exports"
  WHERE "bulk_import_exports"."id" = NEW."export_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_49862b4b3035() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "approval_group_rules"
  WHERE "approval_group_rules"."id" = NEW."approval_group_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_49b563d0130b() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_scanner_profiles"
  WHERE "dast_scanner_profiles"."id" = NEW."dast_scanner_profile_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_49e070da6320() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_4ad9a52a6614() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "sbom_occurrences"
  WHERE "sbom_occurrences"."id" = NEW."sbom_occurrence_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_4b43790d717f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_environment_group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."protected_environment_group_id"
  FROM "protected_environments"
  WHERE "protected_environments"."id" = NEW."protected_environment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_4c320a13bc8d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "security_orchestration_policy_configurations"
  WHERE "security_orchestration_policy_configurations"."id" = NEW."security_orchestration_policy_configuration_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_4cc5c3ac4d7f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "bulk_import_exports"
  WHERE "bulk_import_exports"."id" = NEW."export_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_4dc8ec48e038() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_4fc14aa830b1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."work_item_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_54707c384ad7() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "security_orchestration_policy_configurations"
  WHERE "security_orchestration_policy_configurations"."id" = NEW."security_orchestration_policy_configuration_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_56d49f4ed623() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "workspaces"
  WHERE "workspaces"."id" = NEW."workspace_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_57ad2742ac16() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "achievements"
  WHERE "achievements"."id" = NEW."achievement_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_57d53b2ab135() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_589db52d2d69() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_5ca97b87ee30() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_5cf44cd40f22() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "operations_strategies"
  WHERE "operations_strategies"."id" = NEW."strategy_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_5ed68c226e97() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "approval_merge_request_rules"
  WHERE "approval_merge_request_rules"."id" = NEW."approval_merge_request_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_5f6432d2dccc() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "operations_user_lists"
  WHERE "operations_user_lists"."id" = NEW."user_list_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_627949f72f05() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_664594a3d0a7() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_68435a54ee2b() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_debian_project_distributions"
  WHERE "packages_debian_project_distributions"."id" = NEW."distribution_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_6bf50b363152() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "security_orchestration_policy_configurations"
  WHERE "security_orchestration_policy_configurations"."id" = NEW."policy_configuration_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_6c38ba395cc1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "error_tracking_errors"
  WHERE "error_tracking_errors"."id" = NEW."error_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_6cdea9559242() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."source_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_6d6c79ce74e1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_environment_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."protected_environment_project_id"
  FROM "protected_environments"
  WHERE "protected_environments"."id" = NEW."protected_environment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_6fc75a2395f3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_package_files"
  WHERE "packages_package_files"."id" = NEW."package_file_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_700f29b1312e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_70d3f0bba1de() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "security_orchestration_policy_configurations"
  WHERE "security_orchestration_policy_configurations"."id" = NEW."policy_configuration_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_738125833856() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."organization_id"
  FROM "bulk_imports"
  WHERE "bulk_imports"."id" = NEW."bulk_import_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_740afa9807b8() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."organization_id"
  FROM "subscription_add_on_purchases"
  WHERE "subscription_add_on_purchases"."id" = NEW."add_on_purchase_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_744ab45ee5ac() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."protected_branch_namespace_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7495f5e0efcb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."snippet_project_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_765cae42cd77() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."organization_id"
  FROM "bulk_import_entities"
  WHERE "bulk_import_entities"."id" = NEW."bulk_import_entity_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_77d9fbad5b12() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_debian_project_distributions"
  WHERE "packages_debian_project_distributions"."id" = NEW."distribution_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_78c85ddc4031() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7943cb549289() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7a6d75e9eecd() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "project_relation_exports"
  WHERE "project_relation_exports"."id" = NEW."project_relation_export_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7a8b08eed782() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "boards_epic_boards"
  WHERE "boards_epic_boards"."id" = NEW."epic_board_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7b21c87a1f91() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "bulk_import_entities"
  WHERE "bulk_import_entities"."id" = NEW."bulk_import_entity_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7b378a0c402b() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7de792ddbc05() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_site_tokens"
  WHERE "dast_site_tokens"."id" = NEW."dast_site_token_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_7e2eed79e46e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW."assignee_id_convert_to_bigint" := NEW."assignee_id";
  NEW."id_convert_to_bigint" := NEW."id";
  NEW."reporter_id_convert_to_bigint" := NEW."reporter_id";
  NEW."resolved_by_id_convert_to_bigint" := NEW."resolved_by_id";
  NEW."user_id_convert_to_bigint" := NEW."user_id";
  RETURN NEW;
END;
$$;

CREATE FUNCTION trigger_7f84f9c7b945() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "bulk_import_entities"
  WHERE "bulk_import_entities"."id" = NEW."bulk_import_entity_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_80578cfbdaf9() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "events"
  WHERE "events"."id" = NEW."event_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_81b4c93e7133() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "pages_deployments"
  WHERE "pages_deployments"."id" = NEW."pages_deployment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_81b53b626109() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_package_files"
  WHERE "packages_package_files"."id" = NEW."package_file_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8204480b3a2e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "incident_management_escalation_policies"
  WHERE "incident_management_escalation_policies"."id" = NEW."policy_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_84d67ad63e93() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "wiki_page_meta"
  WHERE "wiki_page_meta"."id" = NEW."wiki_page_meta_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_85d89f0f11db() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8a11b103857c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "packages_debian_group_components"
  WHERE "packages_debian_group_components"."id" = NEW."component_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8a38ce2327de() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "epics"
  WHERE "epics"."id" = NEW."epic_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8ac78f164b2d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "projects"
  WHERE "projects"."id" = NEW."project_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8b39d532224c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ci_secure_files"
  WHERE "ci_secure_files"."id" = NEW."ci_secure_file_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8ba074736a77() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."snippet_project_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8cb8ad095bf6() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "bulk_import_entities"
  WHERE "bulk_import_entities"."id" = NEW."bulk_import_entity_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8cf1745cf163() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "design_management_repositories"
  WHERE "design_management_repositories"."id" = NEW."design_management_repository_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8d002f38bdef() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "packages_debian_group_distributions"
  WHERE "packages_debian_group_distributions"."id" = NEW."distribution_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8d17725116fe() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8d661362aa1a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8e66b994e8f0() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."group_id"
  FROM "audit_events_external_audit_event_destinations"
  WHERE "audit_events_external_audit_event_destinations"."id" = NEW."external_audit_event_destination_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_8fbb044c64ad() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "projects"
  WHERE "projects"."id" = NEW."project_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_90fa5c6951f1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_profiles"
  WHERE "dast_profiles"."id" = NEW."dast_profile_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_91e1012b9851() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "merge_request_context_commits"
  WHERE "merge_request_context_commits"."id" = NEW."merge_request_context_commit_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9259aae92378() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_93a5b044f4e8() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."snippet_organization_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_94514aeadc50() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "deployments"
  WHERE "deployments"."id" = NEW."deployment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_951ac22c24d7() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."protected_branch_namespace_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_96298f7da5d3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."protected_branch_project_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9699ea03bb37() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "epics"
  WHERE "epics"."id" = NEW."source_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_96a76ee9f147() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_979e7f45114f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ml_candidates"
  WHERE "ml_candidates"."id" = NEW."candidate_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_97e9245e767d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_98ad3a4c1d35() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "reviews"
  WHERE "reviews"."id" = NEW."review_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9b944f36fdac() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "approval_merge_request_rules"
  WHERE "approval_merge_request_rules"."id" = NEW."approval_merge_request_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9e137c16de79() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_occurrences"
  WHERE "vulnerability_occurrences"."id" = NEW."vulnerability_occurrence_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9e875cabe9c9() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "wiki_page_meta"
  WHERE "wiki_page_meta"."id" = NEW."wiki_page_meta_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9f3745f8fe32() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_9f3de326ea61() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ci_pipeline_schedules"
  WHERE "ci_pipeline_schedules"."id" = NEW."pipeline_schedule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_a1bc7c70cbdf() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerabilities"
  WHERE "vulnerabilities"."id" = NEW."vulnerability_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_a22be47501db() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "group_wiki_repositories"
  WHERE "group_wiki_repositories"."group_id" = NEW."group_wiki_repository_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_a253cb3cacdf() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "environments"
  WHERE "environments"."id" = NEW."environment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_a465de38164e() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "p_ci_job_artifacts"
  WHERE "p_ci_job_artifacts"."id" = NEW."job_artifact_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_a4e4fb2451d9() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "epics"
  WHERE "epics"."id" = NEW."epic_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_a7e0fb195210() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_occurrences"
  WHERE "vulnerability_occurrences"."id" = NEW."vulnerability_occurrence_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_af3f17817e4d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "protected_tags"
  WHERE "protected_tags"."id" = NEW."protected_tag_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b046dd50c711() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "incident_management_oncall_schedules"
  WHERE "incident_management_oncall_schedules"."id" = NEW."oncall_schedule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b0f4298cadff() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."protected_branch_project_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b2612138515d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "project_export_jobs"
  WHERE "project_export_jobs"."id" = NEW."project_export_job_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b4520c29ea74() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "approval_project_rules"
  WHERE "approval_project_rules"."id" = NEW."approval_project_rule_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b75e5731e305() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_profiles"
  WHERE "dast_profiles"."id" = NEW."dast_profile_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b7abb8fc4cf0() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b83b7e51e2f5() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "security_orchestration_policy_configurations"
  WHERE "security_orchestration_policy_configurations"."id" = NEW."security_orchestration_policy_configuration_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_b8eecea7f351() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "dependency_proxy_manifests"
  WHERE "dependency_proxy_manifests"."id" = NEW."dependency_proxy_manifest_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c17a166692a2() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."group_id"
  FROM "audit_events_external_audit_event_destinations"
  WHERE "audit_events_external_audit_event_destinations"."id" = NEW."external_audit_event_destination_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c52d215d50a1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c59fe6f31e71() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "security_orchestration_policy_configurations"
  WHERE "security_orchestration_policy_configurations"."id" = NEW."security_orchestration_policy_configuration_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c5eec113ea76() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "dast_profiles"
  WHERE "dast_profiles"."id" = NEW."dast_profile_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c6728503decb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "design_management_designs"
  WHERE "design_management_designs"."id" = NEW."design_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c8bc8646bce9() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerabilities"
  WHERE "vulnerabilities"."id" = NEW."vulnerability_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_c9090feed334() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "boards_epic_boards"
  WHERE "boards_epic_boards"."id" = NEW."epic_board_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_cac7c0698291() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "releases"
  WHERE "releases"."id" = NEW."release_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_cd50823537a3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_cdfa6500a121() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_organization_id" IS NULL THEN
  SELECT "organization_id"
  INTO NEW."snippet_organization_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_cf646a118cbb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "releases"
  WHERE "releases"."id" = NEW."release_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_cfbec3f07e2b() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "deployments"
  WHERE "deployments"."id" = NEW."deployment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_d4487a75bd44() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "terraform_states"
  WHERE "terraform_states"."id" = NEW."terraform_state_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_d5c895007948() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_environment_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."protected_environment_project_id"
  FROM "protected_environments"
  WHERE "protected_environments"."id" = NEW."protected_environment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_d8c2de748d8c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "target_project_id"
  INTO NEW."project_id"
  FROM "merge_requests"
  WHERE "merge_requests"."id" = NEW."merge_request_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_d9468bfbb0b4() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."snippet_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."snippet_project_id"
  FROM "snippets"
  WHERE "snippets"."id" = NEW."snippet_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_da5fd3d6d75c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_dadd660afe2c() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "packages_debian_group_distributions"
  WHERE "packages_debian_group_distributions"."id" = NEW."distribution_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_dbdd61a66a91() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."agent_project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."agent_project_id"
  FROM "cluster_agents"
  WHERE "cluster_agents"."id" = NEW."agent_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_dbe374a57cbb() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_dc13168b8025() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_occurrences"
  WHERE "vulnerability_occurrences"."id" = NEW."vulnerability_occurrence_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_de59b81d3044() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "bulk_import_exports"
  WHERE "bulk_import_exports"."id" = NEW."export_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_dfad97659d5f() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_e0864d1cff37() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "packages_debian_group_distributions"
  WHERE "packages_debian_group_distributions"."id" = NEW."distribution_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_e1da4a738230() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerabilities"
  WHERE "vulnerabilities"."id" = NEW."vulnerability_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_e49ab4d904a0() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_occurrences"
  WHERE "vulnerability_occurrences"."id" = NEW."vulnerability_occurrence_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_e4a6cde57b42() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_e815625b59fa() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_ebab34f83f1d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "packages_packages"
  WHERE "packages_packages"."id" = NEW."package_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_ec1934755627() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "alert_management_alerts"
  WHERE "alert_management_alerts"."id" = NEW."alert_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_ed554313ca66() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_branch_namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."protected_branch_namespace_id"
  FROM "protected_branches"
  WHERE "protected_branches"."id" = NEW."protected_branch_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_eeb25d23ab2d() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "bulk_import_entities"
  WHERE "bulk_import_entities"."id" = NEW."bulk_import_entity_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_efb9d354f05a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "issues"
  WHERE "issues"."id" = NEW."issue_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_eff80ead42ac() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ci_unit_tests"
  WHERE "ci_unit_tests"."id" = NEW."unit_test_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_f6c61cdddf31() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "ml_models"
  WHERE "ml_models"."id" = NEW."model_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_f6f59d8216b3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."protected_environment_group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."protected_environment_group_id"
  FROM "protected_environments"
  WHERE "protected_environments"."id" = NEW."protected_environment_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_fac444e0cae6() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."namespace_id" IS NULL THEN
  SELECT "namespace_id"
  INTO NEW."namespace_id"
  FROM "design_management_designs"
  WHERE "design_management_designs"."id" = NEW."design_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_fbd42ed69453() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "external_status_checks"
  WHERE "external_status_checks"."id" = NEW."external_status_check_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_fbd8825b3057() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."group_id" IS NULL THEN
  SELECT "group_id"
  INTO NEW."group_id"
  FROM "boards_epic_boards"
  WHERE "boards_epic_boards"."id" = NEW."epic_board_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_fd4a1be98713() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "container_repositories"
  WHERE "container_repositories"."id" = NEW."container_repository_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION trigger_fff8735b6b9a() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
IF NEW."project_id" IS NULL THEN
  SELECT "project_id"
  INTO NEW."project_id"
  FROM "vulnerability_occurrences"
  WHERE "vulnerability_occurrences"."id" = NEW."finding_id";
END IF;

RETURN NEW;

END
$$;

CREATE FUNCTION unset_has_issues_on_vulnerability_reads() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
  has_issue_links integer;
BEGIN
  PERFORM 1
  FROM
    vulnerability_reads
  WHERE
    vulnerability_id = OLD.vulnerability_id
  FOR UPDATE;

  SELECT 1 INTO has_issue_links FROM vulnerability_issue_links WHERE vulnerability_id = OLD.vulnerability_id LIMIT 1;

  IF (has_issue_links = 1) THEN
    RETURN NULL;
  END IF;

  UPDATE
    vulnerability_reads
  SET
    has_issues = false
  WHERE
    vulnerability_id = OLD.vulnerability_id;

  RETURN NULL;
END
$$;

CREATE FUNCTION unset_has_merge_request_on_vulnerability_reads() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
  has_merge_request_links integer;
BEGIN
  PERFORM 1
  FROM
    vulnerability_reads
  WHERE
    vulnerability_id = OLD.vulnerability_id
  FOR UPDATE;

  SELECT 1 INTO has_merge_request_links FROM vulnerability_merge_request_links WHERE vulnerability_id = OLD.vulnerability_id LIMIT 1;

  IF (has_merge_request_links = 1) THEN
    RETURN NULL;
  END IF;

  UPDATE
    vulnerability_reads
  SET
    has_merge_request = false
  WHERE
    vulnerability_id = OLD.vulnerability_id;

  RETURN NULL;
END
$$;

CREATE FUNCTION update_location_from_vulnerability_occurrences() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE
  vulnerability_reads
SET
  location_image = NEW.location->>'image',
  casted_cluster_agent_id = CAST(NEW.location->'kubernetes_resource'->>'agent_id' AS bigint),
  cluster_agent_id = NEW.location->'kubernetes_resource'->>'agent_id'
WHERE
  vulnerability_id = NEW.vulnerability_id;
RETURN NULL;

END
$$;

CREATE FUNCTION update_namespace_details_from_namespaces() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
INSERT INTO
  namespace_details (
    description,
    description_html,
    cached_markdown_version,
    updated_at,
    created_at,
    namespace_id
  )
VALUES
  (
    NEW.description,
    NEW.description_html,
    NEW.cached_markdown_version,
    NEW.updated_at,
    NEW.updated_at,
    NEW.id
  ) ON CONFLICT (namespace_id) DO
UPDATE
SET
  description = NEW.description,
  description_html = NEW.description_html,
  cached_markdown_version = NEW.cached_markdown_version,
  updated_at = NEW.updated_at
WHERE
  namespace_details.namespace_id = NEW.id;RETURN NULL;

END
$$;

CREATE FUNCTION update_namespace_details_from_projects() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
INSERT INTO
  namespace_details (
    description,
    description_html,
    cached_markdown_version,
    updated_at,
    created_at,
    namespace_id
  )
VALUES
  (
    NEW.description,
    NEW.description_html,
    NEW.cached_markdown_version,
    NEW.updated_at,
    NEW.updated_at,
    NEW.project_namespace_id
  ) ON CONFLICT (namespace_id) DO
UPDATE
SET
  description = NEW.description,
  description_html = NEW.description_html,
  cached_markdown_version = NEW.cached_markdown_version,
  updated_at = NEW.updated_at
WHERE
  namespace_details.namespace_id = NEW.project_namespace_id;RETURN NULL;

END
$$;

CREATE FUNCTION update_vulnerability_reads_from_vulnerability() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
UPDATE
  vulnerability_reads
SET
  severity = NEW.severity,
  state = NEW.state,
  resolved_on_default_branch = NEW.resolved_on_default_branch,
  auto_resolved = NEW.auto_resolved
WHERE vulnerability_id = NEW.id;
RETURN NULL;

END
$$;

CREATE TABLE ai_code_suggestion_events (
    id bigint NOT NULL,
    "timestamp" timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    event smallint NOT NULL,
    namespace_path text,
    payload jsonb,
    CONSTRAINT check_ba9ae3f258 CHECK ((char_length(namespace_path) <= 255))
)
PARTITION BY RANGE ("timestamp");

CREATE TABLE ai_duo_chat_events (
    id bigint NOT NULL,
    "timestamp" timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    personal_namespace_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    event smallint NOT NULL,
    namespace_path text,
    payload jsonb,
    organization_id bigint,
    CONSTRAINT check_628cdfbf3f CHECK ((char_length(namespace_path) <= 255)),
    CONSTRAINT check_f759f45177 CHECK ((organization_id IS NOT NULL))
)
PARTITION BY RANGE ("timestamp");

CREATE TABLE ai_troubleshoot_job_events (
    id bigint NOT NULL,
    "timestamp" timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    job_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    event smallint NOT NULL,
    namespace_path text,
    payload jsonb,
    CONSTRAINT check_29d6dbc329 CHECK ((char_length(namespace_path) <= 255))
)
PARTITION BY RANGE ("timestamp");

CREATE TABLE ai_usage_events (
    id bigint NOT NULL,
    "timestamp" timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    event smallint NOT NULL,
    extras jsonb DEFAULT '{}'::jsonb NOT NULL,
    namespace_id bigint
)
PARTITION BY RANGE ("timestamp");

CREATE TABLE audit_events (
    id bigint NOT NULL,
    author_id bigint NOT NULL,
    entity_id bigint NOT NULL,
    entity_type character varying NOT NULL,
    details text,
    ip_address inet,
    author_name text,
    entity_path text,
    target_details text,
    created_at timestamp without time zone NOT NULL,
    target_type text,
    target_id bigint,
    CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)),
    CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)),
    CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)),
    CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500))
)
PARTITION BY RANGE (created_at);

CREATE TABLE batched_background_migration_job_transition_logs (
    id bigint NOT NULL,
    batched_background_migration_job_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    previous_status smallint NOT NULL,
    next_status smallint NOT NULL,
    exception_class text,
    exception_message text,
    CONSTRAINT check_50e580811a CHECK ((char_length(exception_message) <= 1000)),
    CONSTRAINT check_76e202c37a CHECK ((char_length(exception_class) <= 100))
)
PARTITION BY RANGE (created_at);

CREATE TABLE p_ci_build_names (
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    search_vector tsvector GENERATED ALWAYS AS (to_tsvector('english'::regconfig, COALESCE(name, ''::text))) STORED,
    CONSTRAINT check_1722c96346 CHECK ((char_length(name) <= 255))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_build_sources (
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL,
    source smallint,
    pipeline_source smallint
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_build_tags (
    id bigint NOT NULL,
    tag_id bigint NOT NULL,
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_build_trace_metadata (
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    trace_artifact_id bigint,
    last_archival_attempt_at timestamp with time zone,
    archived_at timestamp with time zone,
    archival_attempts smallint DEFAULT 0 NOT NULL,
    checksum bytea,
    remote_checksum bytea,
    project_id bigint
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_builds (
    status character varying,
    finished_at timestamp without time zone,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    started_at timestamp without time zone,
    coverage double precision,
    name character varying,
    options text,
    allow_failure boolean DEFAULT false NOT NULL,
    stage_idx integer,
    tag boolean,
    ref character varying,
    type character varying,
    target_url character varying,
    description character varying,
    erased_at timestamp without time zone,
    artifacts_expire_at timestamp without time zone,
    environment character varying,
    "when" character varying,
    yaml_variables text,
    queued_at timestamp without time zone,
    lock_version integer DEFAULT 0,
    coverage_regex character varying,
    retried boolean,
    protected boolean,
    failure_reason integer,
    scheduled_at timestamp with time zone,
    token_encrypted character varying,
    resource_group_id bigint,
    waiting_for_resource_at timestamp with time zone,
    processed boolean,
    scheduling_type smallint,
    id bigint NOT NULL,
    stage_id bigint,
    partition_id bigint NOT NULL,
    auto_canceled_by_partition_id bigint,
    auto_canceled_by_id bigint,
    commit_id bigint,
    erased_by_id bigint,
    project_id bigint,
    runner_id bigint,
    upstream_pipeline_id bigint,
    user_id bigint,
    execution_config_id bigint,
    upstream_pipeline_partition_id bigint,
    CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)),
    CONSTRAINT check_9aa9432137 CHECK ((project_id IS NOT NULL))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_builds_execution_configs (
    id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL,
    pipeline_id bigint NOT NULL,
    run_steps jsonb DEFAULT '{}'::jsonb NOT NULL
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_builds_metadata (
    project_id bigint NOT NULL,
    timeout integer,
    timeout_source integer DEFAULT 1 NOT NULL,
    interruptible boolean,
    config_options jsonb,
    config_variables jsonb,
    has_exposed_artifacts boolean,
    environment_auto_stop_in character varying(255),
    expanded_environment_name character varying(255),
    secrets jsonb DEFAULT '{}'::jsonb NOT NULL,
    build_id bigint NOT NULL,
    id bigint NOT NULL,
    id_tokens jsonb DEFAULT '{}'::jsonb NOT NULL,
    partition_id bigint NOT NULL,
    debug_trace_enabled boolean DEFAULT false NOT NULL,
    exit_code smallint
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_job_annotations (
    id bigint NOT NULL,
    partition_id bigint NOT NULL,
    job_id bigint NOT NULL,
    name text NOT NULL,
    data jsonb DEFAULT '[]'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_375bb9900a CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_bac9224e45 CHECK ((char_length(name) <= 255)),
    CONSTRAINT data_is_array CHECK ((jsonb_typeof(data) = 'array'::text))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_job_artifact_reports (
    job_artifact_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL,
    status smallint NOT NULL,
    validation_error text,
    CONSTRAINT check_1c55aee894 CHECK ((char_length(validation_error) <= 255))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_job_artifacts (
    project_id bigint NOT NULL,
    file_type integer NOT NULL,
    size bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    expire_at timestamp with time zone,
    file character varying,
    file_store integer DEFAULT 1,
    file_sha256 bytea,
    file_format smallint,
    file_location smallint,
    id bigint NOT NULL,
    job_id bigint NOT NULL,
    locked smallint DEFAULT 2,
    partition_id bigint NOT NULL,
    accessibility smallint DEFAULT 0 NOT NULL,
    file_final_path text,
    exposed_as text,
    exposed_paths text[],
    CONSTRAINT check_27f0f6dbab CHECK ((file_store IS NOT NULL)),
    CONSTRAINT check_9f04410cf4 CHECK ((char_length(file_final_path) <= 1024))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_job_inputs (
    id bigint NOT NULL,
    job_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL,
    input_type smallint DEFAULT 0 NOT NULL,
    sensitive boolean DEFAULT false NOT NULL,
    name text NOT NULL,
    value jsonb,
    CONSTRAINT check_007134e1cd CHECK ((char_length(name) <= 255))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_pipeline_variables (
    key character varying NOT NULL,
    value text,
    encrypted_value text,
    encrypted_value_salt character varying,
    encrypted_value_iv character varying,
    variable_type smallint DEFAULT 1 NOT NULL,
    partition_id bigint NOT NULL,
    raw boolean DEFAULT false NOT NULL,
    id bigint NOT NULL,
    pipeline_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_6e932dbabf CHECK ((project_id IS NOT NULL))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_pipelines (
    ref character varying,
    sha character varying,
    before_sha character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    tag boolean DEFAULT false,
    yaml_errors text,
    committed_at timestamp without time zone,
    project_id bigint,
    status character varying,
    started_at timestamp without time zone,
    finished_at timestamp without time zone,
    duration integer,
    user_id bigint,
    lock_version integer DEFAULT 0,
    pipeline_schedule_id bigint,
    source integer,
    config_source integer,
    protected boolean,
    failure_reason integer,
    iid integer,
    merge_request_id bigint,
    source_sha bytea,
    target_sha bytea,
    external_pull_request_id bigint,
    ci_ref_id bigint,
    locked smallint DEFAULT 1 NOT NULL,
    partition_id bigint NOT NULL,
    id bigint NOT NULL,
    auto_canceled_by_id bigint,
    auto_canceled_by_partition_id bigint,
    trigger_id bigint,
    CONSTRAINT check_2ba2a044b9 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_d7e99a025e CHECK ((lock_version IS NOT NULL))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_runner_machine_builds (
    partition_id bigint NOT NULL,
    build_id bigint NOT NULL,
    runner_machine_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_149ee35c38 CHECK ((project_id IS NOT NULL))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_stages (
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    name character varying,
    status integer,
    lock_version integer DEFAULT 0,
    "position" integer,
    id bigint NOT NULL,
    partition_id bigint NOT NULL,
    pipeline_id bigint,
    CONSTRAINT check_74835fc631 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_81b431e49b CHECK ((lock_version IS NOT NULL))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_workloads (
    id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint NOT NULL,
    pipeline_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    branch_name text,
    CONSTRAINT check_f2fe503728 CHECK ((char_length(branch_name) <= 255))
)
PARTITION BY LIST (partition_id);

CREATE SEQUENCE shared_audit_event_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

CREATE TABLE group_audit_events (
    id bigint DEFAULT nextval('shared_audit_event_id_seq'::regclass) NOT NULL,
    created_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    author_id bigint NOT NULL,
    target_id bigint,
    event_name text,
    details text,
    ip_address inet,
    author_name text,
    entity_path text,
    target_details text,
    target_type text,
    CONSTRAINT group_audit_events_author_name_check CHECK ((char_length(author_name) <= 255)),
    CONSTRAINT group_audit_events_entity_path_check CHECK ((char_length(entity_path) <= 5500)),
    CONSTRAINT group_audit_events_event_name_check CHECK ((char_length(event_name) <= 255)),
    CONSTRAINT group_audit_events_target_details_check CHECK ((char_length(target_details) <= 5500)),
    CONSTRAINT group_audit_events_target_type_check CHECK ((char_length(target_type) <= 255))
)
PARTITION BY RANGE (created_at);

CREATE TABLE groups_visits (
    id bigint NOT NULL,
    entity_id bigint NOT NULL,
    user_id bigint NOT NULL,
    visited_at timestamp with time zone NOT NULL
)
PARTITION BY RANGE (visited_at);

CREATE TABLE incident_management_pending_alert_escalations (
    id bigint NOT NULL,
    rule_id bigint NOT NULL,
    alert_id bigint NOT NULL,
    process_at timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_0012942e48 CHECK ((project_id IS NOT NULL))
)
PARTITION BY RANGE (process_at);

CREATE TABLE incident_management_pending_issue_escalations (
    id bigint NOT NULL,
    rule_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    process_at timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_dff22b638a CHECK ((namespace_id IS NOT NULL))
)
PARTITION BY RANGE (process_at);

CREATE TABLE instance_audit_events (
    id bigint DEFAULT nextval('shared_audit_event_id_seq'::regclass) NOT NULL,
    created_at timestamp with time zone NOT NULL,
    author_id bigint NOT NULL,
    target_id bigint,
    event_name text,
    details text,
    ip_address inet,
    author_name text,
    entity_path text,
    target_details text,
    target_type text,
    CONSTRAINT instance_audit_events_author_name_check CHECK ((char_length(author_name) <= 255)),
    CONSTRAINT instance_audit_events_entity_path_check CHECK ((char_length(entity_path) <= 5500)),
    CONSTRAINT instance_audit_events_event_name_check CHECK ((char_length(event_name) <= 255)),
    CONSTRAINT instance_audit_events_target_details_check CHECK ((char_length(target_details) <= 5500)),
    CONSTRAINT instance_audit_events_target_type_check CHECK ((char_length(target_type) <= 255))
)
PARTITION BY RANGE (created_at);

CREATE TABLE loose_foreign_keys_deleted_records (
    id bigint NOT NULL,
    partition bigint DEFAULT 1 NOT NULL,
    primary_key_value bigint NOT NULL,
    status smallint DEFAULT 1 NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    fully_qualified_table_name text NOT NULL,
    consume_after timestamp with time zone DEFAULT now(),
    cleanup_attempts smallint DEFAULT 0,
    CONSTRAINT check_1a541f3235 CHECK ((char_length(fully_qualified_table_name) <= 150))
)
PARTITION BY LIST (partition);

CREATE TABLE merge_request_commits_metadata (
    authored_date timestamp without time zone,
    committed_date timestamp without time zone,
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    commit_author_id bigint NOT NULL,
    committer_id bigint NOT NULL,
    sha bytea NOT NULL,
    message text,
    trailers jsonb DEFAULT '{}'::jsonb NOT NULL
)
PARTITION BY RANGE (project_id);

CREATE TABLE p_ai_active_context_code_enabled_namespaces (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    connection_id bigint NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
)
PARTITION BY RANGE (namespace_id);

CREATE TABLE p_ai_active_context_code_repositories (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    connection_id bigint,
    enabled_namespace_id bigint,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    last_commit text,
    state smallint DEFAULT 0 NOT NULL,
    indexed_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_b253d453c7 CHECK ((char_length(last_commit) <= 64))
)
PARTITION BY RANGE (project_id);

CREATE TABLE p_batched_git_ref_updates_deletions (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    partition_id bigint DEFAULT 1 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 1 NOT NULL,
    ref text NOT NULL,
    CONSTRAINT check_f322d53b92 CHECK ((char_length(ref) <= 1024))
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_catalog_resource_sync_events (
    id bigint NOT NULL,
    catalog_resource_id bigint NOT NULL,
    project_id bigint NOT NULL,
    partition_id bigint DEFAULT 1 NOT NULL,
    status smallint DEFAULT 1 NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
)
PARTITION BY LIST (partition_id);

CREATE TABLE p_ci_finished_build_ch_sync_events (
    build_id bigint NOT NULL,
    partition bigint DEFAULT 1 NOT NULL,
    build_finished_at timestamp without time zone NOT NULL,
    processed boolean DEFAULT false NOT NULL,
    project_id bigint NOT NULL
)
PARTITION BY LIST (partition);

CREATE TABLE p_ci_finished_pipeline_ch_sync_events (
    pipeline_id bigint NOT NULL,
    project_namespace_id bigint NOT NULL,
    partition bigint DEFAULT 1 NOT NULL,
    pipeline_finished_at timestamp without time zone NOT NULL,
    processed boolean DEFAULT false NOT NULL
)
PARTITION BY LIST (partition);

CREATE TABLE p_duo_workflows_checkpoints (
    id bigint NOT NULL,
    workflow_id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    thread_ts text NOT NULL,
    parent_ts text,
    checkpoint jsonb NOT NULL,
    metadata jsonb NOT NULL,
    CONSTRAINT check_70d1d05b50 CHECK ((num_nonnulls(namespace_id, project_id) = 1)),
    CONSTRAINT check_b55c120f3f CHECK ((char_length(thread_ts) <= 255)),
    CONSTRAINT check_e63817afa6 CHECK ((char_length(parent_ts) <= 255))
)
PARTITION BY RANGE (created_at);

CREATE TABLE p_knowledge_graph_enabled_namespaces (
    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,
    state smallint DEFAULT 0 NOT NULL
)
PARTITION BY RANGE (namespace_id);

CREATE TABLE p_knowledge_graph_replicas (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    knowledge_graph_enabled_namespace_id bigint,
    zoekt_node_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    retries_left smallint NOT NULL,
    reserved_storage_bytes bigint DEFAULT 10485760 NOT NULL,
    indexed_at timestamp with time zone,
    schema_version smallint DEFAULT 0 NOT NULL,
    CONSTRAINT c_p_knowledge_graph_replicas_retries_status CHECK (((retries_left > 0) OR ((retries_left = 0) AND (state >= 200))))
)
PARTITION BY RANGE (namespace_id);

CREATE TABLE p_knowledge_graph_tasks (
    id bigint NOT NULL,
    partition_id bigint DEFAULT 1 NOT NULL,
    zoekt_node_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    knowledge_graph_replica_id bigint NOT NULL,
    perform_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    task_type smallint NOT NULL,
    retries_left smallint NOT NULL,
    CONSTRAINT c_p_knowledge_graph_tasks_on_retries_left CHECK (((retries_left > 0) OR ((retries_left = 0) AND (state = 255))))
)
PARTITION BY LIST (partition_id);

CREATE TABLE project_audit_events (
    id bigint DEFAULT nextval('shared_audit_event_id_seq'::regclass) NOT NULL,
    created_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    author_id bigint NOT NULL,
    target_id bigint,
    event_name text,
    details text,
    ip_address inet,
    author_name text,
    entity_path text,
    target_details text,
    target_type text,
    CONSTRAINT project_audit_events_author_name_check CHECK ((char_length(author_name) <= 255)),
    CONSTRAINT project_audit_events_entity_path_check CHECK ((char_length(entity_path) <= 5500)),
    CONSTRAINT project_audit_events_event_name_check CHECK ((char_length(event_name) <= 255)),
    CONSTRAINT project_audit_events_target_details_check CHECK ((char_length(target_details) <= 5500)),
    CONSTRAINT project_audit_events_target_type_check CHECK ((char_length(target_type) <= 255))
)
PARTITION BY RANGE (created_at);

CREATE TABLE projects_visits (
    id bigint NOT NULL,
    entity_id bigint NOT NULL,
    user_id bigint NOT NULL,
    visited_at timestamp with time zone NOT NULL
)
PARTITION BY RANGE (visited_at);

CREATE TABLE security_findings (
    id bigint NOT NULL,
    scan_id bigint NOT NULL,
    scanner_id bigint NOT NULL,
    severity smallint NOT NULL,
    deduplicated boolean DEFAULT false NOT NULL,
    uuid uuid,
    overridden_uuid uuid,
    partition_number integer DEFAULT 1 NOT NULL,
    finding_data jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_6c2851a8c9 CHECK ((uuid IS NOT NULL))
)
PARTITION BY LIST (partition_number);

CREATE TABLE sent_notifications_7abbf02cb6 (
    project_id bigint,
    noteable_id bigint,
    noteable_type character varying,
    recipient_id bigint,
    commit_id character varying,
    reply_key character varying NOT NULL,
    in_reply_to_discussion_id character varying,
    id bigint NOT NULL,
    issue_email_participant_id bigint,
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL
)
PARTITION BY RANGE (created_at);

CREATE TABLE user_audit_events (
    id bigint DEFAULT nextval('shared_audit_event_id_seq'::regclass) NOT NULL,
    created_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    author_id bigint NOT NULL,
    target_id bigint,
    event_name text,
    details text,
    ip_address inet,
    author_name text,
    entity_path text,
    target_details text,
    target_type text,
    CONSTRAINT user_audit_events_author_name_check CHECK ((char_length(author_name) <= 255)),
    CONSTRAINT user_audit_events_entity_path_check CHECK ((char_length(entity_path) <= 5500)),
    CONSTRAINT user_audit_events_event_name_check CHECK ((char_length(event_name) <= 255)),
    CONSTRAINT user_audit_events_target_details_check CHECK ((char_length(target_details) <= 5500)),
    CONSTRAINT user_audit_events_target_type_check CHECK ((char_length(target_type) <= 255))
)
PARTITION BY RANGE (created_at);

CREATE TABLE value_stream_dashboard_counts (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    count bigint NOT NULL,
    recorded_at timestamp with time zone NOT NULL,
    metric smallint NOT NULL
)
PARTITION BY RANGE (recorded_at);

CREATE TABLE verification_codes (
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    visitor_id_code text NOT NULL,
    code text NOT NULL,
    phone text NOT NULL,
    CONSTRAINT check_9b84e6aaff CHECK ((char_length(code) <= 8)),
    CONSTRAINT check_ccc542256b CHECK ((char_length(visitor_id_code) <= 64)),
    CONSTRAINT check_f5684c195b CHECK ((char_length(phone) <= 50))
)
PARTITION BY RANGE (created_at);

COMMENT ON TABLE verification_codes IS 'JiHu-specific table';

CREATE TABLE vulnerability_archive_exports (
    id bigint NOT NULL,
    partition_number bigint DEFAULT 1 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    started_at timestamp with time zone,
    finished_at timestamp with time zone,
    project_id bigint NOT NULL,
    author_id bigint NOT NULL,
    date_range daterange NOT NULL,
    file_store smallint,
    format smallint,
    file text,
    status text,
    CONSTRAINT check_3423276100 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_aada0b0f45 CHECK ((char_length(status) <= 8))
)
PARTITION BY LIST (partition_number);

CREATE TABLE vulnerability_archived_records (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    id bigint NOT NULL,
    date date NOT NULL,
    project_id bigint NOT NULL,
    archive_id bigint NOT NULL,
    vulnerability_identifier bigint NOT NULL,
    data jsonb DEFAULT '{}'::jsonb NOT NULL
)
PARTITION BY RANGE (date);

CREATE TABLE vulnerability_archives (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    archived_records_count integer DEFAULT 0 NOT NULL,
    date date NOT NULL,
    CONSTRAINT chk_rails_6b9e2d707f CHECK ((archived_records_count >= 0))
)
PARTITION BY RANGE (date);

CREATE TABLE web_hook_logs_daily (
    id bigint NOT NULL,
    web_hook_id bigint NOT NULL,
    trigger character varying,
    url character varying,
    request_headers text,
    request_data text,
    response_headers text,
    response_body text,
    response_status character varying,
    execution_duration double precision,
    internal_error_message character varying,
    updated_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone NOT NULL,
    url_hash text,
    CONSTRAINT check_df72cb58f5 CHECK ((char_length(url_hash) <= 44))
)
PARTITION BY RANGE (created_at);

CREATE TABLE zoekt_tasks (
    id bigint NOT NULL,
    partition_id bigint DEFAULT 1 NOT NULL,
    zoekt_node_id bigint NOT NULL,
    zoekt_repository_id bigint NOT NULL,
    project_identifier bigint NOT NULL,
    perform_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    task_type smallint NOT NULL,
    retries_left smallint DEFAULT 5 NOT NULL,
    CONSTRAINT c_zoekt_tasks_on_retries_left CHECK (((retries_left > 0) OR ((retries_left = 0) AND (state = 255))))
)
PARTITION BY LIST (partition_id);

CREATE TABLE analytics_cycle_analytics_issue_stage_events (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
)
PARTITION BY HASH (stage_event_hash_id);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 (
    stage_event_hash_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    weight integer,
    sprint_id bigint,
    duration_in_milliseconds bigint
);

CREATE TABLE analytics_cycle_analytics_merge_request_stage_events (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
)
PARTITION BY HASH (stage_event_hash_id);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 (
    stage_event_hash_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    group_id bigint NOT NULL,
    project_id bigint NOT NULL,
    milestone_id bigint,
    author_id bigint,
    start_event_timestamp timestamp with time zone NOT NULL,
    end_event_timestamp timestamp with time zone,
    state_id smallint DEFAULT 1 NOT NULL,
    duration_in_milliseconds bigint
);

CREATE TABLE issue_search_data (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
)
PARTITION BY HASH (project_id);

CREATE TABLE gitlab_partitions_static.issue_search_data_00 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_01 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_02 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_03 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_04 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_05 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_06 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_07 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_08 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_09 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_10 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_11 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_12 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_13 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_14 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_15 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_16 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_17 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_18 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_19 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_20 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_21 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_22 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_23 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_24 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_25 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_26 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_27 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_28 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_29 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_30 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_31 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_32 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_33 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_34 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_35 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_36 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_37 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_38 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_39 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_40 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_41 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_42 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_43 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_44 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_45 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_46 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_47 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_48 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_49 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_50 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_51 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_52 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_53 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_54 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_55 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_56 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_57 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_58 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_59 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_60 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_61 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_62 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE gitlab_partitions_static.issue_search_data_63 (
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    search_vector tsvector,
    namespace_id bigint
);

CREATE TABLE namespace_descendants (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
)
PARTITION BY HASH (namespace_id);

CREATE TABLE gitlab_partitions_static.namespace_descendants_00 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_01 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_02 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_03 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_04 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_05 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_06 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_07 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_08 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_09 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_10 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_11 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_12 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_13 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_14 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_15 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_16 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_17 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_18 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_19 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_20 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_21 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_22 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_23 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_24 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_25 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_26 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_27 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_28 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_29 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_30 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE gitlab_partitions_static.namespace_descendants_31 (
    namespace_id bigint NOT NULL,
    self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL,
    outdated_at timestamp with time zone,
    calculated_at timestamp with time zone,
    all_active_project_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    all_unarchived_project_ids bigint[] DEFAULT '{}'::bigint[],
    CONSTRAINT check_60ae9ef706 CHECK ((all_unarchived_project_ids IS NOT NULL))
);

CREATE TABLE virtual_registries_packages_maven_cache_entries (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
)
PARTITION BY HASH (relative_path);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 (
    group_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    upstream_checked_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer DEFAULT 1 NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relative_path text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    upstream_etag text,
    content_type text DEFAULT 'application/octet-stream'::text NOT NULL,
    file_md5 bytea,
    file_sha1 bytea NOT NULL,
    downloads_count bigint DEFAULT 0 NOT NULL,
    downloaded_at timestamp with time zone,
    CONSTRAINT check_215f531366 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_2a52b4e0fc CHECK ((char_length(file) <= 1024)),
    CONSTRAINT check_36391449ea CHECK ((char_length(object_storage_key) <= 1024)),
    CONSTRAINT check_45d3174f8a CHECK ((char_length(relative_path) <= 1024)),
    CONSTRAINT check_cc222855d6 CHECK (((file_md5 IS NULL) OR (octet_length(file_md5) = 16))),
    CONSTRAINT check_f2ea43b900 CHECK ((octet_length(file_sha1) = 20)),
    CONSTRAINT check_fd9fc90696 CHECK ((char_length(upstream_etag) <= 255))
);

CREATE TABLE abuse_events (
    id bigint NOT NULL,
    user_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    abuse_report_id bigint,
    source smallint NOT NULL,
    category smallint,
    metadata jsonb
);

CREATE SEQUENCE abuse_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_events_id_seq OWNED BY abuse_events.id;

CREATE TABLE abuse_report_assignees (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    abuse_report_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE abuse_report_assignees_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_report_assignees_id_seq OWNED BY abuse_report_assignees.id;

CREATE TABLE abuse_report_events (
    id bigint NOT NULL,
    abuse_report_id bigint NOT NULL,
    user_id bigint,
    created_at timestamp with time zone NOT NULL,
    action smallint DEFAULT 1 NOT NULL,
    reason smallint,
    comment text,
    CONSTRAINT check_bb4cd85618 CHECK ((char_length(comment) <= 1024))
);

CREATE SEQUENCE abuse_report_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_report_events_id_seq OWNED BY abuse_report_events.id;

CREATE TABLE abuse_report_label_links (
    id bigint NOT NULL,
    abuse_report_id bigint NOT NULL,
    abuse_report_label_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE abuse_report_label_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_report_label_links_id_seq OWNED BY abuse_report_label_links.id;

CREATE TABLE abuse_report_labels (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    cached_markdown_version integer,
    title text NOT NULL,
    color text,
    description text,
    description_html text,
    CONSTRAINT check_034642a23f CHECK ((char_length(description) <= 500)),
    CONSTRAINT check_7957e7e95f CHECK ((char_length(description_html) <= 1000)),
    CONSTRAINT check_c7a15f74dc CHECK ((char_length(color) <= 7)),
    CONSTRAINT check_e264245e2a CHECK ((char_length(title) <= 255))
);

CREATE SEQUENCE abuse_report_labels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_report_labels_id_seq OWNED BY abuse_report_labels.id;

CREATE TABLE abuse_report_notes (
    id bigint NOT NULL,
    abuse_report_id bigint NOT NULL,
    author_id bigint NOT NULL,
    updated_by_id bigint,
    resolved_by_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    resolved_at timestamp with time zone,
    last_edited_at timestamp with time zone,
    cached_markdown_version integer,
    discussion_id text,
    note text,
    note_html text,
    type text,
    CONSTRAINT check_096e19df7f CHECK ((char_length(type) <= 40)),
    CONSTRAINT check_0de721e87e CHECK ((char_length(note) <= 10000)),
    CONSTRAINT check_13235633b5 CHECK ((char_length(discussion_id) <= 255)),
    CONSTRAINT check_21b51956e3 CHECK ((char_length(note_html) <= 20000))
);

CREATE SEQUENCE abuse_report_notes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_report_notes_id_seq OWNED BY abuse_report_notes.id;

CREATE TABLE uploads_9ba88c4165 (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
)
PARTITION BY LIST (model_type);

CREATE TABLE abuse_report_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE abuse_report_user_mentions (
    id bigint NOT NULL,
    abuse_report_id bigint NOT NULL,
    note_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[]
);

CREATE SEQUENCE abuse_report_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_report_user_mentions_id_seq OWNED BY abuse_report_user_mentions.id;

CREATE TABLE abuse_reports (
    id bigint NOT NULL,
    reporter_id bigint,
    user_id bigint,
    message text,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    message_html text,
    cached_markdown_version integer,
    category smallint DEFAULT 1 NOT NULL,
    reported_from_url text DEFAULT ''::text NOT NULL,
    links_to_spam text[] DEFAULT '{}'::text[] NOT NULL,
    status smallint DEFAULT 1 NOT NULL,
    resolved_at timestamp with time zone,
    screenshot text,
    resolved_by_id bigint,
    assignee_id bigint,
    mitigation_steps text,
    evidence jsonb,
    assignee_id_convert_to_bigint bigint,
    id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
    reporter_id_convert_to_bigint bigint,
    resolved_by_id_convert_to_bigint bigint,
    user_id_convert_to_bigint bigint,
    CONSTRAINT abuse_reports_links_to_spam_length_check CHECK ((cardinality(links_to_spam) <= 20)),
    CONSTRAINT check_4b0a5120e0 CHECK ((char_length(screenshot) <= 255)),
    CONSTRAINT check_ab1260fa6c CHECK ((char_length(reported_from_url) <= 512)),
    CONSTRAINT check_f3c0947a2d CHECK ((char_length(mitigation_steps) <= 1000))
);

CREATE SEQUENCE abuse_reports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_reports_id_seq OWNED BY abuse_reports.id;

CREATE TABLE abuse_trust_scores (
    id bigint NOT NULL,
    user_id bigint,
    score double precision NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    source smallint NOT NULL,
    correlation_id_value text,
    CONSTRAINT check_77ca9551db CHECK ((char_length(correlation_id_value) <= 255))
);

CREATE SEQUENCE abuse_trust_scores_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE abuse_trust_scores_id_seq OWNED BY abuse_trust_scores.id;

CREATE TABLE achievement_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE achievements (
    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,
    name text NOT NULL,
    avatar text,
    description text,
    CONSTRAINT check_5171b03f22 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_a7a7b84a80 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_e174e93a9e CHECK ((char_length(avatar) <= 255))
);

CREATE SEQUENCE achievements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE achievements_id_seq OWNED BY achievements.id;

CREATE TABLE activity_pub_releases_subscriptions (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 1 NOT NULL,
    shared_inbox_url text,
    subscriber_inbox_url text,
    subscriber_url text NOT NULL,
    payload jsonb,
    CONSTRAINT check_0ebf38bcaa CHECK ((char_length(subscriber_inbox_url) <= 1024)),
    CONSTRAINT check_2afd35ba17 CHECK ((char_length(subscriber_url) <= 1024)),
    CONSTRAINT check_61b77ced49 CHECK ((char_length(shared_inbox_url) <= 1024))
);

CREATE SEQUENCE activity_pub_releases_subscriptions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE activity_pub_releases_subscriptions_id_seq OWNED BY activity_pub_releases_subscriptions.id;

CREATE TABLE admin_roles (
    id bigint NOT NULL,
    name text NOT NULL,
    description text,
    permissions jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_89a2f4f799 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_a8c6d1de58 CHECK ((char_length(description) <= 255))
);

CREATE SEQUENCE admin_roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE admin_roles_id_seq OWNED BY admin_roles.id;

CREATE TABLE agent_activity_events (
    id bigint NOT NULL,
    agent_id bigint NOT NULL,
    user_id bigint,
    project_id bigint,
    merge_request_id bigint,
    agent_token_id bigint,
    recorded_at timestamp with time zone NOT NULL,
    kind smallint NOT NULL,
    level smallint NOT NULL,
    sha bytea,
    detail text,
    agent_project_id bigint,
    CONSTRAINT check_068205e735 CHECK ((char_length(detail) <= 255)),
    CONSTRAINT check_9e09ffbd0f CHECK ((agent_project_id IS NOT NULL))
);

CREATE SEQUENCE agent_activity_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE agent_activity_events_id_seq OWNED BY agent_activity_events.id;

CREATE TABLE agent_group_authorizations (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    config jsonb NOT NULL
);

CREATE SEQUENCE agent_group_authorizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE agent_group_authorizations_id_seq OWNED BY agent_group_authorizations.id;

CREATE TABLE agent_organization_authorizations (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    config jsonb NOT NULL
);

CREATE SEQUENCE agent_organization_authorizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE agent_organization_authorizations_id_seq OWNED BY agent_organization_authorizations.id;

CREATE TABLE agent_project_authorizations (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    config jsonb NOT NULL
);

CREATE SEQUENCE agent_project_authorizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE agent_project_authorizations_id_seq OWNED BY agent_project_authorizations.id;

CREATE TABLE agent_user_access_group_authorizations (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    config jsonb NOT NULL
);

CREATE SEQUENCE agent_user_access_group_authorizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE agent_user_access_group_authorizations_id_seq OWNED BY agent_user_access_group_authorizations.id;

CREATE TABLE agent_user_access_project_authorizations (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    config jsonb NOT NULL
);

CREATE SEQUENCE agent_user_access_project_authorizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE agent_user_access_project_authorizations_id_seq OWNED BY agent_user_access_project_authorizations.id;

CREATE TABLE ai_active_context_collections (
    id bigint NOT NULL,
    name text NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    number_of_partitions integer DEFAULT 1 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    connection_id bigint NOT NULL,
    CONSTRAINT check_fe84a77f95 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE ai_active_context_collections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_active_context_collections_id_seq OWNED BY ai_active_context_collections.id;

CREATE TABLE ai_active_context_connections (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    active boolean DEFAULT false NOT NULL,
    name text NOT NULL,
    prefix text,
    adapter_class text NOT NULL,
    options jsonb NOT NULL,
    CONSTRAINT check_7bb86d51bc CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_b1c9c4af95 CHECK ((char_length(adapter_class) <= 255)),
    CONSTRAINT check_ffbd5301a3 CHECK ((char_length(prefix) <= 255))
);

CREATE SEQUENCE ai_active_context_connections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_active_context_connections_id_seq OWNED BY ai_active_context_connections.id;

CREATE TABLE ai_active_context_migrations (
    id bigint NOT NULL,
    connection_id bigint NOT NULL,
    started_at timestamp with time zone,
    completed_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    retries_left smallint NOT NULL,
    version text NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    error_message text,
    CONSTRAINT c_ai_active_context_migrations_on_retries_left CHECK (((retries_left > 0) OR ((retries_left = 0) AND (status = 255)))),
    CONSTRAINT c_ai_active_context_migrations_version_format CHECK ((version ~ '^[0-9]{14}$'::text)),
    CONSTRAINT check_184ab3430e CHECK ((char_length(error_message) <= 1024)),
    CONSTRAINT check_b2e8a34818 CHECK ((char_length(version) <= 255))
);

CREATE SEQUENCE ai_active_context_migrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_active_context_migrations_id_seq OWNED BY ai_active_context_migrations.id;

CREATE TABLE ai_agent_version_attachments (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    ai_agent_version_id bigint NOT NULL,
    ai_vectorizable_file_id bigint NOT NULL
);

CREATE SEQUENCE ai_agent_version_attachments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_agent_version_attachments_id_seq OWNED BY ai_agent_version_attachments.id;

CREATE TABLE ai_agent_versions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    prompt text NOT NULL,
    model text NOT NULL,
    CONSTRAINT check_8cda7448e9 CHECK ((char_length(model) <= 255)),
    CONSTRAINT check_d7a4fc9834 CHECK ((char_length(prompt) <= 5000))
);

CREATE SEQUENCE ai_agent_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_agent_versions_id_seq OWNED BY ai_agent_versions.id;

CREATE TABLE ai_agents (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    CONSTRAINT check_67934c8e85 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE ai_agents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_agents_id_seq OWNED BY ai_agents.id;

CREATE TABLE ai_catalog_item_consumers (
    id bigint NOT NULL,
    ai_catalog_item_id bigint NOT NULL,
    organization_id bigint,
    group_id bigint,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    enabled boolean DEFAULT false NOT NULL,
    locked boolean DEFAULT true NOT NULL,
    pinned_version_prefix text,
    CONSTRAINT check_55026cf703 CHECK ((num_nonnulls(group_id, organization_id, project_id) = 1)),
    CONSTRAINT check_a788d1fdfa CHECK ((char_length(pinned_version_prefix) <= 50))
);

CREATE SEQUENCE ai_catalog_item_consumers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_catalog_item_consumers_id_seq OWNED BY ai_catalog_item_consumers.id;

CREATE TABLE ai_catalog_item_versions (
    id bigint NOT NULL,
    release_date timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    organization_id bigint NOT NULL,
    ai_catalog_item_id bigint NOT NULL,
    schema_version smallint NOT NULL,
    version text NOT NULL,
    definition jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT check_8cabb46fa3 CHECK ((char_length(version) <= 50))
);

CREATE SEQUENCE ai_catalog_item_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_catalog_item_versions_id_seq OWNED BY ai_catalog_item_versions.id;

CREATE TABLE ai_catalog_items (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    item_type smallint NOT NULL,
    description text NOT NULL,
    name text NOT NULL,
    public boolean DEFAULT false NOT NULL,
    deleted_at timestamp with time zone,
    CONSTRAINT check_7e02a4805b CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_edddd6e1fe CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE ai_catalog_items_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_catalog_items_id_seq OWNED BY ai_catalog_items.id;

CREATE SEQUENCE ai_code_suggestion_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_code_suggestion_events_id_seq OWNED BY ai_code_suggestion_events.id;

CREATE TABLE ai_conversation_messages (
    id bigint NOT NULL,
    thread_id bigint NOT NULL,
    agent_version_id bigint,
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    role smallint NOT NULL,
    has_feedback boolean DEFAULT false,
    extras jsonb DEFAULT '{}'::jsonb NOT NULL,
    error_details jsonb DEFAULT '{}'::jsonb NOT NULL,
    content text NOT NULL,
    request_xid text,
    message_xid text,
    referer_url text,
    CONSTRAINT check_0fe78937e4 CHECK ((char_length(content) <= 524288)),
    CONSTRAINT check_8daec62ec9 CHECK ((char_length(request_xid) <= 255)),
    CONSTRAINT check_b14b137e02 CHECK ((char_length(message_xid) <= 255)),
    CONSTRAINT check_f36c73d1d9 CHECK ((char_length(referer_url) <= 255))
);

CREATE SEQUENCE ai_conversation_messages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_conversation_messages_id_seq OWNED BY ai_conversation_messages.id;

CREATE TABLE ai_conversation_threads (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    organization_id bigint NOT NULL,
    last_updated_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    conversation_type smallint NOT NULL
);

CREATE SEQUENCE ai_conversation_threads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_conversation_threads_id_seq OWNED BY ai_conversation_threads.id;

CREATE SEQUENCE ai_duo_chat_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_duo_chat_events_id_seq OWNED BY ai_duo_chat_events.id;

CREATE TABLE ai_feature_settings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    ai_self_hosted_model_id bigint,
    feature smallint NOT NULL,
    provider smallint NOT NULL
);

CREATE SEQUENCE ai_feature_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_feature_settings_id_seq OWNED BY ai_feature_settings.id;

CREATE TABLE ai_namespace_feature_settings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    feature smallint NOT NULL,
    offered_model_ref text,
    offered_model_name text,
    CONSTRAINT check_14e81e87bc CHECK ((char_length(offered_model_ref) <= 255)),
    CONSTRAINT check_c850e74656 CHECK ((char_length(offered_model_name) <= 255))
);

CREATE SEQUENCE ai_namespace_feature_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_namespace_feature_settings_id_seq OWNED BY ai_namespace_feature_settings.id;

CREATE TABLE ai_self_hosted_models (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    model smallint NOT NULL,
    endpoint text NOT NULL,
    name text NOT NULL,
    encrypted_api_token bytea,
    encrypted_api_token_iv bytea,
    identifier text,
    CONSTRAINT check_a28005edb2 CHECK ((char_length(endpoint) <= 2048)),
    CONSTRAINT check_cccb37e0de CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_d1e593d04d CHECK ((char_length(identifier) <= 255))
);

CREATE SEQUENCE ai_self_hosted_models_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_self_hosted_models_id_seq OWNED BY ai_self_hosted_models.id;

CREATE TABLE ai_settings (
    id bigint NOT NULL,
    ai_gateway_url text,
    singleton boolean DEFAULT true NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    amazon_q_oauth_application_id bigint,
    amazon_q_service_account_user_id bigint,
    amazon_q_ready boolean DEFAULT false NOT NULL,
    amazon_q_role_arn text,
    duo_workflow_service_account_user_id bigint,
    duo_workflow_oauth_application_id bigint,
    enabled_instance_verbose_ai_logs boolean,
    duo_core_features_enabled boolean,
    CONSTRAINT check_3cf9826589 CHECK ((char_length(ai_gateway_url) <= 2048)),
    CONSTRAINT check_a02bd8868c CHECK ((char_length(amazon_q_role_arn) <= 2048)),
    CONSTRAINT check_singleton CHECK ((singleton IS TRUE))
);

COMMENT ON COLUMN ai_settings.singleton IS 'Always true, used for singleton enforcement';

CREATE SEQUENCE ai_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_settings_id_seq OWNED BY ai_settings.id;

CREATE TABLE ai_testing_terms_acceptances (
    created_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    user_email text NOT NULL,
    CONSTRAINT check_5efe98894e CHECK ((char_length(user_email) <= 255))
);

CREATE SEQUENCE ai_troubleshoot_job_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_troubleshoot_job_events_id_seq OWNED BY ai_troubleshoot_job_events.id;

CREATE SEQUENCE ai_usage_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_usage_events_id_seq OWNED BY ai_usage_events.id;

CREATE TABLE ai_user_metrics (
    user_id bigint NOT NULL,
    last_duo_activity_on date NOT NULL
);

CREATE TABLE ai_vectorizable_file_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE ai_vectorizable_files (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    file text NOT NULL,
    CONSTRAINT check_c2ad8df0bf CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_fc6abf5b01 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE ai_vectorizable_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ai_vectorizable_files_id_seq OWNED BY ai_vectorizable_files.id;

CREATE TABLE alert_management_alert_assignees (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    alert_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_f3efe02c81 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE alert_management_alert_assignees_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE alert_management_alert_assignees_id_seq OWNED BY alert_management_alert_assignees.id;

CREATE TABLE alert_management_alert_metric_image_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE alert_management_alert_metric_images (
    id bigint NOT NULL,
    alert_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store smallint,
    file text NOT NULL,
    url text,
    url_text text,
    project_id bigint,
    CONSTRAINT check_2587666252 CHECK ((char_length(url_text) <= 128)),
    CONSTRAINT check_4d811d9007 CHECK ((char_length(url) <= 255)),
    CONSTRAINT check_70fafae519 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_7e9ef22adc CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE alert_management_alert_metric_images_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE alert_management_alert_metric_images_id_seq OWNED BY alert_management_alert_metric_images.id;

CREATE TABLE alert_management_alert_user_mentions (
    id bigint NOT NULL,
    alert_management_alert_id bigint NOT NULL,
    note_id bigint,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    project_id bigint,
    CONSTRAINT check_5094a9a20a CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE alert_management_alert_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE alert_management_alert_user_mentions_id_seq OWNED BY alert_management_alert_user_mentions.id;

CREATE TABLE alert_management_alerts (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    started_at timestamp with time zone NOT NULL,
    ended_at timestamp with time zone,
    events integer DEFAULT 1 NOT NULL,
    iid integer NOT NULL,
    severity smallint DEFAULT 0 NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    fingerprint bytea,
    issue_id bigint,
    project_id bigint NOT NULL,
    title text NOT NULL,
    description text,
    service text,
    monitoring_tool text,
    hosts text[] DEFAULT '{}'::text[] NOT NULL,
    payload jsonb DEFAULT '{}'::jsonb NOT NULL,
    prometheus_alert_id bigint,
    environment_id bigint,
    domain smallint DEFAULT 0,
    CONSTRAINT check_2df3e2fdc1 CHECK ((char_length(monitoring_tool) <= 100)),
    CONSTRAINT check_5e9e57cadb CHECK ((char_length(description) <= 1000)),
    CONSTRAINT check_bac14dddde CHECK ((char_length(service) <= 100)),
    CONSTRAINT check_d1d1c2d14c CHECK ((char_length(title) <= 200))
);

CREATE SEQUENCE alert_management_alerts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE alert_management_alerts_id_seq OWNED BY alert_management_alerts.id;

CREATE TABLE alert_management_http_integrations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    active boolean DEFAULT false NOT NULL,
    encrypted_token text NOT NULL,
    encrypted_token_iv text NOT NULL,
    endpoint_identifier text NOT NULL,
    name text NOT NULL,
    payload_example jsonb DEFAULT '{}'::jsonb NOT NULL,
    payload_attribute_mapping jsonb DEFAULT '{}'::jsonb NOT NULL,
    type_identifier smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_286943b636 CHECK ((char_length(encrypted_token_iv) <= 255)),
    CONSTRAINT check_392143ccf4 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_e270820180 CHECK ((char_length(endpoint_identifier) <= 255)),
    CONSTRAINT check_f68577c4af CHECK ((char_length(encrypted_token) <= 255))
);

CREATE SEQUENCE alert_management_http_integrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE alert_management_http_integrations_id_seq OWNED BY alert_management_http_integrations.id;

CREATE TABLE allowed_email_domains (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    domain character varying(255) NOT NULL
);

CREATE SEQUENCE allowed_email_domains_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE allowed_email_domains_id_seq OWNED BY allowed_email_domains.id;

CREATE TABLE analytics_cycle_analytics_aggregations (
    group_id bigint NOT NULL,
    incremental_runtimes_in_seconds integer[] DEFAULT '{}'::integer[] NOT NULL,
    incremental_processed_records integer[] DEFAULT '{}'::integer[] NOT NULL,
    last_incremental_issues_id bigint,
    last_incremental_merge_requests_id bigint,
    last_incremental_run_at timestamp with time zone,
    last_incremental_issues_updated_at timestamp with time zone,
    last_incremental_merge_requests_updated_at timestamp with time zone,
    last_full_run_at timestamp with time zone,
    last_consistency_check_updated_at timestamp with time zone,
    enabled boolean DEFAULT true NOT NULL,
    full_runtimes_in_seconds integer[] DEFAULT '{}'::integer[] NOT NULL,
    full_processed_records integer[] DEFAULT '{}'::integer[] NOT NULL,
    last_full_merge_requests_updated_at timestamp with time zone,
    last_full_issues_updated_at timestamp with time zone,
    last_full_issues_id bigint,
    last_full_merge_requests_id bigint,
    last_consistency_check_issues_stage_event_hash_id bigint,
    last_consistency_check_issues_start_event_timestamp timestamp with time zone,
    last_consistency_check_issues_end_event_timestamp timestamp with time zone,
    last_consistency_check_issues_issuable_id bigint,
    last_consistency_check_merge_requests_stage_event_hash_id bigint,
    last_consistency_check_merge_requests_start_event_timestamp timestamp with time zone,
    last_consistency_check_merge_requests_end_event_timestamp timestamp with time zone,
    last_consistency_check_merge_requests_issuable_id bigint,
    CONSTRAINT chk_rails_1ef688e577 CHECK ((cardinality(incremental_runtimes_in_seconds) <= 10)),
    CONSTRAINT chk_rails_e16bf3913a CHECK ((cardinality(incremental_processed_records) <= 10)),
    CONSTRAINT full_processed_records_size CHECK ((cardinality(full_processed_records) <= 10)),
    CONSTRAINT full_runtimes_in_seconds_size CHECK ((cardinality(full_runtimes_in_seconds) <= 10))
);

CREATE TABLE analytics_cycle_analytics_group_stages (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    relative_position integer,
    start_event_identifier integer NOT NULL,
    end_event_identifier integer NOT NULL,
    group_id bigint NOT NULL,
    start_event_label_id bigint,
    end_event_label_id bigint,
    hidden boolean DEFAULT false NOT NULL,
    custom boolean DEFAULT true NOT NULL,
    name character varying(255) NOT NULL,
    group_value_stream_id bigint NOT NULL,
    stage_event_hash_id bigint,
    CONSTRAINT check_e6bd4271b5 CHECK ((stage_event_hash_id IS NOT NULL))
);

CREATE SEQUENCE analytics_cycle_analytics_group_stages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_cycle_analytics_group_stages_id_seq OWNED BY analytics_cycle_analytics_group_stages.id;

CREATE TABLE analytics_cycle_analytics_group_value_streams (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    name text NOT NULL,
    CONSTRAINT check_bc1ed5f1f7 CHECK ((char_length(name) <= 100))
);

CREATE SEQUENCE analytics_cycle_analytics_group_value_streams_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_cycle_analytics_group_value_streams_id_seq OWNED BY analytics_cycle_analytics_group_value_streams.id;

CREATE TABLE analytics_cycle_analytics_stage_aggregations (
    group_id bigint NOT NULL,
    stage_id bigint NOT NULL,
    runtimes_in_seconds integer[] DEFAULT '{}'::integer[] NOT NULL,
    processed_records integer[] DEFAULT '{}'::integer[] NOT NULL,
    last_issues_id bigint,
    last_merge_requests_id bigint,
    last_run_at timestamp with time zone,
    last_issues_updated_at timestamp with time zone,
    last_merge_requests_updated_at timestamp with time zone,
    last_completed_at timestamp with time zone,
    enabled boolean DEFAULT true NOT NULL,
    CONSTRAINT chk_rails_50ee1c451c CHECK ((cardinality(runtimes_in_seconds) <= 10)),
    CONSTRAINT chk_rails_7586ea045d CHECK ((cardinality(processed_records) <= 10))
);

CREATE TABLE analytics_cycle_analytics_stage_event_hashes (
    id bigint NOT NULL,
    hash_sha256 bytea,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE analytics_cycle_analytics_stage_event_hashes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_cycle_analytics_stage_event_hashes_id_seq OWNED BY analytics_cycle_analytics_stage_event_hashes.id;

CREATE TABLE analytics_cycle_analytics_value_stream_settings (
    value_stream_id bigint NOT NULL,
    project_ids_filter bigint[] DEFAULT '{}'::bigint[],
    namespace_id bigint NOT NULL,
    CONSTRAINT project_ids_filter_array_check CHECK (((cardinality(project_ids_filter) <= 100) AND (array_position(project_ids_filter, NULL::bigint) IS NULL)))
);

CREATE TABLE analytics_dashboards_pointers (
    id bigint NOT NULL,
    namespace_id bigint,
    project_id bigint,
    target_project_id bigint NOT NULL,
    CONSTRAINT chk_analytics_dashboards_pointers_project_or_namespace CHECK (((project_id IS NULL) <> (namespace_id IS NULL)))
);

CREATE SEQUENCE analytics_dashboards_pointers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_dashboards_pointers_id_seq OWNED BY analytics_dashboards_pointers.id;

CREATE TABLE analytics_devops_adoption_segments (
    id bigint NOT NULL,
    last_recorded_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    display_namespace_id bigint
);

CREATE SEQUENCE analytics_devops_adoption_segments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_devops_adoption_segments_id_seq OWNED BY analytics_devops_adoption_segments.id;

CREATE TABLE analytics_devops_adoption_snapshots (
    id bigint NOT NULL,
    recorded_at timestamp with time zone NOT NULL,
    issue_opened boolean NOT NULL,
    merge_request_opened boolean NOT NULL,
    merge_request_approved boolean NOT NULL,
    runner_configured boolean NOT NULL,
    pipeline_succeeded boolean NOT NULL,
    deploy_succeeded boolean NOT NULL,
    end_time timestamp with time zone NOT NULL,
    total_projects_count integer,
    code_owners_used_count integer,
    namespace_id bigint,
    sast_enabled_count integer,
    dast_enabled_count integer,
    dependency_scanning_enabled_count integer,
    coverage_fuzzing_enabled_count integer,
    vulnerability_management_used_count integer,
    CONSTRAINT check_3f472de131 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_devops_adoption_snapshots_id_seq OWNED BY analytics_devops_adoption_snapshots.id;

CREATE TABLE analytics_language_trend_repository_languages (
    file_count integer DEFAULT 0 NOT NULL,
    programming_language_id bigint NOT NULL,
    project_id bigint NOT NULL,
    loc integer DEFAULT 0 NOT NULL,
    bytes integer DEFAULT 0 NOT NULL,
    percentage smallint DEFAULT 0 NOT NULL,
    snapshot_date date NOT NULL
);

CREATE TABLE analytics_usage_trends_measurements (
    id bigint NOT NULL,
    count bigint NOT NULL,
    recorded_at timestamp with time zone NOT NULL,
    identifier smallint NOT NULL
);

CREATE SEQUENCE analytics_usage_trends_measurements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analytics_usage_trends_measurements_id_seq OWNED BY analytics_usage_trends_measurements.id;

CREATE TABLE analyzer_namespace_statuses (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    analyzer_type smallint NOT NULL,
    success bigint DEFAULT 0 NOT NULL,
    failure bigint DEFAULT 0 NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL
);

CREATE SEQUENCE analyzer_namespace_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analyzer_namespace_statuses_id_seq OWNED BY analyzer_namespace_statuses.id;

CREATE TABLE analyzer_project_statuses (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    analyzer_type smallint NOT NULL,
    status smallint NOT NULL,
    last_call timestamp with time zone NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    build_id bigint,
    archived boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE analyzer_project_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE analyzer_project_statuses_id_seq OWNED BY analyzer_project_statuses.id;

CREATE TABLE appearance_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE appearances (
    id bigint NOT NULL,
    title character varying NOT NULL,
    description text NOT NULL,
    logo character varying,
    updated_by integer,
    header_logo character varying,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    description_html text,
    cached_markdown_version integer,
    new_project_guidelines text,
    new_project_guidelines_html text,
    header_message text,
    header_message_html text,
    footer_message text,
    footer_message_html text,
    message_background_color text,
    message_font_color text,
    favicon character varying,
    email_header_and_footer_enabled boolean DEFAULT false NOT NULL,
    profile_image_guidelines text,
    profile_image_guidelines_html text,
    pwa_short_name text,
    pwa_icon text,
    pwa_name text,
    pwa_description text,
    member_guidelines text,
    member_guidelines_html text,
    CONSTRAINT appearances_profile_image_guidelines CHECK ((char_length(profile_image_guidelines) <= 4096)),
    CONSTRAINT check_13b2165eca CHECK ((char_length(pwa_name) <= 255)),
    CONSTRAINT check_50e9b69ab6 CHECK ((char_length(member_guidelines) <= 4096)),
    CONSTRAINT check_5c3fd63577 CHECK ((char_length(pwa_short_name) <= 255)),
    CONSTRAINT check_5e0e6f24ed CHECK ((char_length(pwa_description) <= 2048)),
    CONSTRAINT check_5e5b7ac344 CHECK ((char_length(pwa_icon) <= 1024))
);

CREATE SEQUENCE appearances_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE appearances_id_seq OWNED BY appearances.id;

CREATE TABLE application_setting_terms (
    id bigint NOT NULL,
    cached_markdown_version integer,
    terms text NOT NULL,
    terms_html text
);

CREATE SEQUENCE application_setting_terms_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE application_setting_terms_id_seq OWNED BY application_setting_terms.id;

CREATE TABLE application_settings (
    id bigint NOT NULL,
    default_projects_limit integer,
    signup_enabled boolean,
    gravatar_enabled boolean,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    home_page_url character varying,
    default_branch_protection integer DEFAULT 2,
    restricted_visibility_levels text,
    version_check_enabled boolean DEFAULT true,
    max_attachment_size integer DEFAULT 100 NOT NULL,
    default_project_visibility integer DEFAULT 0 NOT NULL,
    default_snippet_visibility integer DEFAULT 0 NOT NULL,
    user_oauth_applications boolean DEFAULT true,
    after_sign_out_path character varying,
    session_expire_delay integer DEFAULT 10080 NOT NULL,
    import_sources text,
    help_page_text text,
    require_admin_two_factor_authentication boolean DEFAULT false NOT NULL,
    shared_runners_enabled boolean DEFAULT true NOT NULL,
    max_artifacts_size integer DEFAULT 100 NOT NULL,
    max_pages_size integer DEFAULT 100 NOT NULL,
    require_two_factor_authentication boolean DEFAULT false,
    two_factor_grace_period integer DEFAULT 48,
    metrics_enabled boolean DEFAULT false,
    metrics_host character varying DEFAULT 'localhost'::character varying,
    metrics_pool_size integer DEFAULT 16,
    metrics_timeout integer DEFAULT 10,
    metrics_method_call_threshold integer DEFAULT 10,
    recaptcha_enabled boolean DEFAULT false,
    metrics_port integer DEFAULT 8089,
    akismet_enabled boolean DEFAULT false,
    metrics_sample_interval integer DEFAULT 15,
    email_author_in_body boolean DEFAULT false,
    default_group_visibility integer,
    repository_checks_enabled boolean DEFAULT false,
    shared_runners_text text,
    metrics_packet_size integer DEFAULT 1,
    disabled_oauth_sign_in_sources text,
    health_check_access_token character varying,
    container_registry_token_expire_delay integer DEFAULT 5,
    after_sign_up_text text,
    user_default_external boolean DEFAULT false NOT NULL,
    repository_storages character varying DEFAULT 'default'::character varying,
    enabled_git_access_protocol character varying,
    usage_ping_enabled boolean DEFAULT true NOT NULL,
    help_page_text_html text,
    shared_runners_text_html text,
    after_sign_up_text_html text,
    rsa_key_restriction integer DEFAULT 0 NOT NULL,
    dsa_key_restriction integer DEFAULT '-1'::integer NOT NULL,
    ecdsa_key_restriction integer DEFAULT 0 NOT NULL,
    ed25519_key_restriction integer DEFAULT 0 NOT NULL,
    housekeeping_enabled boolean DEFAULT true NOT NULL,
    housekeeping_bitmaps_enabled boolean DEFAULT true NOT NULL,
    housekeeping_incremental_repack_period integer DEFAULT 10 NOT NULL,
    housekeeping_full_repack_period integer DEFAULT 50 NOT NULL,
    housekeeping_gc_period integer DEFAULT 200 NOT NULL,
    html_emails_enabled boolean DEFAULT true,
    plantuml_url character varying,
    plantuml_enabled boolean,
    shared_runners_minutes integer DEFAULT 0 NOT NULL,
    repository_size_limit bigint DEFAULT 0,
    terminal_max_session_time integer DEFAULT 0 NOT NULL,
    unique_ips_limit_per_user integer,
    unique_ips_limit_time_window integer,
    unique_ips_limit_enabled boolean DEFAULT false NOT NULL,
    default_artifacts_expire_in character varying DEFAULT '0'::character varying NOT NULL,
    elasticsearch_url character varying DEFAULT 'http://localhost:9200'::character varying,
    geo_status_timeout integer DEFAULT 10,
    uuid character varying,
    polling_interval_multiplier numeric DEFAULT 1.0 NOT NULL,
    cached_markdown_version integer,
    check_namespace_plan boolean DEFAULT false NOT NULL,
    mirror_max_delay integer DEFAULT 300 NOT NULL,
    mirror_max_capacity integer DEFAULT 100 NOT NULL,
    mirror_capacity_threshold integer DEFAULT 50 NOT NULL,
    prometheus_metrics_enabled boolean DEFAULT true NOT NULL,
    authorized_keys_enabled boolean DEFAULT true NOT NULL,
    help_page_hide_commercial_content boolean DEFAULT false,
    help_page_support_url character varying,
    slack_app_enabled boolean DEFAULT false,
    slack_app_id character varying,
    performance_bar_allowed_group_id bigint,
    allow_group_owners_to_manage_ldap boolean DEFAULT true NOT NULL,
    hashed_storage_enabled boolean DEFAULT true NOT NULL,
    project_export_enabled boolean DEFAULT true NOT NULL,
    auto_devops_enabled boolean DEFAULT true NOT NULL,
    throttle_unauthenticated_enabled boolean DEFAULT false NOT NULL,
    throttle_unauthenticated_requests_per_period integer DEFAULT 3600 NOT NULL,
    throttle_unauthenticated_period_in_seconds integer DEFAULT 3600 NOT NULL,
    throttle_authenticated_api_enabled boolean DEFAULT false NOT NULL,
    throttle_authenticated_api_requests_per_period integer DEFAULT 7200 NOT NULL,
    throttle_authenticated_api_period_in_seconds integer DEFAULT 3600 NOT NULL,
    throttle_authenticated_web_enabled boolean DEFAULT false NOT NULL,
    throttle_authenticated_web_requests_per_period integer DEFAULT 7200 NOT NULL,
    throttle_authenticated_web_period_in_seconds integer DEFAULT 3600 NOT NULL,
    gitaly_timeout_default integer DEFAULT 55 NOT NULL,
    gitaly_timeout_medium integer DEFAULT 30 NOT NULL,
    gitaly_timeout_fast integer DEFAULT 10 NOT NULL,
    mirror_available boolean DEFAULT true NOT NULL,
    password_authentication_enabled_for_web boolean,
    password_authentication_enabled_for_git boolean DEFAULT true NOT NULL,
    auto_devops_domain character varying,
    external_authorization_service_enabled boolean DEFAULT false NOT NULL,
    external_authorization_service_url character varying,
    external_authorization_service_default_label character varying,
    pages_domain_verification_enabled boolean DEFAULT true NOT NULL,
    user_default_internal_regex character varying,
    external_authorization_service_timeout double precision DEFAULT 0.5,
    external_auth_client_cert text,
    encrypted_external_auth_client_key text,
    encrypted_external_auth_client_key_iv character varying,
    encrypted_external_auth_client_key_pass character varying,
    encrypted_external_auth_client_key_pass_iv character varying,
    email_additional_text character varying,
    enforce_terms boolean DEFAULT false,
    file_template_project_id bigint,
    pseudonymizer_enabled boolean DEFAULT false NOT NULL,
    hide_third_party_offers boolean DEFAULT false NOT NULL,
    snowplow_enabled boolean DEFAULT false NOT NULL,
    snowplow_collector_hostname character varying,
    snowplow_cookie_domain character varying,
    user_show_add_ssh_key_message boolean DEFAULT true NOT NULL,
    custom_project_templates_group_id bigint,
    usage_stats_set_by_user_id bigint,
    receive_max_input_size integer,
    diff_max_patch_bytes integer DEFAULT 204800 NOT NULL,
    archive_builds_in_seconds integer,
    commit_email_hostname character varying,
    protected_ci_variables boolean DEFAULT true NOT NULL,
    runners_registration_token_encrypted character varying,
    local_markdown_version integer DEFAULT 0 NOT NULL,
    first_day_of_week integer DEFAULT 0 NOT NULL,
    default_project_creation integer DEFAULT 2 NOT NULL,
    lets_encrypt_notification_email character varying,
    lets_encrypt_terms_of_service_accepted boolean DEFAULT false NOT NULL,
    geo_node_allowed_ips character varying DEFAULT '0.0.0.0/0, ::/0'::character varying,
    encrypted_lets_encrypt_private_key text,
    encrypted_lets_encrypt_private_key_iv text,
    dns_rebinding_protection_enabled boolean DEFAULT true NOT NULL,
    default_project_deletion_protection boolean DEFAULT false NOT NULL,
    grafana_enabled boolean DEFAULT false NOT NULL,
    lock_memberships_to_ldap boolean DEFAULT false NOT NULL,
    time_tracking_limit_to_hours boolean DEFAULT false NOT NULL,
    grafana_url character varying DEFAULT '/-/grafana'::character varying NOT NULL,
    login_recaptcha_protection_enabled boolean DEFAULT false NOT NULL,
    outbound_local_requests_whitelist character varying(255)[] DEFAULT '{}'::character varying[] NOT NULL,
    raw_blob_request_limit integer DEFAULT 300 NOT NULL,
    allow_local_requests_from_web_hooks_and_services boolean DEFAULT false NOT NULL,
    allow_local_requests_from_system_hooks boolean DEFAULT true NOT NULL,
    asset_proxy_enabled boolean DEFAULT false NOT NULL,
    asset_proxy_url character varying,
    encrypted_asset_proxy_secret_key text,
    encrypted_asset_proxy_secret_key_iv character varying,
    static_objects_external_storage_url character varying(255),
    max_personal_access_token_lifetime integer,
    throttle_protected_paths_enabled boolean DEFAULT false NOT NULL,
    throttle_protected_paths_requests_per_period integer DEFAULT 10 NOT NULL,
    throttle_protected_paths_period_in_seconds integer DEFAULT 60 NOT NULL,
    protected_paths character varying(255)[] DEFAULT '{/users/password,/users/sign_in,/api/v3/session.json,/api/v3/session,/api/v4/session.json,/api/v4/session,/users,/users/confirmation,/unsubscribes/,/import/github/personal_access_token,/admin/session}'::character varying[],
    throttle_incident_management_notification_enabled boolean DEFAULT false NOT NULL,
    throttle_incident_management_notification_period_in_seconds integer DEFAULT 3600,
    throttle_incident_management_notification_per_period integer DEFAULT 3600,
    push_event_hooks_limit integer DEFAULT 3 NOT NULL,
    push_event_activities_limit integer DEFAULT 3 NOT NULL,
    custom_http_clone_url_root character varying(511),
    deletion_adjourned_period integer DEFAULT 7 NOT NULL,
    license_trial_ends_on date,
    eks_integration_enabled boolean DEFAULT false NOT NULL,
    eks_account_id character varying(128),
    eks_access_key_id character varying(128),
    encrypted_eks_secret_access_key_iv character varying(255),
    encrypted_eks_secret_access_key text,
    snowplow_app_id character varying,
    productivity_analytics_start_date timestamp with time zone,
    default_ci_config_path character varying(255),
    sourcegraph_enabled boolean DEFAULT false NOT NULL,
    sourcegraph_url character varying(255),
    sourcegraph_public_only boolean DEFAULT true NOT NULL,
    snippet_size_limit bigint DEFAULT 52428800 NOT NULL,
    minimum_password_length integer DEFAULT 8 NOT NULL,
    encrypted_akismet_api_key text,
    encrypted_akismet_api_key_iv character varying(255),
    encrypted_elasticsearch_aws_secret_access_key text,
    encrypted_elasticsearch_aws_secret_access_key_iv character varying(255),
    encrypted_recaptcha_private_key text,
    encrypted_recaptcha_private_key_iv character varying(255),
    encrypted_recaptcha_site_key text,
    encrypted_recaptcha_site_key_iv character varying(255),
    encrypted_slack_app_secret text,
    encrypted_slack_app_secret_iv character varying(255),
    encrypted_slack_app_verification_token text,
    encrypted_slack_app_verification_token_iv character varying(255),
    force_pages_access_control boolean DEFAULT false NOT NULL,
    updating_name_disabled_for_users boolean DEFAULT false NOT NULL,
    disable_overriding_approvers_per_merge_request boolean DEFAULT false NOT NULL,
    prevent_merge_requests_author_approval boolean DEFAULT false NOT NULL,
    prevent_merge_requests_committers_approval boolean DEFAULT false NOT NULL,
    email_restrictions_enabled boolean DEFAULT false NOT NULL,
    email_restrictions text,
    container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL,
    issues_create_limit integer DEFAULT 0 NOT NULL,
    push_rule_id bigint,
    group_owners_can_manage_default_branch_protection boolean DEFAULT true NOT NULL,
    container_registry_vendor text DEFAULT ''::text NOT NULL,
    container_registry_version text DEFAULT ''::text NOT NULL,
    container_registry_features text[] DEFAULT '{}'::text[] NOT NULL,
    spam_check_endpoint_url text,
    spam_check_endpoint_enabled boolean DEFAULT false NOT NULL,
    repository_storages_weighted jsonb DEFAULT '{}'::jsonb NOT NULL,
    max_import_size integer DEFAULT 0 NOT NULL,
    compliance_frameworks smallint[] DEFAULT '{}'::smallint[] NOT NULL,
    notify_on_unknown_sign_in boolean DEFAULT true NOT NULL,
    default_branch_name text,
    project_import_limit integer DEFAULT 6 NOT NULL,
    project_export_limit integer DEFAULT 6 NOT NULL,
    project_download_export_limit integer DEFAULT 1 NOT NULL,
    group_import_limit integer DEFAULT 6 NOT NULL,
    group_export_limit integer DEFAULT 6 NOT NULL,
    group_download_export_limit integer DEFAULT 1 NOT NULL,
    maintenance_mode boolean DEFAULT false NOT NULL,
    maintenance_mode_message text,
    wiki_page_max_content_bytes bigint DEFAULT 52428800 NOT NULL,
    enforce_namespace_storage_limit boolean DEFAULT false NOT NULL,
    container_registry_delete_tags_service_timeout integer DEFAULT 250 NOT NULL,
    kroki_url character varying,
    kroki_enabled boolean,
    gitpod_enabled boolean DEFAULT false NOT NULL,
    gitpod_url text DEFAULT 'https://gitpod.io/'::text,
    abuse_notification_email character varying,
    require_admin_approval_after_user_signup boolean DEFAULT true NOT NULL,
    help_page_documentation_base_url text,
    automatic_purchased_storage_allocation boolean DEFAULT false NOT NULL,
    encrypted_ci_jwt_signing_key text,
    encrypted_ci_jwt_signing_key_iv text,
    container_registry_expiration_policies_worker_capacity integer DEFAULT 4 NOT NULL,
    secret_detection_token_revocation_enabled boolean DEFAULT false NOT NULL,
    secret_detection_token_revocation_url text,
    encrypted_secret_detection_token_revocation_token text,
    encrypted_secret_detection_token_revocation_token_iv text,
    domain_denylist_enabled boolean DEFAULT false,
    domain_denylist text,
    domain_allowlist text,
    new_user_signups_cap integer,
    encrypted_cloud_license_auth_token text,
    encrypted_cloud_license_auth_token_iv text,
    secret_detection_revocation_token_types_url text,
    disable_feed_token boolean DEFAULT false NOT NULL,
    personal_access_token_prefix text DEFAULT 'glpat-'::text,
    rate_limiting_response_text text,
    invisible_captcha_enabled boolean DEFAULT false NOT NULL,
    container_registry_cleanup_tags_service_max_list_size integer DEFAULT 200 NOT NULL,
    git_two_factor_session_expiry integer DEFAULT 15 NOT NULL,
    keep_latest_artifact boolean DEFAULT true NOT NULL,
    notes_create_limit integer DEFAULT 300 NOT NULL,
    notes_create_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
    kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL,
    asset_proxy_whitelist text,
    admin_mode boolean DEFAULT false NOT NULL,
    external_pipeline_validation_service_timeout integer,
    encrypted_external_pipeline_validation_service_token text,
    encrypted_external_pipeline_validation_service_token_iv text,
    external_pipeline_validation_service_url text,
    throttle_unauthenticated_packages_api_requests_per_period integer DEFAULT 800 NOT NULL,
    throttle_unauthenticated_packages_api_period_in_seconds integer DEFAULT 15 NOT NULL,
    throttle_authenticated_packages_api_requests_per_period integer DEFAULT 1000 NOT NULL,
    throttle_authenticated_packages_api_period_in_seconds integer DEFAULT 15 NOT NULL,
    throttle_unauthenticated_packages_api_enabled boolean DEFAULT false NOT NULL,
    throttle_authenticated_packages_api_enabled boolean DEFAULT false NOT NULL,
    deactivate_dormant_users boolean DEFAULT false NOT NULL,
    whats_new_variant smallint DEFAULT 0,
    encrypted_spam_check_api_key bytea,
    encrypted_spam_check_api_key_iv bytea,
    floc_enabled boolean DEFAULT false NOT NULL,
    encrypted_elasticsearch_password bytea,
    encrypted_elasticsearch_password_iv bytea,
    diff_max_lines integer DEFAULT 50000 NOT NULL,
    diff_max_files integer DEFAULT 1000 NOT NULL,
    valid_runner_registrars character varying[] DEFAULT '{project,group}'::character varying[],
    encrypted_mailgun_signing_key bytea,
    encrypted_mailgun_signing_key_iv bytea,
    mailgun_events_enabled boolean DEFAULT false NOT NULL,
    usage_ping_features_enabled boolean DEFAULT false NOT NULL,
    encrypted_customers_dot_jwt_signing_key bytea,
    encrypted_customers_dot_jwt_signing_key_iv bytea,
    throttle_unauthenticated_files_api_requests_per_period integer DEFAULT 125 NOT NULL,
    throttle_unauthenticated_files_api_period_in_seconds integer DEFAULT 15 NOT NULL,
    throttle_authenticated_files_api_requests_per_period integer DEFAULT 500 NOT NULL,
    throttle_authenticated_files_api_period_in_seconds integer DEFAULT 15 NOT NULL,
    throttle_unauthenticated_files_api_enabled boolean DEFAULT false NOT NULL,
    throttle_authenticated_files_api_enabled boolean DEFAULT false NOT NULL,
    max_yaml_size_bytes bigint DEFAULT 2097152 NOT NULL,
    max_yaml_depth integer DEFAULT 100 NOT NULL,
    throttle_authenticated_git_lfs_requests_per_period integer DEFAULT 1000 NOT NULL,
    throttle_authenticated_git_lfs_period_in_seconds integer DEFAULT 60 NOT NULL,
    throttle_authenticated_git_lfs_enabled boolean DEFAULT false NOT NULL,
    user_deactivation_emails_enabled boolean DEFAULT true NOT NULL,
    throttle_unauthenticated_api_enabled boolean DEFAULT false NOT NULL,
    throttle_unauthenticated_api_requests_per_period integer DEFAULT 3600 NOT NULL,
    throttle_unauthenticated_api_period_in_seconds integer DEFAULT 3600 NOT NULL,
    jobs_per_stage_page_size integer DEFAULT 200 NOT NULL,
    sidekiq_job_limiter_mode smallint DEFAULT 1 NOT NULL,
    sidekiq_job_limiter_compression_threshold_bytes integer DEFAULT 100000 NOT NULL,
    sidekiq_job_limiter_limit_bytes integer DEFAULT 0 NOT NULL,
    suggest_pipeline_enabled boolean DEFAULT true NOT NULL,
    throttle_unauthenticated_deprecated_api_requests_per_period integer DEFAULT 1800 NOT NULL,
    throttle_unauthenticated_deprecated_api_period_in_seconds integer DEFAULT 3600 NOT NULL,
    throttle_unauthenticated_deprecated_api_enabled boolean DEFAULT false NOT NULL,
    throttle_authenticated_deprecated_api_requests_per_period integer DEFAULT 3600 NOT NULL,
    throttle_authenticated_deprecated_api_period_in_seconds integer DEFAULT 3600 NOT NULL,
    throttle_authenticated_deprecated_api_enabled boolean DEFAULT false NOT NULL,
    dependency_proxy_ttl_group_policy_worker_capacity smallint DEFAULT 2 NOT NULL,
    content_validation_endpoint_url text,
    encrypted_content_validation_api_key bytea,
    encrypted_content_validation_api_key_iv bytea,
    content_validation_endpoint_enabled boolean DEFAULT false NOT NULL,
    sentry_enabled boolean DEFAULT false NOT NULL,
    sentry_dsn text,
    sentry_clientside_dsn text,
    sentry_environment text,
    max_ssh_key_lifetime integer,
    static_objects_external_storage_auth_token_encrypted text,
    future_subscriptions jsonb DEFAULT '[]'::jsonb NOT NULL,
    runner_token_expiration_interval integer,
    group_runner_token_expiration_interval integer,
    project_runner_token_expiration_interval integer,
    ecdsa_sk_key_restriction integer DEFAULT 0 NOT NULL,
    ed25519_sk_key_restriction integer DEFAULT 0 NOT NULL,
    users_get_by_id_limit integer DEFAULT 300 NOT NULL,
    users_get_by_id_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
    container_registry_expiration_policies_caching boolean DEFAULT true NOT NULL,
    search_rate_limit integer DEFAULT 300 NOT NULL,
    search_rate_limit_unauthenticated integer DEFAULT 100 NOT NULL,
    encrypted_database_grafana_api_key bytea,
    encrypted_database_grafana_api_key_iv bytea,
    database_grafana_api_url text,
    database_grafana_tag text,
    public_runner_releases_url text DEFAULT 'https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases'::text NOT NULL,
    password_uppercase_required boolean DEFAULT false NOT NULL,
    password_lowercase_required boolean DEFAULT false NOT NULL,
    password_number_required boolean DEFAULT false NOT NULL,
    password_symbol_required boolean DEFAULT false NOT NULL,
    encrypted_arkose_labs_public_api_key bytea,
    encrypted_arkose_labs_public_api_key_iv bytea,
    encrypted_arkose_labs_private_api_key bytea,
    encrypted_arkose_labs_private_api_key_iv bytea,
    delete_inactive_projects boolean DEFAULT false NOT NULL,
    inactive_projects_delete_after_months integer DEFAULT 2 NOT NULL,
    inactive_projects_min_size_mb integer DEFAULT 0 NOT NULL,
    inactive_projects_send_warning_email_after_months integer DEFAULT 1 NOT NULL,
    arkose_labs_namespace text DEFAULT 'client'::text NOT NULL,
    max_export_size integer DEFAULT 0,
    encrypted_slack_app_signing_secret bytea,
    encrypted_slack_app_signing_secret_iv bytea,
    pipeline_limit_per_project_user_sha integer DEFAULT 0 NOT NULL,
    dingtalk_integration_enabled boolean DEFAULT false NOT NULL,
    encrypted_dingtalk_corpid bytea,
    encrypted_dingtalk_corpid_iv bytea,
    encrypted_dingtalk_app_key bytea,
    encrypted_dingtalk_app_key_iv bytea,
    encrypted_dingtalk_app_secret bytea,
    encrypted_dingtalk_app_secret_iv bytea,
    jira_connect_application_key text,
    globally_allowed_ips text DEFAULT ''::text NOT NULL,
    license_usage_data_exported boolean DEFAULT false NOT NULL,
    phone_verification_code_enabled boolean DEFAULT false NOT NULL,
    max_number_of_repository_downloads smallint DEFAULT 0 NOT NULL,
    max_number_of_repository_downloads_within_time_period integer DEFAULT 0 NOT NULL,
    feishu_integration_enabled boolean DEFAULT false NOT NULL,
    encrypted_feishu_app_key bytea,
    encrypted_feishu_app_key_iv bytea,
    encrypted_feishu_app_secret bytea,
    encrypted_feishu_app_secret_iv bytea,
    error_tracking_enabled boolean DEFAULT false NOT NULL,
    error_tracking_api_url text,
    git_rate_limit_users_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
    error_tracking_access_token_encrypted text,
    invitation_flow_enforcement boolean DEFAULT false NOT NULL,
    deactivate_dormant_users_period integer DEFAULT 90 NOT NULL,
    auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL,
    max_pages_custom_domains_per_project integer DEFAULT 0 NOT NULL,
    cube_api_base_url text,
    encrypted_cube_api_key bytea,
    encrypted_cube_api_key_iv bytea,
    dashboard_limit_enabled boolean DEFAULT false NOT NULL,
    dashboard_limit integer DEFAULT 0 NOT NULL,
    can_create_group boolean DEFAULT true NOT NULL,
    jira_connect_proxy_url text,
    password_expiration_enabled boolean DEFAULT false NOT NULL,
    password_expires_in_days integer DEFAULT 90 NOT NULL,
    password_expires_notice_before_days integer DEFAULT 7 NOT NULL,
    product_analytics_enabled boolean DEFAULT false NOT NULL,
    email_confirmation_setting smallint DEFAULT 0,
    disable_admin_oauth_scopes boolean DEFAULT false NOT NULL,
    default_preferred_language text DEFAULT 'en'::text NOT NULL,
    disable_download_button boolean DEFAULT false NOT NULL,
    encrypted_telesign_customer_xid bytea,
    encrypted_telesign_customer_xid_iv bytea,
    encrypted_telesign_api_key bytea,
    encrypted_telesign_api_key_iv bytea,
    disable_personal_access_tokens boolean DEFAULT false NOT NULL,
    max_terraform_state_size_bytes integer DEFAULT 0 NOT NULL,
    bulk_import_enabled boolean DEFAULT false NOT NULL,
    allow_runner_registration_token boolean DEFAULT true NOT NULL,
    user_defaults_to_private_profile boolean DEFAULT false NOT NULL,
    allow_possible_spam boolean DEFAULT false NOT NULL,
    default_syntax_highlighting_theme integer DEFAULT 1 NOT NULL,
    search_max_shard_size_gb integer DEFAULT 50 NOT NULL,
    search_max_docs_denominator integer DEFAULT 5000000 NOT NULL,
    search_min_docs_before_rollover integer DEFAULT 100000 NOT NULL,
    deactivation_email_additional_text text,
    jira_connect_public_key_storage_enabled boolean DEFAULT false NOT NULL,
    git_rate_limit_users_alertlist integer[] DEFAULT '{}'::integer[] NOT NULL,
    allow_deploy_tokens_and_keys_with_external_authn boolean DEFAULT false NOT NULL,
    security_policy_global_group_approvers_enabled boolean DEFAULT true NOT NULL,
    projects_api_rate_limit_unauthenticated integer DEFAULT 400 NOT NULL,
    deny_all_requests_except_allowed boolean DEFAULT false NOT NULL,
    product_analytics_data_collector_host text,
    lock_memberships_to_saml boolean DEFAULT false NOT NULL,
    gitlab_dedicated_instance boolean DEFAULT false NOT NULL,
    update_runner_versions_enabled boolean DEFAULT true NOT NULL,
    database_max_running_batched_background_migrations integer DEFAULT 2 NOT NULL,
    encrypted_product_analytics_configurator_connection_string bytea,
    encrypted_product_analytics_configurator_connection_string_iv bytea,
    silent_mode_enabled boolean DEFAULT false NOT NULL,
    package_metadata_purl_types smallint[] DEFAULT '{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17}'::smallint[],
    ci_max_includes integer DEFAULT 150 NOT NULL,
    remember_me_enabled boolean DEFAULT true NOT NULL,
    diagramsnet_enabled boolean DEFAULT true NOT NULL,
    diagramsnet_url text DEFAULT 'https://embed.diagrams.net'::text,
    allow_account_deletion boolean DEFAULT true NOT NULL,
    wiki_asciidoc_allow_uri_includes boolean DEFAULT false NOT NULL,
    namespace_aggregation_schedule_lease_duration_in_seconds integer DEFAULT 300 NOT NULL,
    container_registry_data_repair_detail_worker_max_concurrency integer DEFAULT 2 NOT NULL,
    vertex_ai_host text,
    vertex_ai_project text,
    delete_unconfirmed_users boolean DEFAULT false NOT NULL,
    unconfirmed_users_delete_after_days integer DEFAULT 7 NOT NULL,
    default_branch_protection_defaults jsonb DEFAULT '{}'::jsonb NOT NULL,
    gitlab_shell_operation_limit integer DEFAULT 600,
    protected_paths_for_get_request text[] DEFAULT '{}'::text[] NOT NULL,
    namespace_storage_forks_cost_factor double precision DEFAULT 1.0 NOT NULL,
    bulk_import_max_download_file_size bigint DEFAULT 5120 NOT NULL,
    max_import_remote_file_size bigint DEFAULT 10240 NOT NULL,
    max_decompressed_archive_size integer DEFAULT 25600 NOT NULL,
    sentry_clientside_traces_sample_rate double precision DEFAULT 0.0 NOT NULL,
    prometheus_alert_db_indicators_settings jsonb,
    ci_max_total_yaml_size_bytes integer DEFAULT 314572800 NOT NULL,
    decompress_archive_file_timeout integer DEFAULT 210 NOT NULL,
    search_rate_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
    snowplow_database_collector_hostname text,
    container_registry_db_enabled boolean DEFAULT false NOT NULL,
    failed_login_attempts_unlock_period_in_minutes integer,
    max_login_attempts integer,
    project_jobs_api_rate_limit integer DEFAULT 600 NOT NULL,
    math_rendering_limits_enabled boolean DEFAULT true NOT NULL,
    service_access_tokens_expiration_enforced boolean DEFAULT true NOT NULL,
    make_profile_private boolean DEFAULT true NOT NULL,
    enable_artifact_external_redirect_warning_page boolean DEFAULT true NOT NULL,
    allow_project_creation_for_guest_and_below boolean DEFAULT true NOT NULL,
    update_namespace_name_rate_limit smallint DEFAULT 120 NOT NULL,
    pre_receive_secret_detection_enabled boolean DEFAULT false NOT NULL,
    can_create_organization boolean DEFAULT true NOT NULL,
    bulk_import_concurrent_pipeline_batch_limit smallint DEFAULT 25 NOT NULL,
    web_ide_oauth_application_id bigint,
    instance_level_ai_beta_features_enabled boolean DEFAULT false NOT NULL,
    security_txt_content text,
    encrypted_arkose_labs_data_exchange_key bytea,
    encrypted_arkose_labs_data_exchange_key_iv bytea,
    rate_limits jsonb DEFAULT '{}'::jsonb NOT NULL,
    enable_member_promotion_management boolean DEFAULT false NOT NULL,
    lock_math_rendering_limits_enabled boolean DEFAULT false NOT NULL,
    security_approval_policies_limit integer DEFAULT 5 NOT NULL,
    encrypted_arkose_labs_client_xid bytea,
    encrypted_arkose_labs_client_xid_iv bytea,
    encrypted_arkose_labs_client_secret bytea,
    encrypted_arkose_labs_client_secret_iv bytea,
    duo_features_enabled boolean DEFAULT true NOT NULL,
    lock_duo_features_enabled boolean DEFAULT false NOT NULL,
    asciidoc_max_includes smallint DEFAULT 32 NOT NULL,
    clickhouse jsonb DEFAULT '{}'::jsonb NOT NULL,
    include_optional_metrics_in_service_ping boolean DEFAULT true NOT NULL,
    zoekt_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    service_ping_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    package_registry jsonb DEFAULT '{}'::jsonb NOT NULL,
    rate_limits_unauthenticated_git_http jsonb DEFAULT '{}'::jsonb NOT NULL,
    importers jsonb DEFAULT '{}'::jsonb NOT NULL,
    code_creation jsonb DEFAULT '{}'::jsonb NOT NULL,
    code_suggestions_api_rate_limit integer DEFAULT 60 NOT NULL,
    ai_action_api_rate_limit integer DEFAULT 160 NOT NULL,
    require_personal_access_token_expiry boolean DEFAULT true NOT NULL,
    duo_workflow jsonb DEFAULT '{}'::jsonb,
    max_artifacts_content_include_size integer DEFAULT 5242880 NOT NULL,
    max_number_of_vulnerabilities_per_project integer,
    cluster_agents jsonb DEFAULT '{}'::jsonb NOT NULL,
    observability_backend_ssl_verification_enabled boolean DEFAULT true NOT NULL,
    pages jsonb DEFAULT '{}'::jsonb NOT NULL,
    security_policies jsonb DEFAULT '{}'::jsonb NOT NULL,
    spp_repository_pipeline_access boolean DEFAULT false NOT NULL,
    lock_spp_repository_pipeline_access boolean DEFAULT false NOT NULL,
    required_instance_ci_template text,
    enforce_ci_inbound_job_token_scope_enabled boolean DEFAULT true NOT NULL,
    allow_top_level_group_owners_to_create_service_accounts boolean DEFAULT false NOT NULL,
    sign_in_restrictions jsonb DEFAULT '{}'::jsonb NOT NULL,
    transactional_emails jsonb DEFAULT '{}'::jsonb NOT NULL,
    identity_verification_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    integrations jsonb DEFAULT '{}'::jsonb NOT NULL,
    user_seat_management jsonb DEFAULT '{}'::jsonb NOT NULL,
    secret_detection_service_url text DEFAULT ''::text NOT NULL,
    encrypted_secret_detection_service_auth_token bytea,
    encrypted_secret_detection_service_auth_token_iv bytea,
    resource_usage_limits jsonb DEFAULT '{}'::jsonb NOT NULL,
    show_migrate_from_jenkins_banner boolean DEFAULT true NOT NULL,
    encrypted_ci_job_token_signing_key bytea,
    encrypted_ci_job_token_signing_key_iv bytea,
    elasticsearch jsonb DEFAULT '{}'::jsonb NOT NULL,
    oauth_provider jsonb DEFAULT '{}'::jsonb NOT NULL,
    observability_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    search jsonb DEFAULT '{}'::jsonb NOT NULL,
    anti_abuse_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    secret_push_protection_available boolean DEFAULT false,
    vscode_extension_marketplace jsonb DEFAULT '{}'::jsonb NOT NULL,
    token_prefixes jsonb DEFAULT '{}'::jsonb NOT NULL,
    ci_cd_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    database_reindexing jsonb DEFAULT '{}'::jsonb NOT NULL,
    duo_chat jsonb DEFAULT '{}'::jsonb NOT NULL,
    group_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    model_prompt_cache_enabled boolean DEFAULT true NOT NULL,
    lock_model_prompt_cache_enabled boolean DEFAULT false NOT NULL,
    response_limits jsonb DEFAULT '{}'::jsonb NOT NULL,
    web_based_commit_signing_enabled boolean DEFAULT false NOT NULL,
    lock_web_based_commit_signing_enabled boolean DEFAULT false NOT NULL,
    tmp_asset_proxy_secret_key jsonb,
    editor_extensions jsonb DEFAULT '{}'::jsonb NOT NULL,
    security_and_compliance_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    sdrs_url text,
    default_profile_preferences jsonb DEFAULT '{}'::jsonb NOT NULL,
    sdrs_enabled boolean DEFAULT false NOT NULL,
    sdrs_jwt_signing_key jsonb,
    CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
    CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
    CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)),
    CONSTRAINT app_settings_failed_login_attempts_unlock_period_positive CHECK ((failed_login_attempts_unlock_period_in_minutes > 0)),
    CONSTRAINT app_settings_git_rate_limit_users_alertlist_max_usernames CHECK ((cardinality(git_rate_limit_users_alertlist) <= 100)),
    CONSTRAINT app_settings_git_rate_limit_users_allowlist_max_usernames CHECK ((cardinality(git_rate_limit_users_allowlist) <= 100)),
    CONSTRAINT app_settings_max_decompressed_archive_size_positive CHECK ((max_decompressed_archive_size >= 0)),
    CONSTRAINT app_settings_max_login_attempts_positive CHECK ((max_login_attempts > 0)),
    CONSTRAINT app_settings_max_pages_custom_domains_per_project_check CHECK ((max_pages_custom_domains_per_project >= 0)),
    CONSTRAINT app_settings_max_terraform_state_size_bytes_check CHECK ((max_terraform_state_size_bytes >= 0)),
    CONSTRAINT app_settings_protected_paths_max_length CHECK ((cardinality(protected_paths_for_get_request) <= 100)),
    CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
    CONSTRAINT app_settings_registry_repair_worker_max_concurrency_positive CHECK ((container_registry_data_repair_detail_worker_max_concurrency >= 0)),
    CONSTRAINT app_settings_yaml_max_depth_positive CHECK ((max_yaml_depth > 0)),
    CONSTRAINT app_settings_yaml_max_size_positive CHECK ((max_yaml_size_bytes > 0)),
    CONSTRAINT application_settings_oauth_provider_settings_hash CHECK ((jsonb_typeof(oauth_provider) = 'object'::text)),
    CONSTRAINT check_0542340619 CHECK ((char_length(diagramsnet_url) <= 2048)),
    CONSTRAINT check_12f01f1dcd CHECK ((char_length(vertex_ai_project) <= 255)),
    CONSTRAINT check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)),
    CONSTRAINT check_2b820eaac3 CHECK ((char_length(database_grafana_tag) <= 255)),
    CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
    CONSTRAINT check_32710817e9 CHECK ((char_length(static_objects_external_storage_auth_token_encrypted) <= 255)),
    CONSTRAINT check_3455368420 CHECK ((char_length(database_grafana_api_url) <= 255)),
    CONSTRAINT check_3b22213b72 CHECK ((char_length(snowplow_database_collector_hostname) <= 255)),
    CONSTRAINT check_3def0f1829 CHECK ((char_length(sentry_clientside_dsn) <= 255)),
    CONSTRAINT check_4847426287 CHECK ((char_length(jira_connect_proxy_url) <= 255)),
    CONSTRAINT check_492cc1354d CHECK ((char_length(error_tracking_api_url) <= 255)),
    CONSTRAINT check_4f8b811780 CHECK ((char_length(sentry_dsn) <= 255)),
    CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
    CONSTRAINT check_5688c70478 CHECK ((char_length(error_tracking_access_token_encrypted) <= 255)),
    CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)),
    CONSTRAINT check_5a84c3ffdc CHECK ((char_length(content_validation_endpoint_url) <= 255)),
    CONSTRAINT check_5bcba483c4 CHECK ((char_length(sentry_environment) <= 255)),
    CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)),
    CONSTRAINT check_7227fad848 CHECK ((char_length(rate_limiting_response_text) <= 255)),
    CONSTRAINT check_72c984b2a5 CHECK ((char_length(product_analytics_data_collector_host) <= 255)),
    CONSTRAINT check_734cc9407a CHECK ((char_length(globally_allowed_ips) <= 255)),
    CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)),
    CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)),
    CONSTRAINT check_8dca35398a CHECK ((char_length(public_runner_releases_url) <= 255)),
    CONSTRAINT check_8e7df605a1 CHECK ((char_length(cube_api_base_url) <= 512)),
    CONSTRAINT check_9a42a7cfdd CHECK ((char_length(sdrs_url) <= 255)),
    CONSTRAINT check_9a719834eb CHECK ((char_length(secret_detection_token_revocation_url) <= 255)),
    CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)),
    CONSTRAINT check_a5704163cc CHECK ((char_length(secret_detection_revocation_token_types_url) <= 255)),
    CONSTRAINT check_ae53cf7f82 CHECK ((char_length(vertex_ai_host) <= 255)),
    CONSTRAINT check_anti_abuse_settings_is_hash CHECK ((jsonb_typeof(anti_abuse_settings) = 'object'::text)),
    CONSTRAINT check_app_settings_namespace_storage_forks_cost_factor_range CHECK (((namespace_storage_forks_cost_factor >= (0)::double precision) AND (namespace_storage_forks_cost_factor <= (1)::double precision))),
    CONSTRAINT check_app_settings_sentry_clientside_traces_sample_rate_range CHECK (((sentry_clientside_traces_sample_rate >= (0)::double precision) AND (sentry_clientside_traces_sample_rate <= (1)::double precision))),
    CONSTRAINT check_application_settings_ci_cd_settings_is_hash CHECK ((jsonb_typeof(ci_cd_settings) = 'object'::text)),
    CONSTRAINT check_application_settings_clickhouse_is_hash CHECK ((jsonb_typeof(clickhouse) = 'object'::text)),
    CONSTRAINT check_application_settings_cluster_agents_is_hash CHECK ((jsonb_typeof(cluster_agents) = 'object'::text)),
    CONSTRAINT check_application_settings_code_creation_is_hash CHECK ((jsonb_typeof(code_creation) = 'object'::text)),
    CONSTRAINT check_application_settings_database_reindexing_is_hash CHECK ((jsonb_typeof(database_reindexing) = 'object'::text)),
    CONSTRAINT check_application_settings_duo_chat_is_hash CHECK ((jsonb_typeof(duo_chat) = 'object'::text)),
    CONSTRAINT check_application_settings_duo_workflow_is_hash CHECK ((jsonb_typeof(duo_workflow) = 'object'::text)),
    CONSTRAINT check_application_settings_editor_extensions_is_hash CHECK ((jsonb_typeof(editor_extensions) = 'object'::text)),
    CONSTRAINT check_application_settings_elasticsearch_is_hash CHECK ((jsonb_typeof(elasticsearch) = 'object'::text)),
    CONSTRAINT check_application_settings_group_settings_is_hash CHECK ((jsonb_typeof(group_settings) = 'object'::text)),
    CONSTRAINT check_application_settings_importers_is_hash CHECK ((jsonb_typeof(importers) = 'object'::text)),
    CONSTRAINT check_application_settings_integrations_is_hash CHECK ((jsonb_typeof(integrations) = 'object'::text)),
    CONSTRAINT check_application_settings_o11y_settings_is_hash CHECK ((jsonb_typeof(observability_settings) = 'object'::text)),
    CONSTRAINT check_application_settings_package_registry_is_hash CHECK ((jsonb_typeof(package_registry) = 'object'::text)),
    CONSTRAINT check_application_settings_rate_limits_is_hash CHECK ((jsonb_typeof(rate_limits) = 'object'::text)),
    CONSTRAINT check_application_settings_rate_limits_unauth_git_http_is_hash CHECK ((jsonb_typeof(rate_limits_unauthenticated_git_http) = 'object'::text)),
    CONSTRAINT check_application_settings_security_policies_is_hash CHECK ((jsonb_typeof(security_policies) = 'object'::text)),
    CONSTRAINT check_application_settings_service_ping_settings_is_hash CHECK ((jsonb_typeof(service_ping_settings) = 'object'::text)),
    CONSTRAINT check_application_settings_sign_in_restrictions_is_hash CHECK ((jsonb_typeof(sign_in_restrictions) = 'object'::text)),
    CONSTRAINT check_application_settings_token_prefixes_is_hash CHECK ((jsonb_typeof(token_prefixes) = 'object'::text)),
    CONSTRAINT check_application_settings_transactional_emails_is_hash CHECK ((jsonb_typeof(transactional_emails) = 'object'::text)),
    CONSTRAINT check_application_settings_vscode_extension_marketplace_is_hash CHECK ((jsonb_typeof(vscode_extension_marketplace) = 'object'::text)),
    CONSTRAINT check_b8c74ea5b3 CHECK ((char_length(deactivation_email_additional_text) <= 1000)),
    CONSTRAINT check_babd774f3c CHECK ((char_length(secret_detection_service_url) <= 255)),
    CONSTRAINT check_be6ab41dcc CHECK ((secret_push_protection_available IS NOT NULL)),
    CONSTRAINT check_bf5157a366 CHECK ((char_length(required_instance_ci_template) <= 1024)),
    CONSTRAINT check_cdfbd99405 CHECK ((char_length(security_txt_content) <= 2048)),
    CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)),
    CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)),
    CONSTRAINT check_e2692d7523 CHECK ((char_length(default_preferred_language) <= 32)),
    CONSTRAINT check_e2dd6e290a CHECK ((char_length(jira_connect_application_key) <= 255)),
    CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)),
    CONSTRAINT check_ef6176834f CHECK ((char_length(encrypted_cloud_license_auth_token_iv) <= 255)),
    CONSTRAINT check_identity_verification_settings_is_hash CHECK ((jsonb_typeof(identity_verification_settings) = 'object'::text)),
    CONSTRAINT check_security_and_compliance_settings_is_hash CHECK ((jsonb_typeof(security_and_compliance_settings) = 'object'::text))
);

COMMENT ON COLUMN application_settings.content_validation_endpoint_url IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_content_validation_api_key IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_content_validation_api_key_iv IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.content_validation_endpoint_enabled IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.dingtalk_integration_enabled IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_dingtalk_corpid IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_dingtalk_corpid_iv IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_key IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_key_iv IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_secret IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_dingtalk_app_secret_iv IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.phone_verification_code_enabled IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.feishu_integration_enabled IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_feishu_app_key IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_feishu_app_key_iv IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_feishu_app_secret IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.encrypted_feishu_app_secret_iv IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.password_expiration_enabled IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.password_expires_in_days IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.password_expires_notice_before_days IS 'JiHu-specific column';

COMMENT ON COLUMN application_settings.disable_download_button IS 'JiHu-specific column';

CREATE SEQUENCE application_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE application_settings_id_seq OWNED BY application_settings.id;

CREATE TABLE approval_group_rules (
    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,
    approvals_required smallint DEFAULT 0 NOT NULL,
    report_type smallint,
    rule_type smallint DEFAULT 1 NOT NULL,
    security_orchestration_policy_configuration_id bigint,
    scan_result_policy_id bigint,
    name text NOT NULL,
    applies_to_all_protected_branches boolean DEFAULT false NOT NULL,
    approval_policy_rule_id bigint,
    CONSTRAINT check_25d42add43 CHECK ((char_length(name) <= 255))
);

CREATE TABLE approval_group_rules_groups (
    id bigint NOT NULL,
    approval_group_rule_id bigint NOT NULL,
    group_id bigint NOT NULL
);

CREATE SEQUENCE approval_group_rules_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_group_rules_groups_id_seq OWNED BY approval_group_rules_groups.id;

CREATE SEQUENCE approval_group_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_group_rules_id_seq OWNED BY approval_group_rules.id;

CREATE TABLE approval_group_rules_protected_branches (
    id bigint NOT NULL,
    approval_group_rule_id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    group_id bigint,
    CONSTRAINT check_b14ec67f68 CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE approval_group_rules_protected_branches_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_group_rules_protected_branches_id_seq OWNED BY approval_group_rules_protected_branches.id;

CREATE TABLE approval_group_rules_users (
    id bigint NOT NULL,
    approval_group_rule_id bigint NOT NULL,
    user_id bigint NOT NULL,
    group_id bigint,
    CONSTRAINT check_6db3034f1c CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE approval_group_rules_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_group_rules_users_id_seq OWNED BY approval_group_rules_users.id;

CREATE TABLE approval_merge_request_rule_sources (
    id bigint NOT NULL,
    approval_merge_request_rule_id bigint NOT NULL,
    approval_project_rule_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_f82666a937 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE approval_merge_request_rule_sources_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_merge_request_rule_sources_id_seq OWNED BY approval_merge_request_rule_sources.id;

CREATE TABLE approval_merge_request_rules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    merge_request_id bigint NOT NULL,
    approvals_required smallint DEFAULT 0 NOT NULL,
    name character varying NOT NULL,
    rule_type smallint DEFAULT 1 NOT NULL,
    report_type smallint,
    section text,
    modified_from_project_rule boolean DEFAULT false NOT NULL,
    orchestration_policy_idx smallint,
    vulnerabilities_allowed smallint DEFAULT 0 NOT NULL,
    scanners text[] DEFAULT '{}'::text[] NOT NULL,
    severity_levels text[] DEFAULT '{}'::text[] NOT NULL,
    vulnerability_states text[] DEFAULT '{new_needs_triage,new_dismissed}'::text[] NOT NULL,
    security_orchestration_policy_configuration_id bigint,
    scan_result_policy_id bigint,
    applicable_post_merge boolean,
    project_id bigint,
    approval_policy_rule_id bigint,
    role_approvers integer[] DEFAULT '{}'::integer[] NOT NULL,
    approval_policy_action_idx smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_6fca5928b2 CHECK ((char_length(section) <= 255)),
    CONSTRAINT check_90caab37e0 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_approval_m_r_rules_allowed_role_approvers_valid_entries CHECK (((role_approvers = '{}'::integer[]) OR (role_approvers <@ ARRAY[20, 30, 40, 50, 60])))
);

CREATE TABLE approval_merge_request_rules_approved_approvers (
    id bigint NOT NULL,
    approval_merge_request_rule_id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_4e73655ce3 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE approval_merge_request_rules_approved_approvers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_merge_request_rules_approved_approvers_id_seq OWNED BY approval_merge_request_rules_approved_approvers.id;

CREATE TABLE approval_merge_request_rules_groups (
    id bigint NOT NULL,
    approval_merge_request_rule_id bigint NOT NULL,
    group_id bigint NOT NULL
);

CREATE SEQUENCE approval_merge_request_rules_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_merge_request_rules_groups_id_seq OWNED BY approval_merge_request_rules_groups.id;

CREATE SEQUENCE approval_merge_request_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_merge_request_rules_id_seq OWNED BY approval_merge_request_rules.id;

CREATE TABLE approval_merge_request_rules_users (
    id bigint NOT NULL,
    approval_merge_request_rule_id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint
);

CREATE SEQUENCE approval_merge_request_rules_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_merge_request_rules_users_id_seq OWNED BY approval_merge_request_rules_users.id;

CREATE TABLE approval_policy_rule_project_links (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    approval_policy_rule_id bigint NOT NULL
);

CREATE SEQUENCE approval_policy_rule_project_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_policy_rule_project_links_id_seq OWNED BY approval_policy_rule_project_links.id;

CREATE TABLE approval_policy_rules (
    id bigint NOT NULL,
    security_policy_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    rule_index smallint NOT NULL,
    type smallint NOT NULL,
    content jsonb DEFAULT '{}'::jsonb NOT NULL,
    security_policy_management_project_id bigint NOT NULL
);

CREATE SEQUENCE approval_policy_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_policy_rules_id_seq OWNED BY approval_policy_rules.id;

CREATE TABLE approval_project_rules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    approvals_required smallint DEFAULT 0 NOT NULL,
    name character varying NOT NULL,
    rule_type smallint DEFAULT 0 NOT NULL,
    scanners text[] DEFAULT '{}'::text[],
    vulnerabilities_allowed smallint DEFAULT 0 NOT NULL,
    severity_levels text[] DEFAULT '{}'::text[] NOT NULL,
    report_type smallint,
    vulnerability_states text[] DEFAULT '{new_needs_triage,new_dismissed}'::text[] NOT NULL,
    orchestration_policy_idx smallint,
    applies_to_all_protected_branches boolean DEFAULT false NOT NULL,
    security_orchestration_policy_configuration_id bigint,
    scan_result_policy_id bigint,
    approval_policy_rule_id bigint,
    approval_policy_action_idx smallint DEFAULT 0 NOT NULL
);

CREATE TABLE approval_project_rules_groups (
    id bigint NOT NULL,
    approval_project_rule_id bigint NOT NULL,
    group_id bigint NOT NULL
);

CREATE SEQUENCE approval_project_rules_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_project_rules_groups_id_seq OWNED BY approval_project_rules_groups.id;

CREATE SEQUENCE approval_project_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_project_rules_id_seq OWNED BY approval_project_rules.id;

CREATE TABLE approval_project_rules_protected_branches (
    approval_project_rule_id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_3cae655261 CHECK ((project_id IS NOT NULL))
);

CREATE TABLE approval_project_rules_users (
    id bigint NOT NULL,
    approval_project_rule_id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_26058e3982 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE approval_project_rules_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approval_project_rules_users_id_seq OWNED BY approval_project_rules_users.id;

CREATE TABLE approvals (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    patch_id_sha bytea,
    project_id bigint,
    CONSTRAINT check_9da7c942dc CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE approvals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approvals_id_seq OWNED BY approvals.id;

CREATE TABLE approver_groups (
    id bigint NOT NULL,
    target_id bigint NOT NULL,
    target_type character varying NOT NULL,
    group_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);

CREATE SEQUENCE approver_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approver_groups_id_seq OWNED BY approver_groups.id;

CREATE TABLE approvers (
    id bigint NOT NULL,
    target_id bigint NOT NULL,
    target_type character varying,
    user_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);

CREATE SEQUENCE approvers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE approvers_id_seq OWNED BY approvers.id;

CREATE TABLE ar_internal_metadata (
    key character varying NOT NULL,
    value character varying,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL
);

CREATE TABLE arkose_sessions (
    id bigint NOT NULL,
    session_created_at timestamp with time zone,
    checked_answer_at timestamp with time zone,
    verified_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    global_score integer,
    custom_score integer,
    challenge_shown boolean DEFAULT false NOT NULL,
    challenge_solved boolean DEFAULT false NOT NULL,
    session_is_legit boolean DEFAULT true NOT NULL,
    is_tor boolean DEFAULT false NOT NULL,
    is_vpn boolean DEFAULT false NOT NULL,
    is_proxy boolean DEFAULT false NOT NULL,
    is_bot boolean DEFAULT false NOT NULL,
    session_xid text NOT NULL,
    telltale_user text,
    user_agent text,
    user_language_shown text,
    device_xid text,
    telltale_list text[] DEFAULT '{}'::text[] NOT NULL,
    user_ip text,
    country text,
    region text,
    city text,
    isp text,
    connection_type text,
    risk_band text,
    risk_category text,
    CONSTRAINT check_1a6f4682be CHECK ((char_length(user_agent) <= 255)),
    CONSTRAINT check_1ccf4778d0 CHECK ((char_length(telltale_user) <= 128)),
    CONSTRAINT check_20eae4e360 CHECK ((char_length(risk_band) <= 64)),
    CONSTRAINT check_394c3c0153 CHECK ((char_length(session_xid) <= 64)),
    CONSTRAINT check_5a92894aa9 CHECK ((char_length(device_xid) <= 64)),
    CONSTRAINT check_8d83d12f95 CHECK ((char_length(user_ip) <= 64)),
    CONSTRAINT check_940ffc498d CHECK ((char_length(risk_category) <= 64)),
    CONSTRAINT check_9b4c7551e7 CHECK ((char_length(city) <= 64)),
    CONSTRAINT check_b81756eb85 CHECK ((char_length(isp) <= 128)),
    CONSTRAINT check_ba409cc401 CHECK ((char_length(region) <= 64)),
    CONSTRAINT check_c745f5db92 CHECK ((char_length(country) <= 64)),
    CONSTRAINT check_cd4cc1f7dc CHECK ((char_length(user_language_shown) <= 64)),
    CONSTRAINT check_d4fd1df18c CHECK ((char_length(connection_type) <= 64))
);

CREATE SEQUENCE arkose_sessions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE arkose_sessions_id_seq OWNED BY arkose_sessions.id;

CREATE TABLE atlassian_identities (
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    expires_at timestamp with time zone,
    extern_uid text NOT NULL,
    encrypted_token bytea,
    encrypted_token_iv bytea,
    encrypted_refresh_token bytea,
    encrypted_refresh_token_iv bytea,
    CONSTRAINT atlassian_identities_refresh_token_iv_length_constraint CHECK ((octet_length(encrypted_refresh_token_iv) <= 12)),
    CONSTRAINT atlassian_identities_refresh_token_length_constraint CHECK ((octet_length(encrypted_refresh_token) <= 5000)),
    CONSTRAINT atlassian_identities_token_iv_length_constraint CHECK ((octet_length(encrypted_token_iv) <= 12)),
    CONSTRAINT atlassian_identities_token_length_constraint CHECK ((octet_length(encrypted_token) <= 5120)),
    CONSTRAINT check_32f5779763 CHECK ((char_length(extern_uid) <= 255))
);

CREATE SEQUENCE atlassian_identities_user_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE atlassian_identities_user_id_seq OWNED BY atlassian_identities.user_id;

CREATE TABLE audit_events_amazon_s3_configurations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    access_key_xid text NOT NULL,
    name text NOT NULL,
    bucket_name text NOT NULL,
    aws_region text NOT NULL,
    encrypted_secret_access_key bytea NOT NULL,
    encrypted_secret_access_key_iv bytea NOT NULL,
    stream_destination_id bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_3a41f4ea06 CHECK ((char_length(bucket_name) <= 63)),
    CONSTRAINT check_72b5aaa71b CHECK ((char_length(aws_region) <= 50)),
    CONSTRAINT check_90505816db CHECK ((char_length(name) <= 72)),
    CONSTRAINT check_ec46f06e01 CHECK ((char_length(access_key_xid) <= 128))
);

CREATE SEQUENCE audit_events_amazon_s3_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_amazon_s3_configurations_id_seq OWNED BY audit_events_amazon_s3_configurations.id;

CREATE TABLE audit_events_external_audit_event_destinations (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    destination_url text NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    verification_token text,
    name text NOT NULL,
    stream_destination_id bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_2feafb9daf CHECK ((char_length(destination_url) <= 255)),
    CONSTRAINT check_8ec80a7d06 CHECK ((char_length(verification_token) <= 24)),
    CONSTRAINT check_c52ff8e90e CHECK ((char_length(name) <= 72))
);

CREATE SEQUENCE audit_events_external_audit_event_destinations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_external_audit_event_destinations_id_seq OWNED BY audit_events_external_audit_event_destinations.id;

CREATE TABLE audit_events_google_cloud_logging_configurations (
    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,
    google_project_id_name text NOT NULL,
    client_email text NOT NULL,
    log_id_name text DEFAULT 'audit_events'::text,
    encrypted_private_key bytea NOT NULL,
    encrypted_private_key_iv bytea NOT NULL,
    name text NOT NULL,
    stream_destination_id bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_0ef835c61e CHECK ((char_length(client_email) <= 254)),
    CONSTRAINT check_55783c7c19 CHECK ((char_length(google_project_id_name) <= 30)),
    CONSTRAINT check_898a76b005 CHECK ((char_length(log_id_name) <= 511)),
    CONSTRAINT check_cdf6883cd6 CHECK ((char_length(name) <= 72))
);

CREATE SEQUENCE audit_events_google_cloud_logging_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_google_cloud_logging_configurations_id_seq OWNED BY audit_events_google_cloud_logging_configurations.id;

CREATE TABLE audit_events_group_external_streaming_destinations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    category smallint NOT NULL,
    name text NOT NULL,
    config jsonb NOT NULL,
    encrypted_secret_token bytea NOT NULL,
    encrypted_secret_token_iv bytea NOT NULL,
    legacy_destination_ref bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_97d157fbd0 CHECK ((char_length(name) <= 72))
);

CREATE SEQUENCE audit_events_group_external_streaming_destinations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_group_external_streaming_destinations_id_seq OWNED BY audit_events_group_external_streaming_destinations.id;

CREATE TABLE audit_events_group_streaming_event_type_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_streaming_destination_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    audit_event_type text NOT NULL,
    CONSTRAINT check_389708af23 CHECK ((char_length(audit_event_type) <= 255))
);

CREATE SEQUENCE audit_events_group_streaming_event_type_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_group_streaming_event_type_filters_id_seq OWNED BY audit_events_group_streaming_event_type_filters.id;

CREATE SEQUENCE audit_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_id_seq OWNED BY audit_events.id;

CREATE TABLE audit_events_instance_amazon_s3_configurations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    access_key_xid text NOT NULL,
    name text NOT NULL,
    bucket_name text NOT NULL,
    aws_region text NOT NULL,
    encrypted_secret_access_key bytea NOT NULL,
    encrypted_secret_access_key_iv bytea NOT NULL,
    stream_destination_id bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_1a908bd36f CHECK ((char_length(name) <= 72)),
    CONSTRAINT check_8083750c42 CHECK ((char_length(bucket_name) <= 63)),
    CONSTRAINT check_d2ca3eb90e CHECK ((char_length(aws_region) <= 50)),
    CONSTRAINT check_d6d6bd8e8b CHECK ((char_length(access_key_xid) <= 128))
);

CREATE SEQUENCE audit_events_instance_amazon_s3_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_instance_amazon_s3_configurations_id_seq OWNED BY audit_events_instance_amazon_s3_configurations.id;

CREATE TABLE audit_events_instance_external_audit_event_destinations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    destination_url text NOT NULL,
    encrypted_verification_token bytea NOT NULL,
    encrypted_verification_token_iv bytea NOT NULL,
    name text NOT NULL,
    stream_destination_id bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_433fbb3305 CHECK ((char_length(name) <= 72)),
    CONSTRAINT check_4dc67167ce CHECK ((char_length(destination_url) <= 255))
);

CREATE SEQUENCE audit_events_instance_external_audit_event_destinations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_instance_external_audit_event_destinations_id_seq OWNED BY audit_events_instance_external_audit_event_destinations.id;

CREATE TABLE audit_events_instance_external_streaming_destinations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    category smallint NOT NULL,
    name text NOT NULL,
    config jsonb NOT NULL,
    encrypted_secret_token bytea NOT NULL,
    encrypted_secret_token_iv bytea NOT NULL,
    legacy_destination_ref bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_219decfb51 CHECK ((char_length(name) <= 72))
);

CREATE SEQUENCE audit_events_instance_external_streaming_destinations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_instance_external_streaming_destinations_id_seq OWNED BY audit_events_instance_external_streaming_destinations.id;

CREATE TABLE audit_events_instance_google_cloud_logging_configurations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    google_project_id_name text NOT NULL,
    client_email text NOT NULL,
    log_id_name text DEFAULT 'audit_events'::text,
    name text NOT NULL,
    encrypted_private_key bytea NOT NULL,
    encrypted_private_key_iv bytea NOT NULL,
    stream_destination_id bigint,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_0da5c76c49 CHECK ((char_length(client_email) <= 254)),
    CONSTRAINT check_74fd943192 CHECK ((char_length(log_id_name) <= 511)),
    CONSTRAINT check_ab65f57721 CHECK ((char_length(google_project_id_name) <= 30)),
    CONSTRAINT check_ac42ad3ca2 CHECK ((char_length(name) <= 72))
);

CREATE SEQUENCE audit_events_instance_google_cloud_logging_configuration_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_instance_google_cloud_logging_configuration_id_seq OWNED BY audit_events_instance_google_cloud_logging_configurations.id;

CREATE TABLE audit_events_instance_streaming_event_type_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_streaming_destination_id bigint NOT NULL,
    audit_event_type text NOT NULL,
    CONSTRAINT check_4a5e8e01b5 CHECK ((char_length(audit_event_type) <= 255))
);

CREATE SEQUENCE audit_events_instance_streaming_event_type_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_instance_streaming_event_type_filters_id_seq OWNED BY audit_events_instance_streaming_event_type_filters.id;

CREATE TABLE audit_events_streaming_event_type_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_audit_event_destination_id bigint NOT NULL,
    audit_event_type text NOT NULL,
    group_id bigint,
    CONSTRAINT check_9eb6a21b47 CHECK ((group_id IS NOT NULL)),
    CONSTRAINT check_d20c8e5a51 CHECK ((char_length(audit_event_type) <= 255))
);

CREATE SEQUENCE audit_events_streaming_event_type_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_event_type_filters_id_seq OWNED BY audit_events_streaming_event_type_filters.id;

CREATE TABLE audit_events_streaming_group_namespace_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_streaming_destination_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE audit_events_streaming_group_namespace_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_group_namespace_filters_id_seq OWNED BY audit_events_streaming_group_namespace_filters.id;

CREATE TABLE audit_events_streaming_headers (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_audit_event_destination_id bigint NOT NULL,
    key text NOT NULL,
    value text NOT NULL,
    active boolean DEFAULT true NOT NULL,
    group_id bigint,
    CONSTRAINT check_3feba4e364 CHECK ((group_id IS NOT NULL)),
    CONSTRAINT check_53c3152034 CHECK ((char_length(key) <= 255)),
    CONSTRAINT check_ac213cca22 CHECK ((char_length(value) <= 2000))
);

CREATE SEQUENCE audit_events_streaming_headers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_headers_id_seq OWNED BY audit_events_streaming_headers.id;

CREATE TABLE audit_events_streaming_http_group_namespace_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_audit_event_destination_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE audit_events_streaming_http_group_namespace_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_http_group_namespace_filters_id_seq OWNED BY audit_events_streaming_http_group_namespace_filters.id;

CREATE TABLE audit_events_streaming_http_instance_namespace_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    audit_events_instance_external_audit_event_destination_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE audit_events_streaming_http_instance_namespace_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_http_instance_namespace_filters_id_seq OWNED BY audit_events_streaming_http_instance_namespace_filters.id;

CREATE TABLE audit_events_streaming_instance_event_type_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    instance_external_audit_event_destination_id bigint NOT NULL,
    audit_event_type text NOT NULL,
    CONSTRAINT check_249c9370cc CHECK ((char_length(audit_event_type) <= 255))
);

CREATE SEQUENCE audit_events_streaming_instance_event_type_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_instance_event_type_filters_id_seq OWNED BY audit_events_streaming_instance_event_type_filters.id;

CREATE TABLE audit_events_streaming_instance_namespace_filters (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_streaming_destination_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE audit_events_streaming_instance_namespace_filters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE audit_events_streaming_instance_namespace_filters_id_seq OWNED BY audit_events_streaming_instance_namespace_filters.id;

CREATE TABLE authentication_events (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    user_id bigint,
    result smallint NOT NULL,
    ip_address inet,
    provider text NOT NULL,
    user_name text NOT NULL,
    CONSTRAINT check_45a6cc4e80 CHECK ((char_length(user_name) <= 255)),
    CONSTRAINT check_c64f424630 CHECK ((char_length(provider) <= 64))
);

CREATE SEQUENCE authentication_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE authentication_events_id_seq OWNED BY authentication_events.id;

CREATE TABLE automation_rules (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    issues_events boolean DEFAULT false NOT NULL,
    merge_requests_events boolean DEFAULT false NOT NULL,
    permanently_disabled boolean DEFAULT false NOT NULL,
    name text NOT NULL,
    rule text NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_0be3e2c953 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_ed5a4fcbd5 CHECK ((char_length(rule) <= 2048))
);

CREATE SEQUENCE automation_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE automation_rules_id_seq OWNED BY automation_rules.id;

CREATE TABLE award_emoji (
    id bigint NOT NULL,
    name character varying,
    user_id bigint,
    awardable_type character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    awardable_id bigint
);

CREATE SEQUENCE award_emoji_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE award_emoji_id_seq OWNED BY award_emoji.id;

CREATE TABLE aws_roles (
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    role_arn character varying(2048),
    role_external_id character varying(64) NOT NULL,
    region text,
    CONSTRAINT check_57adedab55 CHECK ((char_length(region) <= 255))
);

CREATE TABLE background_migration_jobs (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    class_name text NOT NULL,
    arguments jsonb NOT NULL,
    CONSTRAINT check_b0de0a5852 CHECK ((char_length(class_name) <= 200))
);

CREATE SEQUENCE background_migration_jobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE background_migration_jobs_id_seq OWNED BY background_migration_jobs.id;

CREATE TABLE badges (
    id bigint NOT NULL,
    link_url character varying NOT NULL,
    image_url character varying NOT NULL,
    project_id bigint,
    group_id bigint,
    type character varying NOT NULL,
    name character varying(255),
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE badges_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE badges_id_seq OWNED BY badges.id;

CREATE TABLE banned_users (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    projects_deleted boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE batched_background_migration_job_transition_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE batched_background_migration_job_transition_logs_id_seq OWNED BY batched_background_migration_job_transition_logs.id;

CREATE TABLE batched_background_migration_jobs (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    started_at timestamp with time zone,
    finished_at timestamp with time zone,
    batched_background_migration_id bigint NOT NULL,
    min_value bigint,
    max_value bigint,
    batch_size integer NOT NULL,
    sub_batch_size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    attempts smallint DEFAULT 0 NOT NULL,
    metrics jsonb DEFAULT '{}'::jsonb NOT NULL,
    pause_ms integer DEFAULT 100 NOT NULL,
    min_cursor jsonb,
    max_cursor jsonb,
    CONSTRAINT check_18d498ea58 CHECK (((jsonb_typeof(min_cursor) = 'array'::text) AND (jsonb_typeof(max_cursor) = 'array'::text))),
    CONSTRAINT check_ba39c36ddb CHECK ((pause_ms >= 100)),
    CONSTRAINT check_c1ce96fe3b CHECK (((num_nonnulls(min_value, max_value) = 2) OR (num_nonnulls(min_cursor, max_cursor) = 2)))
);

CREATE SEQUENCE batched_background_migration_jobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE batched_background_migration_jobs_id_seq OWNED BY batched_background_migration_jobs.id;

CREATE TABLE batched_background_migrations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    min_value bigint DEFAULT 1,
    max_value bigint,
    batch_size integer NOT NULL,
    sub_batch_size integer NOT NULL,
    "interval" smallint NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    job_class_name text NOT NULL,
    batch_class_name text DEFAULT 'PrimaryKeyBatchingStrategy'::text NOT NULL,
    table_name text NOT NULL,
    column_name text NOT NULL,
    job_arguments jsonb DEFAULT '[]'::jsonb NOT NULL,
    total_tuple_count bigint,
    pause_ms integer DEFAULT 100 NOT NULL,
    max_batch_size integer,
    started_at timestamp with time zone,
    on_hold_until timestamp with time zone,
    gitlab_schema text NOT NULL,
    finished_at timestamp with time zone,
    queued_migration_version text,
    min_cursor jsonb,
    max_cursor jsonb,
    CONSTRAINT check_0406d9776f CHECK ((char_length(gitlab_schema) <= 255)),
    CONSTRAINT check_122750e705 CHECK (((jsonb_typeof(min_cursor) = 'array'::text) AND (jsonb_typeof(max_cursor) = 'array'::text))),
    CONSTRAINT check_5bb0382d6f CHECK ((char_length(column_name) <= 63)),
    CONSTRAINT check_69e4fcc53b CHECK ((pause_ms >= 100)),
    CONSTRAINT check_6b6a06254a CHECK ((char_length(table_name) <= 63)),
    CONSTRAINT check_713f147aea CHECK ((char_length(queued_migration_version) <= 14)),
    CONSTRAINT check_batch_size_in_range CHECK ((batch_size >= sub_batch_size)),
    CONSTRAINT check_e6c75b1e29 CHECK ((char_length(job_class_name) <= 100)),
    CONSTRAINT check_f5158baa12 CHECK (((num_nonnulls(min_value, max_value) = 2) OR (num_nonnulls(min_cursor, max_cursor) = 2))),
    CONSTRAINT check_fe10674721 CHECK ((char_length(batch_class_name) <= 100)),
    CONSTRAINT check_max_value_in_range CHECK ((max_value >= min_value)),
    CONSTRAINT check_positive_min_value CHECK ((min_value > 0)),
    CONSTRAINT check_positive_sub_batch_size CHECK ((sub_batch_size > 0))
);

COMMENT ON COLUMN batched_background_migrations.on_hold_until IS 'execution of this migration is on hold until this time';

CREATE SEQUENCE batched_background_migrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE batched_background_migrations_id_seq OWNED BY batched_background_migrations.id;

CREATE TABLE board_assignees (
    id bigint NOT NULL,
    board_id bigint NOT NULL,
    assignee_id bigint NOT NULL,
    group_id bigint,
    project_id bigint,
    CONSTRAINT check_b56ef26337 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE board_assignees_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE board_assignees_id_seq OWNED BY board_assignees.id;

CREATE TABLE board_group_recent_visits (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint,
    board_id bigint,
    group_id bigint,
    CONSTRAINT check_409f6caea4 CHECK ((user_id IS NOT NULL)),
    CONSTRAINT check_ddc74243ef CHECK ((group_id IS NOT NULL)),
    CONSTRAINT check_fa7711a898 CHECK ((board_id IS NOT NULL))
);

CREATE SEQUENCE board_group_recent_visits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE board_group_recent_visits_id_seq OWNED BY board_group_recent_visits.id;

CREATE TABLE board_labels (
    id bigint NOT NULL,
    board_id bigint NOT NULL,
    label_id bigint NOT NULL,
    group_id bigint,
    project_id bigint,
    CONSTRAINT check_b8d32bd9fe CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE board_labels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE board_labels_id_seq OWNED BY board_labels.id;

CREATE TABLE board_project_recent_visits (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint,
    project_id bigint,
    board_id bigint,
    CONSTRAINT check_0386e26981 CHECK ((board_id IS NOT NULL)),
    CONSTRAINT check_d9cc9b79da CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_df7762a99a CHECK ((user_id IS NOT NULL))
);

CREATE SEQUENCE board_project_recent_visits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE board_project_recent_visits_id_seq OWNED BY board_project_recent_visits.id;

CREATE TABLE board_user_preferences (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    board_id bigint NOT NULL,
    hide_labels boolean,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint,
    project_id bigint,
    CONSTRAINT check_86d6706b52 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE board_user_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE board_user_preferences_id_seq OWNED BY board_user_preferences.id;

CREATE TABLE boards (
    id bigint NOT NULL,
    project_id bigint,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    name character varying DEFAULT 'Development'::character varying NOT NULL,
    milestone_id bigint,
    group_id bigint,
    weight integer,
    hide_backlog_list boolean DEFAULT false NOT NULL,
    hide_closed_list boolean DEFAULT false NOT NULL,
    iteration_id bigint,
    iteration_cadence_id bigint,
    CONSTRAINT check_a60857cc50 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE TABLE boards_epic_board_labels (
    id bigint NOT NULL,
    epic_board_id bigint NOT NULL,
    label_id bigint NOT NULL,
    group_id bigint,
    CONSTRAINT check_c71449be47 CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE boards_epic_board_labels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_board_labels_id_seq OWNED BY boards_epic_board_labels.id;

CREATE TABLE boards_epic_board_positions (
    id bigint NOT NULL,
    epic_board_id bigint NOT NULL,
    epic_id bigint NOT NULL,
    relative_position integer,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint,
    CONSTRAINT check_9d94ce874e CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE boards_epic_board_positions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_board_positions_id_seq OWNED BY boards_epic_board_positions.id;

CREATE TABLE boards_epic_board_recent_visits (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    epic_board_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
);

CREATE SEQUENCE boards_epic_board_recent_visits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_board_recent_visits_id_seq OWNED BY boards_epic_board_recent_visits.id;

CREATE TABLE boards_epic_boards (
    id bigint NOT NULL,
    hide_backlog_list boolean DEFAULT false NOT NULL,
    hide_closed_list boolean DEFAULT false NOT NULL,
    group_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text DEFAULT 'Development'::text NOT NULL,
    display_colors boolean DEFAULT true NOT NULL,
    CONSTRAINT check_bcbbffe601 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE boards_epic_boards_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_boards_id_seq OWNED BY boards_epic_boards.id;

CREATE TABLE boards_epic_list_user_preferences (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    epic_list_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    collapsed boolean DEFAULT false NOT NULL,
    group_id bigint,
    CONSTRAINT check_c18068ad9c CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE boards_epic_list_user_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_list_user_preferences_id_seq OWNED BY boards_epic_list_user_preferences.id;

CREATE TABLE boards_epic_lists (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    epic_board_id bigint NOT NULL,
    label_id bigint,
    "position" integer,
    list_type smallint DEFAULT 1 NOT NULL,
    group_id bigint,
    CONSTRAINT boards_epic_lists_position_constraint CHECK (((list_type <> 1) OR (("position" IS NOT NULL) AND ("position" >= 0)))),
    CONSTRAINT check_86641111a7 CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE boards_epic_lists_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_lists_id_seq OWNED BY boards_epic_lists.id;

CREATE TABLE boards_epic_user_preferences (
    id bigint NOT NULL,
    board_id bigint NOT NULL,
    user_id bigint NOT NULL,
    epic_id bigint NOT NULL,
    collapsed boolean DEFAULT false NOT NULL,
    group_id bigint,
    CONSTRAINT check_e23d7636e9 CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE boards_epic_user_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_epic_user_preferences_id_seq OWNED BY boards_epic_user_preferences.id;

CREATE SEQUENCE boards_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE boards_id_seq OWNED BY boards.id;

CREATE TABLE broadcast_messages (
    id bigint NOT NULL,
    message text NOT NULL,
    starts_at timestamp without time zone NOT NULL,
    ends_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    color character varying,
    font character varying,
    message_html text NOT NULL,
    cached_markdown_version integer,
    target_path character varying(255),
    broadcast_type smallint DEFAULT 1 NOT NULL,
    dismissable boolean,
    target_access_levels integer[] DEFAULT '{}'::integer[] NOT NULL,
    theme smallint DEFAULT 0 NOT NULL,
    show_in_cli boolean DEFAULT true NOT NULL
);

CREATE SEQUENCE broadcast_messages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE broadcast_messages_id_seq OWNED BY broadcast_messages.id;

CREATE TABLE bulk_import_batch_trackers (
    id bigint NOT NULL,
    tracker_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    batch_number integer DEFAULT 0 NOT NULL,
    fetched_objects_count integer DEFAULT 0 NOT NULL,
    imported_objects_count integer DEFAULT 0 NOT NULL,
    error text,
    CONSTRAINT check_3d6963a51f CHECK ((char_length(error) <= 255))
);

CREATE SEQUENCE bulk_import_batch_trackers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_batch_trackers_id_seq OWNED BY bulk_import_batch_trackers.id;

CREATE TABLE bulk_import_configurations (
    id bigint NOT NULL,
    bulk_import_id bigint NOT NULL,
    encrypted_url text,
    encrypted_url_iv text,
    encrypted_access_token text,
    encrypted_access_token_iv text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    organization_id bigint,
    CONSTRAINT check_cd24605431 CHECK ((organization_id IS NOT NULL))
);

CREATE SEQUENCE bulk_import_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_configurations_id_seq OWNED BY bulk_import_configurations.id;

CREATE TABLE bulk_import_entities (
    id bigint NOT NULL,
    bulk_import_id bigint NOT NULL,
    parent_id bigint,
    namespace_id bigint,
    project_id bigint,
    source_type smallint NOT NULL,
    source_full_path text NOT NULL,
    destination_name text NOT NULL,
    destination_namespace text NOT NULL,
    status smallint NOT NULL,
    jid text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    source_xid integer,
    migrate_projects boolean DEFAULT true NOT NULL,
    has_failures boolean DEFAULT false,
    migrate_memberships boolean DEFAULT true NOT NULL,
    organization_id bigint,
    CONSTRAINT check_13f279f7da CHECK ((char_length(source_full_path) <= 255)),
    CONSTRAINT check_469f9235c5 CHECK ((num_nonnulls(namespace_id, organization_id, project_id) = 1)),
    CONSTRAINT check_715d725ea2 CHECK ((char_length(destination_name) <= 255)),
    CONSTRAINT check_796a4d9cc6 CHECK ((char_length(jid) <= 255)),
    CONSTRAINT check_b834fff4d9 CHECK ((char_length(destination_namespace) <= 255))
);

CREATE SEQUENCE bulk_import_entities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id;

CREATE TABLE bulk_import_export_batches (
    id bigint NOT NULL,
    export_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    batch_number integer DEFAULT 0 NOT NULL,
    objects_count integer DEFAULT 0 NOT NULL,
    error text,
    project_id bigint,
    group_id bigint,
    CONSTRAINT check_046dc60dfe CHECK ((char_length(error) <= 255)),
    CONSTRAINT check_31f6b54459 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE bulk_import_export_batches_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_export_batches_id_seq OWNED BY bulk_import_export_batches.id;

CREATE TABLE bulk_import_export_upload_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE bulk_import_export_uploads (
    id bigint NOT NULL,
    export_id bigint NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    export_file text,
    batch_id bigint,
    project_id bigint,
    group_id bigint,
    CONSTRAINT check_5add76239d CHECK ((char_length(export_file) <= 255)),
    CONSTRAINT check_e1d215df28 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE bulk_import_export_uploads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_export_uploads_id_seq OWNED BY bulk_import_export_uploads.id;

CREATE TABLE bulk_import_exports (
    id bigint NOT NULL,
    group_id bigint,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relation text NOT NULL,
    jid text,
    error text,
    batched boolean DEFAULT false NOT NULL,
    batches_count integer DEFAULT 0 NOT NULL,
    total_objects_count integer DEFAULT 0 NOT NULL,
    user_id bigint,
    CONSTRAINT check_24cb010672 CHECK ((char_length(relation) <= 255)),
    CONSTRAINT check_8f0f357334 CHECK ((char_length(error) <= 255)),
    CONSTRAINT check_9ee6d14d33 CHECK ((char_length(jid) <= 255)),
    CONSTRAINT check_e84b7c0730 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE bulk_import_exports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_exports_id_seq OWNED BY bulk_import_exports.id;

CREATE TABLE bulk_import_failures (
    id bigint NOT NULL,
    bulk_import_entity_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    pipeline_class text NOT NULL,
    exception_class text NOT NULL,
    exception_message text NOT NULL,
    correlation_id_value text,
    pipeline_step text,
    source_url text,
    source_title text,
    subrelation text,
    project_id bigint,
    namespace_id bigint,
    organization_id bigint,
    CONSTRAINT check_053d65c7a4 CHECK ((char_length(pipeline_class) <= 255)),
    CONSTRAINT check_6eca8f972e CHECK ((char_length(exception_message) <= 255)),
    CONSTRAINT check_721a422375 CHECK ((char_length(pipeline_step) <= 255)),
    CONSTRAINT check_74414228d4 CHECK ((char_length(source_title) <= 255)),
    CONSTRAINT check_c7dba8398e CHECK ((char_length(exception_class) <= 255)),
    CONSTRAINT check_e035a720ad CHECK ((char_length(source_url) <= 255)),
    CONSTRAINT check_e787285882 CHECK ((char_length(correlation_id_value) <= 255)),
    CONSTRAINT check_f99665a440 CHECK ((char_length(subrelation) <= 255))
);

CREATE SEQUENCE bulk_import_failures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_failures_id_seq OWNED BY bulk_import_failures.id;

CREATE TABLE bulk_import_trackers (
    id bigint NOT NULL,
    bulk_import_entity_id bigint NOT NULL,
    relation text NOT NULL,
    next_page text,
    has_next_page boolean DEFAULT false NOT NULL,
    jid text,
    stage smallint DEFAULT 0 NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    batched boolean DEFAULT false,
    source_objects_count bigint DEFAULT 0 NOT NULL,
    fetched_objects_count bigint DEFAULT 0 NOT NULL,
    imported_objects_count bigint DEFAULT 0 NOT NULL,
    project_id bigint,
    namespace_id bigint,
    organization_id bigint,
    CONSTRAINT check_2d45cae629 CHECK ((char_length(relation) <= 255)),
    CONSTRAINT check_40aeaa600b CHECK ((char_length(next_page) <= 255)),
    CONSTRAINT check_603f91cb06 CHECK ((char_length(jid) <= 255)),
    CONSTRAINT check_next_page_requirement CHECK (((has_next_page IS FALSE) OR (next_page IS NOT NULL)))
);

CREATE SEQUENCE bulk_import_trackers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_import_trackers_id_seq OWNED BY bulk_import_trackers.id;

CREATE TABLE bulk_imports (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    source_type smallint NOT NULL,
    status smallint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    source_version text,
    source_enterprise boolean DEFAULT true NOT NULL,
    has_failures boolean DEFAULT false,
    organization_id bigint NOT NULL,
    CONSTRAINT check_ea4e58775a CHECK ((char_length(source_version) <= 63))
);

CREATE SEQUENCE bulk_imports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE bulk_imports_id_seq OWNED BY bulk_imports.id;

CREATE TABLE catalog_resource_component_last_usages (
    id bigint NOT NULL,
    component_id bigint NOT NULL,
    catalog_resource_id bigint NOT NULL,
    component_project_id bigint NOT NULL,
    used_by_project_id bigint NOT NULL,
    last_used_date date NOT NULL
);

CREATE SEQUENCE catalog_resource_component_last_usages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE catalog_resource_component_last_usages_id_seq OWNED BY catalog_resource_component_last_usages.id;

CREATE TABLE catalog_resource_components (
    id bigint NOT NULL,
    catalog_resource_id bigint NOT NULL,
    version_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    spec jsonb DEFAULT '{}'::jsonb NOT NULL,
    last_30_day_usage_count integer DEFAULT 0 NOT NULL,
    last_30_day_usage_count_updated_at timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
    component_type smallint DEFAULT 1,
    CONSTRAINT check_47c5537132 CHECK ((component_type IS NOT NULL)),
    CONSTRAINT check_ddca729980 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE catalog_resource_components_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE catalog_resource_components_id_seq OWNED BY catalog_resource_components.id;

CREATE TABLE catalog_resource_versions (
    id bigint NOT NULL,
    release_id bigint NOT NULL,
    catalog_resource_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    released_at timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
    semver_major integer,
    semver_minor integer,
    semver_patch integer,
    semver_prerelease text,
    semver_prefixed boolean DEFAULT false,
    cached_markdown_version integer,
    readme text,
    readme_html text,
    published_by_id bigint,
    CONSTRAINT check_701bdce47b CHECK ((char_length(semver_prerelease) <= 255))
);

CREATE SEQUENCE catalog_resource_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE catalog_resource_versions_id_seq OWNED BY catalog_resource_versions.id;

CREATE TABLE catalog_resources (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    latest_released_at timestamp with time zone,
    name character varying,
    description text,
    visibility_level integer DEFAULT 0 NOT NULL,
    search_vector tsvector GENERATED ALWAYS AS ((setweight(to_tsvector('english'::regconfig, (COALESCE(name, ''::character varying))::text), 'A'::"char") || setweight(to_tsvector('english'::regconfig, COALESCE(description, ''::text)), 'B'::"char"))) STORED,
    verification_level smallint DEFAULT 0,
    last_30_day_usage_count integer DEFAULT 0 NOT NULL,
    last_30_day_usage_count_updated_at timestamp with time zone DEFAULT now() NOT NULL
);

CREATE SEQUENCE catalog_resources_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE catalog_resources_id_seq OWNED BY catalog_resources.id;

CREATE TABLE catalog_verified_namespaces (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    verification_level smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE catalog_verified_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE catalog_verified_namespaces_id_seq OWNED BY catalog_verified_namespaces.id;

CREATE TABLE chat_names (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    team_id character varying NOT NULL,
    team_domain character varying,
    chat_id character varying NOT NULL,
    chat_name character varying,
    last_used_at timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    encrypted_token bytea,
    encrypted_token_iv bytea
);

CREATE SEQUENCE chat_names_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE chat_names_id_seq OWNED BY chat_names.id;

CREATE TABLE chat_teams (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    team_id character varying,
    name character varying,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE chat_teams_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE chat_teams_id_seq OWNED BY chat_teams.id;

CREATE TABLE ci_build_needs (
    name text NOT NULL,
    artifacts boolean DEFAULT true NOT NULL,
    optional boolean DEFAULT false NOT NULL,
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_4fab85ecdc CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_build_needs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_build_needs_id_seq OWNED BY ci_build_needs.id;

CREATE TABLE ci_build_pending_states (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    build_id bigint NOT NULL,
    state smallint,
    failure_reason smallint,
    trace_checksum bytea,
    trace_bytesize bigint,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_20b28e5e16 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_build_pending_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_build_pending_states_id_seq OWNED BY ci_build_pending_states.id;

CREATE TABLE ci_build_report_results (
    build_id bigint NOT NULL,
    project_id bigint NOT NULL,
    data jsonb DEFAULT '{}'::jsonb NOT NULL,
    partition_id bigint NOT NULL
);

CREATE TABLE ci_build_trace_chunks (
    id bigint NOT NULL,
    chunk_index integer NOT NULL,
    data_store integer NOT NULL,
    raw_data bytea,
    checksum bytea,
    lock_version integer DEFAULT 0 NOT NULL,
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_b374316678 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_build_trace_chunks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_build_trace_chunks_id_seq OWNED BY ci_build_trace_chunks.id;

CREATE SEQUENCE ci_builds_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_builds_id_seq OWNED BY p_ci_builds.id;

CREATE SEQUENCE ci_builds_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY p_ci_builds_metadata.id;

CREATE TABLE ci_builds_runner_session (
    id bigint NOT NULL,
    url character varying NOT NULL,
    certificate character varying,
    "authorization" character varying,
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_2eb15fa9f3 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_builds_runner_session_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_builds_runner_session_id_seq OWNED BY ci_builds_runner_session.id;

CREATE TABLE ci_cost_settings (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    runner_id bigint NOT NULL,
    standard_factor double precision DEFAULT 1.0 NOT NULL,
    os_contribution_factor double precision DEFAULT 0.008 NOT NULL,
    os_plan_factor double precision DEFAULT 0.5 NOT NULL
);

CREATE TABLE ci_daily_build_group_report_results (
    id bigint NOT NULL,
    date date NOT NULL,
    project_id bigint NOT NULL,
    last_pipeline_id bigint NOT NULL,
    ref_path text NOT NULL,
    group_name text NOT NULL,
    data jsonb NOT NULL,
    default_branch boolean DEFAULT false NOT NULL,
    group_id bigint,
    partition_id bigint NOT NULL
);

CREATE SEQUENCE ci_daily_build_group_report_results_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_daily_build_group_report_results_id_seq OWNED BY ci_daily_build_group_report_results.id;

CREATE TABLE ci_deleted_objects (
    id bigint NOT NULL,
    file_store smallint DEFAULT 1 NOT NULL,
    pick_up_at timestamp with time zone DEFAULT now() NOT NULL,
    store_dir text NOT NULL,
    file text NOT NULL,
    project_id bigint,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT check_5e151d6912 CHECK ((char_length(store_dir) <= 1024)),
    CONSTRAINT check_98f90d6c53 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_deleted_objects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_deleted_objects_id_seq OWNED BY ci_deleted_objects.id;

CREATE TABLE ci_freeze_periods (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    freeze_start character varying(998) NOT NULL,
    freeze_end character varying(998) NOT NULL,
    cron_timezone character varying(255) NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE ci_freeze_periods_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_freeze_periods_id_seq OWNED BY ci_freeze_periods.id;

CREATE TABLE ci_gitlab_hosted_runner_monthly_usages (
    id bigint NOT NULL,
    runner_id bigint NOT NULL,
    runner_duration_seconds bigint DEFAULT 0 NOT NULL,
    project_id bigint NOT NULL,
    root_namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    billing_month date NOT NULL,
    notification_level integer DEFAULT 100 NOT NULL,
    compute_minutes_used numeric(18,4) DEFAULT 0.0 NOT NULL,
    CONSTRAINT ci_hosted_runner_monthly_usages_month_constraint CHECK ((billing_month = date_trunc('month'::text, (billing_month)::timestamp with time zone)))
);

CREATE SEQUENCE ci_gitlab_hosted_runner_monthly_usages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_gitlab_hosted_runner_monthly_usages_id_seq OWNED BY ci_gitlab_hosted_runner_monthly_usages.id;

CREATE TABLE ci_group_variables (
    id bigint NOT NULL,
    key character varying NOT NULL,
    value text,
    encrypted_value text,
    encrypted_value_salt character varying,
    encrypted_value_iv character varying,
    group_id bigint NOT NULL,
    protected boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    masked boolean DEFAULT false NOT NULL,
    variable_type smallint DEFAULT 1 NOT NULL,
    environment_scope text DEFAULT '*'::text NOT NULL,
    raw boolean DEFAULT false NOT NULL,
    description text,
    hidden boolean DEFAULT false NOT NULL,
    CONSTRAINT check_dfe009485a CHECK ((char_length(environment_scope) <= 255)),
    CONSTRAINT check_e2e50ff879 CHECK ((char_length(description) <= 255))
);

CREATE SEQUENCE ci_group_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_group_variables_id_seq OWNED BY ci_group_variables.id;

CREATE TABLE ci_hosted_runners (
    runner_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE TABLE ci_instance_runner_monthly_usages (
    id bigint NOT NULL,
    runner_id bigint,
    runner_duration_seconds bigint DEFAULT 0 NOT NULL,
    project_id bigint,
    root_namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    billing_month date NOT NULL,
    notification_level integer DEFAULT 100 NOT NULL,
    compute_minutes_used numeric(18,4) DEFAULT 0.0 NOT NULL,
    CONSTRAINT ci_instance_runner_monthly_usages_year_month_constraint CHECK ((billing_month = date_trunc('month'::text, (billing_month)::timestamp with time zone)))
);

CREATE SEQUENCE ci_instance_runner_monthly_usages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_instance_runner_monthly_usages_id_seq OWNED BY ci_instance_runner_monthly_usages.id;

CREATE TABLE ci_instance_variables (
    id bigint NOT NULL,
    variable_type smallint DEFAULT 1 NOT NULL,
    masked boolean DEFAULT false,
    protected boolean DEFAULT false,
    key text NOT NULL,
    encrypted_value text,
    encrypted_value_iv text,
    raw boolean DEFAULT false NOT NULL,
    description text,
    CONSTRAINT check_07a45a5bcb CHECK ((char_length(encrypted_value_iv) <= 255)),
    CONSTRAINT check_5aede12208 CHECK ((char_length(key) <= 255)),
    CONSTRAINT check_956afd70f1 CHECK ((char_length(encrypted_value) <= 13579)),
    CONSTRAINT check_a0a9762afa CHECK ((char_length(description) <= 255))
);

CREATE SEQUENCE ci_instance_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_instance_variables_id_seq OWNED BY ci_instance_variables.id;

CREATE TABLE ci_job_artifact_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    job_artifact_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_df832b66ea CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE ci_job_artifacts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_job_artifacts_id_seq OWNED BY p_ci_job_artifacts.id;

CREATE TABLE ci_job_token_authorizations (
    id bigint NOT NULL,
    accessed_project_id bigint NOT NULL,
    origin_project_id bigint NOT NULL,
    last_authorized_at timestamp with time zone NOT NULL,
    job_token_policies jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE ci_job_token_authorizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_job_token_authorizations_id_seq OWNED BY ci_job_token_authorizations.id;

CREATE TABLE ci_job_token_group_scope_links (
    id bigint NOT NULL,
    source_project_id bigint NOT NULL,
    target_group_id bigint NOT NULL,
    added_by_id bigint,
    created_at timestamp with time zone NOT NULL,
    job_token_policies jsonb DEFAULT '[]'::jsonb,
    default_permissions boolean DEFAULT true NOT NULL,
    autopopulated boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE ci_job_token_group_scope_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_job_token_group_scope_links_id_seq OWNED BY ci_job_token_group_scope_links.id;

CREATE TABLE ci_job_token_project_scope_links (
    id bigint NOT NULL,
    source_project_id bigint NOT NULL,
    target_project_id bigint NOT NULL,
    added_by_id bigint,
    created_at timestamp with time zone NOT NULL,
    direction smallint DEFAULT 0 NOT NULL,
    job_token_policies jsonb DEFAULT '[]'::jsonb,
    default_permissions boolean DEFAULT true NOT NULL,
    autopopulated boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE ci_job_token_project_scope_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_job_token_project_scope_links_id_seq OWNED BY ci_job_token_project_scope_links.id;

CREATE TABLE ci_job_variables (
    id bigint NOT NULL,
    key character varying NOT NULL,
    encrypted_value text,
    encrypted_value_iv character varying,
    job_id bigint NOT NULL,
    variable_type smallint DEFAULT 1 NOT NULL,
    source smallint DEFAULT 0 NOT NULL,
    raw boolean DEFAULT false NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_567d1ccb72 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_job_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_job_variables_id_seq OWNED BY ci_job_variables.id;

CREATE TABLE ci_minutes_additional_packs (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    expires_at date,
    number_of_minutes integer NOT NULL,
    purchase_xid text,
    CONSTRAINT check_d7ef254af0 CHECK ((char_length(purchase_xid) <= 50))
);

CREATE SEQUENCE ci_minutes_additional_packs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_minutes_additional_packs_id_seq OWNED BY ci_minutes_additional_packs.id;

CREATE TABLE ci_namespace_mirrors (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL
);

CREATE SEQUENCE ci_namespace_mirrors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_namespace_mirrors_id_seq OWNED BY ci_namespace_mirrors.id;

CREATE TABLE ci_namespace_monthly_usages (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    date date NOT NULL,
    notification_level smallint DEFAULT 100 NOT NULL,
    created_at timestamp with time zone,
    amount_used numeric(18,4) DEFAULT 0.0 NOT NULL,
    shared_runners_duration bigint DEFAULT 0 NOT NULL,
    CONSTRAINT ci_namespace_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
);

CREATE SEQUENCE ci_namespace_monthly_usages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_namespace_monthly_usages_id_seq OWNED BY ci_namespace_monthly_usages.id;

CREATE TABLE ci_partitions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL
);

CREATE TABLE ci_pending_builds (
    id bigint NOT NULL,
    build_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    protected boolean DEFAULT false NOT NULL,
    instance_runners_enabled boolean DEFAULT false NOT NULL,
    namespace_id bigint,
    minutes_exceeded boolean DEFAULT false NOT NULL,
    tag_ids bigint[] DEFAULT '{}'::bigint[],
    namespace_traversal_ids bigint[] DEFAULT '{}'::bigint[],
    partition_id bigint NOT NULL,
    plan_id bigint
);

CREATE SEQUENCE ci_pending_builds_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pending_builds_id_seq OWNED BY ci_pending_builds.id;

CREATE TABLE ci_pipeline_artifacts (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    pipeline_id bigint NOT NULL,
    project_id bigint NOT NULL,
    size integer NOT NULL,
    file_store smallint DEFAULT 1 NOT NULL,
    file_type smallint NOT NULL,
    file_format smallint NOT NULL,
    file text,
    expire_at timestamp with time zone,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    locked smallint DEFAULT 2,
    partition_id bigint NOT NULL,
    CONSTRAINT check_191b5850ec CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_abeeb71caf CHECK ((file IS NOT NULL)),
    CONSTRAINT ci_pipeline_artifacts_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE ci_pipeline_artifacts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_artifacts_id_seq OWNED BY ci_pipeline_artifacts.id;

CREATE TABLE ci_pipeline_chat_data (
    id bigint NOT NULL,
    chat_name_id bigint NOT NULL,
    response_url text NOT NULL,
    pipeline_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_f6412eda6f CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_pipeline_chat_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_chat_data_id_seq OWNED BY ci_pipeline_chat_data.id;

CREATE TABLE ci_pipeline_messages (
    id bigint NOT NULL,
    severity smallint DEFAULT 0 NOT NULL,
    content text NOT NULL,
    pipeline_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_58ca2981b2 CHECK ((char_length(content) <= 10000)),
    CONSTRAINT check_fe8ee122a2 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_pipeline_messages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_messages_id_seq OWNED BY ci_pipeline_messages.id;

CREATE TABLE ci_pipeline_metadata (
    project_id bigint NOT NULL,
    pipeline_id bigint NOT NULL,
    name text,
    auto_cancel_on_new_commit smallint DEFAULT 0 NOT NULL,
    auto_cancel_on_job_failure smallint DEFAULT 0 NOT NULL,
    partition_id bigint NOT NULL,
    CONSTRAINT check_9d3665463c CHECK ((char_length(name) <= 255))
);

CREATE TABLE ci_pipeline_schedule_inputs (
    id bigint NOT NULL,
    pipeline_schedule_id bigint NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    value jsonb,
    CONSTRAINT check_a340b48bb4 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE ci_pipeline_schedule_inputs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_schedule_inputs_id_seq OWNED BY ci_pipeline_schedule_inputs.id;

CREATE TABLE ci_pipeline_schedule_variables (
    id bigint NOT NULL,
    key character varying NOT NULL,
    value text,
    encrypted_value text,
    encrypted_value_salt character varying,
    encrypted_value_iv character varying,
    pipeline_schedule_id bigint NOT NULL,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    variable_type smallint DEFAULT 1 NOT NULL,
    raw boolean DEFAULT false NOT NULL,
    project_id bigint,
    CONSTRAINT check_17806054a8 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_pipeline_schedule_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_schedule_variables_id_seq OWNED BY ci_pipeline_schedule_variables.id;

CREATE TABLE ci_pipeline_schedules (
    id bigint NOT NULL,
    description character varying,
    ref character varying,
    cron character varying,
    cron_timezone character varying,
    next_run_at timestamp without time zone,
    project_id bigint,
    owner_id bigint,
    active boolean DEFAULT true,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);

CREATE SEQUENCE ci_pipeline_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_schedules_id_seq OWNED BY ci_pipeline_schedules.id;

CREATE SEQUENCE ci_pipeline_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipeline_variables_id_seq OWNED BY p_ci_pipeline_variables.id;

CREATE SEQUENCE ci_pipelines_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_pipelines_id_seq OWNED BY p_ci_pipelines.id;

CREATE TABLE ci_project_mirrors (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE ci_project_mirrors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_project_mirrors_id_seq OWNED BY ci_project_mirrors.id;

CREATE TABLE ci_project_monthly_usages (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    date date NOT NULL,
    created_at timestamp with time zone,
    amount_used numeric(18,4) DEFAULT 0.0 NOT NULL,
    shared_runners_duration bigint DEFAULT 0 NOT NULL,
    CONSTRAINT ci_project_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
);

CREATE SEQUENCE ci_project_monthly_usages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_project_monthly_usages_id_seq OWNED BY ci_project_monthly_usages.id;

CREATE TABLE ci_refs (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    lock_version integer DEFAULT 0 NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    ref_path text NOT NULL
);

CREATE SEQUENCE ci_refs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_refs_id_seq OWNED BY ci_refs.id;

CREATE TABLE ci_resource_groups (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    key character varying(255) NOT NULL,
    process_mode smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE ci_resource_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_resource_groups_id_seq OWNED BY ci_resource_groups.id;

CREATE TABLE ci_resources (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    resource_group_id bigint NOT NULL,
    build_id bigint,
    partition_id bigint,
    project_id bigint,
    CONSTRAINT check_f3eccb9d35 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_resources_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_resources_id_seq OWNED BY ci_resources.id;

CREATE TABLE ci_runner_machines (
    id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    contacted_at timestamp with time zone,
    creation_state smallint DEFAULT 0 NOT NULL,
    executor_type smallint,
    runner_type smallint NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    system_xid text NOT NULL,
    platform text,
    architecture text,
    revision text,
    ip_address text,
    version text,
    runtime_features jsonb DEFAULT '{}'::jsonb NOT NULL,
    organization_id bigint,
    CONSTRAINT check_3d8736b3af CHECK ((char_length(system_xid) <= 64)),
    CONSTRAINT check_5bad2a6944 CHECK ((char_length(revision) <= 255)),
    CONSTRAINT check_7dc4eee8a5 CHECK ((char_length(version) <= 2048)),
    CONSTRAINT check_b1e456641b CHECK ((char_length(ip_address) <= 1024)),
    CONSTRAINT check_c788f4b18a CHECK ((char_length(platform) <= 255)),
    CONSTRAINT check_f3d25ab844 CHECK ((char_length(architecture) <= 255))
)
PARTITION BY LIST (runner_type);

CREATE SEQUENCE ci_runner_machines_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_runner_machines_id_seq OWNED BY ci_runner_machines.id;

CREATE TABLE ci_runner_namespaces (
    id bigint NOT NULL,
    runner_id bigint,
    namespace_id bigint,
    CONSTRAINT check_5f3dce48df CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE ci_runner_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_runner_namespaces_id_seq OWNED BY ci_runner_namespaces.id;

CREATE TABLE ci_runner_projects (
    id bigint NOT NULL,
    runner_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    project_id bigint,
    CONSTRAINT check_db297016c6 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_runner_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_runner_projects_id_seq OWNED BY ci_runner_projects.id;

CREATE TABLE ci_runner_taggings (
    id bigint NOT NULL,
    tag_id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    runner_type smallint NOT NULL,
    organization_id bigint
)
PARTITION BY LIST (runner_type);

CREATE TABLE ci_runner_taggings_group_type (
    id bigint NOT NULL,
    tag_id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    runner_type smallint NOT NULL,
    organization_id bigint,
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NOT NULL))
);

CREATE SEQUENCE ci_runner_taggings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_runner_taggings_id_seq OWNED BY ci_runner_taggings.id;

CREATE TABLE ci_runner_taggings_instance_type (
    id bigint NOT NULL,
    tag_id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    runner_type smallint NOT NULL,
    organization_id bigint,
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NULL))
);

CREATE TABLE ci_runner_taggings_project_type (
    id bigint NOT NULL,
    tag_id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    runner_type smallint NOT NULL,
    organization_id bigint,
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NOT NULL))
);

CREATE TABLE ci_runner_versions (
    version text NOT NULL,
    status smallint,
    CONSTRAINT check_b5a3714594 CHECK ((char_length(version) <= 2048))
);

CREATE TABLE ci_runners (
    id bigint NOT NULL,
    creator_id bigint,
    sharding_key_id bigint,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    contacted_at timestamp with time zone,
    token_expires_at timestamp with time zone,
    public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    access_level integer DEFAULT 0 NOT NULL,
    maximum_timeout integer,
    runner_type smallint NOT NULL,
    registration_type smallint DEFAULT 0 NOT NULL,
    creation_state smallint DEFAULT 0 NOT NULL,
    active boolean DEFAULT true NOT NULL,
    run_untagged boolean DEFAULT true NOT NULL,
    locked boolean DEFAULT false NOT NULL,
    name text,
    token_encrypted text,
    token text,
    description text,
    maintainer_note text,
    allowed_plans text[] DEFAULT '{}'::text[] NOT NULL,
    allowed_plan_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    organization_id bigint,
    CONSTRAINT check_030ad0773d CHECK ((char_length(token_encrypted) <= 512)),
    CONSTRAINT check_1f8618ab23 CHECK ((char_length(name) <= 256)),
    CONSTRAINT check_24b281f5bf CHECK ((char_length(maintainer_note) <= 1024)),
    CONSTRAINT check_5db8ae9d30 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_af25130d5a CHECK ((char_length(token) <= 128))
)
PARTITION BY LIST (runner_type);

CREATE SEQUENCE ci_runners_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_runners_id_seq OWNED BY ci_runners.id;

CREATE TABLE ci_running_builds (
    id bigint NOT NULL,
    build_id bigint NOT NULL,
    project_id bigint NOT NULL,
    runner_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    runner_type smallint NOT NULL,
    partition_id bigint NOT NULL,
    runner_owner_namespace_xid bigint
);

CREATE SEQUENCE ci_running_builds_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_running_builds_id_seq OWNED BY ci_running_builds.id;

CREATE TABLE ci_secure_file_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    ci_secure_file_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    project_id bigint,
    CONSTRAINT check_a79e5a9261 CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE ci_secure_file_states_ci_secure_file_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_secure_file_states_ci_secure_file_id_seq OWNED BY ci_secure_file_states.ci_secure_file_id;

CREATE TABLE ci_secure_files (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store smallint DEFAULT 1 NOT NULL,
    name text NOT NULL,
    file text NOT NULL,
    checksum bytea NOT NULL,
    key_data text,
    metadata jsonb,
    expires_at timestamp with time zone,
    CONSTRAINT check_320790634d CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_402c7b4a56 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_7279b4e293 CHECK ((char_length(key_data) <= 128))
);

CREATE SEQUENCE ci_secure_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_secure_files_id_seq OWNED BY ci_secure_files.id;

CREATE TABLE ci_sources_pipelines (
    id bigint NOT NULL,
    project_id bigint,
    source_project_id bigint,
    source_job_id bigint,
    partition_id bigint NOT NULL,
    source_partition_id bigint NOT NULL,
    pipeline_id bigint,
    source_pipeline_id bigint
);

CREATE SEQUENCE ci_sources_pipelines_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_sources_pipelines_id_seq OWNED BY ci_sources_pipelines.id;

CREATE TABLE ci_sources_projects (
    id bigint NOT NULL,
    pipeline_id bigint NOT NULL,
    source_project_id bigint NOT NULL,
    partition_id bigint NOT NULL
);

CREATE SEQUENCE ci_sources_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_sources_projects_id_seq OWNED BY ci_sources_projects.id;

CREATE SEQUENCE ci_stages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_stages_id_seq OWNED BY p_ci_stages.id;

CREATE TABLE ci_subscriptions_projects (
    id bigint NOT NULL,
    downstream_project_id bigint NOT NULL,
    upstream_project_id bigint NOT NULL,
    author_id bigint
);

CREATE SEQUENCE ci_subscriptions_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_subscriptions_projects_id_seq OWNED BY ci_subscriptions_projects.id;

CREATE TABLE ci_triggers (
    id bigint NOT NULL,
    token character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    project_id bigint,
    owner_id bigint NOT NULL,
    description character varying,
    encrypted_token bytea,
    encrypted_token_iv bytea,
    expires_at timestamp with time zone
);

CREATE SEQUENCE ci_triggers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_triggers_id_seq OWNED BY ci_triggers.id;

CREATE TABLE ci_unit_test_failures (
    id bigint NOT NULL,
    failed_at timestamp with time zone NOT NULL,
    unit_test_id bigint NOT NULL,
    build_id bigint NOT NULL,
    partition_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_5e4c2d7261 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ci_unit_test_failures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_unit_test_failures_id_seq OWNED BY ci_unit_test_failures.id;

CREATE TABLE ci_unit_tests (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    key_hash text NOT NULL,
    name text NOT NULL,
    suite_name text NOT NULL,
    CONSTRAINT check_248fae1a3b CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_b288215ffe CHECK ((char_length(key_hash) <= 64)),
    CONSTRAINT check_c2d57b3c49 CHECK ((char_length(suite_name) <= 255))
);

CREATE SEQUENCE ci_unit_tests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_unit_tests_id_seq OWNED BY ci_unit_tests.id;

CREATE TABLE ci_variables (
    id bigint NOT NULL,
    key character varying NOT NULL,
    value text,
    encrypted_value text,
    encrypted_value_salt character varying,
    encrypted_value_iv character varying,
    project_id bigint NOT NULL,
    protected boolean DEFAULT false NOT NULL,
    environment_scope character varying DEFAULT '*'::character varying NOT NULL,
    masked boolean DEFAULT false NOT NULL,
    variable_type smallint DEFAULT 1 NOT NULL,
    raw boolean DEFAULT false NOT NULL,
    description text,
    hidden boolean DEFAULT false NOT NULL,
    CONSTRAINT check_7e46c006aa CHECK ((char_length(description) <= 255))
);

CREATE SEQUENCE ci_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ci_variables_id_seq OWNED BY ci_variables.id;

CREATE TABLE cloud_connector_access (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    data jsonb,
    catalog jsonb
);

CREATE SEQUENCE cloud_connector_access_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cloud_connector_access_id_seq OWNED BY cloud_connector_access.id;

CREATE TABLE cloud_connector_keys (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    secret_key jsonb
);

CREATE SEQUENCE cloud_connector_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cloud_connector_keys_id_seq OWNED BY cloud_connector_keys.id;

CREATE TABLE cluster_agent_migrations (
    id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    agent_id bigint NOT NULL,
    project_id bigint NOT NULL,
    issue_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    agent_install_status smallint NOT NULL,
    agent_install_message text,
    CONSTRAINT check_110bed11f8 CHECK ((char_length(agent_install_message) <= 255))
);

CREATE SEQUENCE cluster_agent_migrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_agent_migrations_id_seq OWNED BY cluster_agent_migrations.id;

CREATE TABLE cluster_agent_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    agent_id bigint NOT NULL,
    token_encrypted text NOT NULL,
    created_by_user_id bigint,
    description text,
    name text,
    last_used_at timestamp with time zone,
    status smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_0fb634d04d CHECK ((name IS NOT NULL)),
    CONSTRAINT check_2b79dbb315 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_4e4ec5070a CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_5aff240050 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_c60daed227 CHECK ((char_length(token_encrypted) <= 255))
);

CREATE SEQUENCE cluster_agent_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_agent_tokens_id_seq OWNED BY cluster_agent_tokens.id;

CREATE TABLE cluster_agent_url_configurations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    agent_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_by_user_id bigint,
    status smallint DEFAULT 0 NOT NULL,
    url text NOT NULL,
    ca_cert text,
    client_key text,
    client_cert text,
    tls_host text,
    public_key bytea,
    encrypted_private_key bytea,
    encrypted_private_key_iv bytea,
    CONSTRAINT check_1ffcfef6d6 CHECK ((char_length(tls_host) <= 2048)),
    CONSTRAINT check_25ef8c679c CHECK ((char_length(ca_cert) <= 16384)),
    CONSTRAINT check_93a57284e5 CHECK ((char_length(client_cert) <= 16384)),
    CONSTRAINT check_e3736d97df CHECK ((char_length(client_key) <= 16384)),
    CONSTRAINT check_ed21ced327 CHECK ((char_length(url) <= 2048))
);

CREATE SEQUENCE cluster_agent_url_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_agent_url_configurations_id_seq OWNED BY cluster_agent_url_configurations.id;

CREATE TABLE cluster_agents (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    created_by_user_id bigint,
    has_vulnerabilities boolean DEFAULT false NOT NULL,
    connection_mode smallint DEFAULT 0 NOT NULL,
    is_receptive boolean DEFAULT false NOT NULL,
    CONSTRAINT check_3498369510 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE cluster_agents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_agents_id_seq OWNED BY cluster_agents.id;

CREATE TABLE cluster_enabled_grants (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE cluster_enabled_grants_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_enabled_grants_id_seq OWNED BY cluster_enabled_grants.id;

CREATE TABLE cluster_groups (
    id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    group_id bigint NOT NULL
);

CREATE SEQUENCE cluster_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_groups_id_seq OWNED BY cluster_groups.id;

CREATE TABLE cluster_platforms_kubernetes (
    id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    api_url text,
    ca_cert text,
    namespace character varying,
    username character varying,
    encrypted_password text,
    encrypted_password_iv character varying,
    encrypted_token text,
    encrypted_token_iv character varying,
    authorization_type smallint
);

CREATE SEQUENCE cluster_platforms_kubernetes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_platforms_kubernetes_id_seq OWNED BY cluster_platforms_kubernetes.id;

CREATE TABLE cluster_projects (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE cluster_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_projects_id_seq OWNED BY cluster_projects.id;

CREATE TABLE cluster_providers_aws (
    id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    num_nodes integer NOT NULL,
    status integer NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    key_name character varying(255) NOT NULL,
    role_arn character varying(2048) NOT NULL,
    region character varying(255) NOT NULL,
    vpc_id character varying(255) NOT NULL,
    subnet_ids character varying(255)[] DEFAULT '{}'::character varying[] NOT NULL,
    security_group_id character varying(255) NOT NULL,
    instance_type character varying(255) NOT NULL,
    access_key_id character varying(255),
    encrypted_secret_access_key_iv character varying(255),
    encrypted_secret_access_key text,
    session_token text,
    status_reason text,
    kubernetes_version text DEFAULT '1.14'::text NOT NULL,
    CONSTRAINT check_f1f42cd85e CHECK ((char_length(kubernetes_version) <= 30))
);

CREATE SEQUENCE cluster_providers_aws_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_providers_aws_id_seq OWNED BY cluster_providers_aws.id;

CREATE TABLE cluster_providers_gcp (
    id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    status integer,
    num_nodes integer NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    status_reason text,
    gcp_project_id character varying NOT NULL,
    zone character varying NOT NULL,
    machine_type character varying,
    operation_id character varying,
    endpoint character varying,
    encrypted_access_token text,
    encrypted_access_token_iv character varying,
    legacy_abac boolean DEFAULT false NOT NULL,
    cloud_run boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE cluster_providers_gcp_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE cluster_providers_gcp_id_seq OWNED BY cluster_providers_gcp.id;

CREATE TABLE clusters (
    id bigint NOT NULL,
    user_id bigint,
    provider_type integer,
    platform_type integer,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    enabled boolean DEFAULT true,
    name character varying NOT NULL,
    environment_scope character varying DEFAULT '*'::character varying NOT NULL,
    cluster_type smallint DEFAULT 3 NOT NULL,
    domain character varying,
    managed boolean DEFAULT true NOT NULL,
    namespace_per_environment boolean DEFAULT true NOT NULL,
    management_project_id bigint,
    cleanup_status smallint DEFAULT 1 NOT NULL,
    cleanup_status_reason text,
    helm_major_version integer DEFAULT 3 NOT NULL
);

CREATE SEQUENCE clusters_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE clusters_id_seq OWNED BY clusters.id;

CREATE TABLE clusters_integration_prometheus (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    cluster_id bigint NOT NULL,
    enabled boolean DEFAULT false NOT NULL,
    encrypted_alert_manager_token text,
    encrypted_alert_manager_token_iv text,
    health_status smallint DEFAULT 0 NOT NULL
);

CREATE TABLE clusters_kubernetes_namespaces (
    id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    project_id bigint,
    cluster_project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    encrypted_service_account_token text,
    encrypted_service_account_token_iv character varying,
    namespace character varying NOT NULL,
    service_account_name character varying,
    environment_id bigint
);

CREATE SEQUENCE clusters_kubernetes_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE clusters_kubernetes_namespaces_id_seq OWNED BY clusters_kubernetes_namespaces.id;

CREATE TABLE clusters_managed_resources (
    id bigint NOT NULL,
    build_id bigint NOT NULL,
    project_id bigint NOT NULL,
    environment_id bigint NOT NULL,
    cluster_agent_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    template_name text,
    tracked_objects jsonb DEFAULT '[]'::jsonb NOT NULL,
    deletion_strategy smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_4f81a98847 CHECK ((char_length(template_name) <= 1024))
);

CREATE SEQUENCE clusters_managed_resources_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE clusters_managed_resources_id_seq OWNED BY clusters_managed_resources.id;

CREATE TABLE commit_user_mentions (
    id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    commit_id character varying NOT NULL,
    note_id bigint NOT NULL
);

CREATE SEQUENCE commit_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE commit_user_mentions_id_seq OWNED BY commit_user_mentions.id;

CREATE TABLE compliance_framework_security_policies (
    id bigint NOT NULL,
    framework_id bigint NOT NULL,
    policy_configuration_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    policy_index smallint NOT NULL,
    project_id bigint,
    namespace_id bigint,
    security_policy_id bigint,
    CONSTRAINT check_473e5b2da9 CHECK ((num_nonnulls(namespace_id, project_id) = 1))
);

CREATE SEQUENCE compliance_framework_security_policies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE compliance_framework_security_policies_id_seq OWNED BY compliance_framework_security_policies.id;

CREATE TABLE compliance_management_frameworks (
    id bigint NOT NULL,
    name text NOT NULL,
    description text NOT NULL,
    color text NOT NULL,
    namespace_id bigint NOT NULL,
    pipeline_configuration_full_path text,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    source_id bigint,
    CONSTRAINT check_08cd34b2c2 CHECK ((char_length(color) <= 10)),
    CONSTRAINT check_1617e0b87e CHECK ((char_length(description) <= 255)),
    CONSTRAINT check_ab00bc2193 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_e7a9972435 CHECK ((char_length(pipeline_configuration_full_path) <= 255))
);

CREATE SEQUENCE compliance_management_frameworks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE compliance_management_frameworks_id_seq OWNED BY compliance_management_frameworks.id;

CREATE TABLE compliance_requirements (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    framework_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    name text NOT NULL,
    description text NOT NULL,
    CONSTRAINT check_71d7c59197 CHECK ((char_length(description) <= 500)),
    CONSTRAINT check_f1fb6fdd81 CHECK ((char_length(name) <= 255))
);

CREATE TABLE compliance_requirements_controls (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    compliance_requirement_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    name smallint NOT NULL,
    control_type smallint NOT NULL,
    expression text,
    encrypted_secret_token bytea,
    encrypted_secret_token_iv bytea,
    external_url text,
    external_control_name text,
    CONSTRAINT check_110c87ed8d CHECK ((char_length(expression) <= 255)),
    CONSTRAINT check_5020dd6745 CHECK ((char_length(external_url) <= 1024)),
    CONSTRAINT check_e3c26a3c02 CHECK ((char_length(external_control_name) <= 255))
);

CREATE SEQUENCE compliance_requirements_controls_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE compliance_requirements_controls_id_seq OWNED BY compliance_requirements_controls.id;

CREATE SEQUENCE compliance_requirements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE compliance_requirements_id_seq OWNED BY compliance_requirements.id;

CREATE TABLE compromised_password_detections (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    resolved_at timestamp with time zone,
    user_id bigint NOT NULL
);

CREATE SEQUENCE compromised_password_detections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE compromised_password_detections_id_seq OWNED BY compromised_password_detections.id;

CREATE TABLE container_expiration_policies (
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    next_run_at timestamp with time zone,
    name_regex character varying(255) DEFAULT '.*'::character varying,
    cadence character varying(12) DEFAULT '1d'::character varying NOT NULL,
    older_than character varying(12) DEFAULT '90d'::character varying,
    keep_n integer DEFAULT 10,
    enabled boolean DEFAULT false NOT NULL,
    name_regex_keep text,
    CONSTRAINT container_expiration_policies_name_regex_keep CHECK ((char_length(name_regex_keep) <= 255))
);

CREATE TABLE container_registry_data_repair_details (
    missing_count integer DEFAULT 0,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL
);

CREATE TABLE container_registry_protection_rules (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    repository_path_pattern text,
    minimum_access_level_for_push smallint,
    minimum_access_level_for_delete smallint,
    CONSTRAINT check_0dc4ab5f43 CHECK ((num_nonnulls(minimum_access_level_for_delete, minimum_access_level_for_push) > 0)),
    CONSTRAINT check_3658b31291 CHECK ((repository_path_pattern IS NOT NULL)),
    CONSTRAINT check_d53a270af5 CHECK ((char_length(repository_path_pattern) <= 255))
);

CREATE SEQUENCE container_registry_protection_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE container_registry_protection_rules_id_seq OWNED BY container_registry_protection_rules.id;

CREATE TABLE container_registry_protection_tag_rules (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    minimum_access_level_for_push smallint,
    minimum_access_level_for_delete smallint,
    tag_name_pattern text NOT NULL,
    CONSTRAINT check_50aba315a8 CHECK ((char_length(tag_name_pattern) <= 255)),
    CONSTRAINT check_ae29637175 CHECK ((num_nonnulls(minimum_access_level_for_delete, minimum_access_level_for_push) <> 1))
);

CREATE SEQUENCE container_registry_protection_tag_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE container_registry_protection_tag_rules_id_seq OWNED BY container_registry_protection_tag_rules.id;

CREATE TABLE container_repositories (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    status smallint,
    expiration_policy_started_at timestamp with time zone,
    expiration_policy_cleanup_status smallint DEFAULT 0 NOT NULL,
    expiration_policy_completed_at timestamp with time zone,
    last_cleanup_deleted_tags_count integer,
    delete_started_at timestamp with time zone,
    status_updated_at timestamp with time zone,
    failed_deletion_count integer DEFAULT 0 NOT NULL,
    next_delete_attempt_at timestamp with time zone,
    CONSTRAINT check_container_repositories_non_negative_failed_deletion_count CHECK ((failed_deletion_count >= 0))
);

CREATE SEQUENCE container_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE container_repositories_id_seq OWNED BY container_repositories.id;

CREATE TABLE container_repository_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    container_repository_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    project_id bigint,
    CONSTRAINT check_c96417dbc5 CHECK ((char_length(verification_failure) <= 255)),
    CONSTRAINT check_d65b1f0839 CHECK ((project_id IS NOT NULL))
);

CREATE TABLE content_blocked_states (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    commit_sha bytea NOT NULL,
    blob_sha bytea NOT NULL,
    path text NOT NULL,
    container_identifier text NOT NULL,
    CONSTRAINT check_023093d38f CHECK ((char_length(container_identifier) <= 255)),
    CONSTRAINT check_1870100678 CHECK ((char_length(path) <= 2048))
);

COMMENT ON TABLE content_blocked_states IS 'JiHu-specific table';

CREATE SEQUENCE content_blocked_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE content_blocked_states_id_seq OWNED BY content_blocked_states.id;

CREATE TABLE conversational_development_index_metrics (
    id bigint NOT NULL,
    leader_issues double precision NOT NULL,
    instance_issues double precision NOT NULL,
    leader_notes double precision NOT NULL,
    instance_notes double precision NOT NULL,
    leader_milestones double precision NOT NULL,
    instance_milestones double precision NOT NULL,
    leader_boards double precision NOT NULL,
    instance_boards double precision NOT NULL,
    leader_merge_requests double precision NOT NULL,
    instance_merge_requests double precision NOT NULL,
    leader_ci_pipelines double precision NOT NULL,
    instance_ci_pipelines double precision NOT NULL,
    leader_environments double precision NOT NULL,
    instance_environments double precision NOT NULL,
    leader_deployments double precision NOT NULL,
    instance_deployments double precision NOT NULL,
    leader_projects_prometheus_active double precision NOT NULL,
    instance_projects_prometheus_active double precision NOT NULL,
    leader_service_desk_issues double precision NOT NULL,
    instance_service_desk_issues double precision NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    percentage_boards double precision DEFAULT 0.0 NOT NULL,
    percentage_ci_pipelines double precision DEFAULT 0.0 NOT NULL,
    percentage_deployments double precision DEFAULT 0.0 NOT NULL,
    percentage_environments double precision DEFAULT 0.0 NOT NULL,
    percentage_issues double precision DEFAULT 0.0 NOT NULL,
    percentage_merge_requests double precision DEFAULT 0.0 NOT NULL,
    percentage_milestones double precision DEFAULT 0.0 NOT NULL,
    percentage_notes double precision DEFAULT 0.0 NOT NULL,
    percentage_projects_prometheus_active double precision DEFAULT 0.0 NOT NULL,
    percentage_service_desk_issues double precision DEFAULT 0.0 NOT NULL
);

CREATE SEQUENCE conversational_development_index_metrics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE conversational_development_index_metrics_id_seq OWNED BY conversational_development_index_metrics.id;

CREATE TABLE country_access_logs (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    access_count_reset_at timestamp with time zone,
    first_access_at timestamp with time zone,
    last_access_at timestamp with time zone,
    user_id bigint NOT NULL,
    access_count integer DEFAULT 0 NOT NULL,
    country_code smallint NOT NULL
);

CREATE SEQUENCE country_access_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE country_access_logs_id_seq OWNED BY country_access_logs.id;

CREATE TABLE coverage_fuzzing_corpuses (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint,
    package_id bigint NOT NULL,
    file_updated_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE coverage_fuzzing_corpuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE coverage_fuzzing_corpuses_id_seq OWNED BY coverage_fuzzing_corpuses.id;

CREATE TABLE csv_issue_imports (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE csv_issue_imports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE csv_issue_imports_id_seq OWNED BY csv_issue_imports.id;

CREATE TABLE custom_emoji (
    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,
    name text NOT NULL,
    file text NOT NULL,
    external boolean DEFAULT true NOT NULL,
    creator_id bigint NOT NULL,
    CONSTRAINT check_8c586dd507 CHECK ((char_length(name) <= 36)),
    CONSTRAINT check_dd5d60f1fb CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE custom_emoji_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE custom_emoji_id_seq OWNED BY custom_emoji.id;

CREATE TABLE custom_field_select_options (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    custom_field_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    "position" smallint NOT NULL,
    value text NOT NULL,
    CONSTRAINT check_fbed57c2bf CHECK ((char_length(value) <= 255))
);

CREATE SEQUENCE custom_field_select_options_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE custom_field_select_options_id_seq OWNED BY custom_field_select_options.id;

CREATE TABLE custom_fields (
    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,
    archived_at timestamp with time zone,
    field_type smallint NOT NULL,
    name text NOT NULL,
    created_by_id bigint,
    updated_by_id bigint,
    CONSTRAINT check_b047b04af9 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE custom_fields_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE custom_fields_id_seq OWNED BY custom_fields.id;

CREATE TABLE custom_software_licenses (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    CONSTRAINT check_4e365784ce CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE custom_software_licenses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE custom_software_licenses_id_seq OWNED BY custom_software_licenses.id;

CREATE TABLE customer_relations_contacts (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    organization_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 1 NOT NULL,
    phone text,
    first_name text NOT NULL,
    last_name text NOT NULL,
    email text,
    description text,
    CONSTRAINT check_1195f4c929 CHECK ((char_length(first_name) <= 255)),
    CONSTRAINT check_40c70da037 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_cd2d67c484 CHECK ((char_length(last_name) <= 255)),
    CONSTRAINT check_f4b7f78c89 CHECK ((char_length(phone) <= 32)),
    CONSTRAINT check_fc0adabf60 CHECK ((char_length(email) <= 255))
);

CREATE SEQUENCE customer_relations_contacts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE customer_relations_contacts_id_seq OWNED BY customer_relations_contacts.id;

CREATE TABLE customer_relations_organizations (
    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,
    state smallint DEFAULT 1 NOT NULL,
    default_rate numeric(18,2),
    name text NOT NULL,
    description text,
    CONSTRAINT check_2ba9ef1c4c CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_e476b6058e CHECK ((char_length(description) <= 1024))
);

CREATE SEQUENCE customer_relations_organizations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE customer_relations_organizations_id_seq OWNED BY customer_relations_organizations.id;

CREATE TABLE dast_pre_scan_verification_steps (
    id bigint NOT NULL,
    dast_pre_scan_verification_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text,
    verification_errors text[] DEFAULT '{}'::text[] NOT NULL,
    check_type smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_2cf67eeb54 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_cd216b95e4 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE dast_pre_scan_verification_steps_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_pre_scan_verification_steps_id_seq OWNED BY dast_pre_scan_verification_steps.id;

CREATE TABLE dast_pre_scan_verifications (
    id bigint NOT NULL,
    dast_profile_id bigint NOT NULL,
    ci_pipeline_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_a764bbc378 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE dast_pre_scan_verifications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_pre_scan_verifications_id_seq OWNED BY dast_pre_scan_verifications.id;

CREATE TABLE dast_profile_schedules (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    dast_profile_id bigint NOT NULL,
    user_id bigint,
    next_run_at timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    active boolean DEFAULT true NOT NULL,
    cron text NOT NULL,
    cadence jsonb DEFAULT '{}'::jsonb NOT NULL,
    timezone text NOT NULL,
    starts_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT check_86531ea73f CHECK ((char_length(cron) <= 255)),
    CONSTRAINT check_be4d1c3af1 CHECK ((char_length(timezone) <= 255))
);

COMMENT ON TABLE dast_profile_schedules IS '{"owner":"group::dynamic analysis","description":"Scheduling for scans using DAST Profiles"}';

CREATE SEQUENCE dast_profile_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_profile_schedules_id_seq OWNED BY dast_profile_schedules.id;

CREATE TABLE dast_profiles (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    dast_site_profile_id bigint NOT NULL,
    dast_scanner_profile_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    description text NOT NULL,
    branch_name text,
    CONSTRAINT check_5fcf73bf61 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_6c9d775949 CHECK ((char_length(branch_name) <= 255)),
    CONSTRAINT check_c34e505c24 CHECK ((char_length(description) <= 255))
);

COMMENT ON TABLE dast_profiles IS '{"owner":"group::dynamic analysis","description":"Profile used to run a DAST on-demand scan"}';

CREATE SEQUENCE dast_profiles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_profiles_id_seq OWNED BY dast_profiles.id;

CREATE TABLE dast_profiles_pipelines (
    dast_profile_id bigint NOT NULL,
    ci_pipeline_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_39563bc8de CHECK ((project_id IS NOT NULL))
);

COMMENT ON TABLE dast_profiles_pipelines IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Profiles and CI Pipelines"}';

CREATE TABLE dast_profiles_tags (
    id bigint NOT NULL,
    dast_profile_id bigint NOT NULL,
    tag_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_b1aa92f799 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE dast_profiles_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_profiles_tags_id_seq OWNED BY dast_profiles_tags.id;

CREATE TABLE dast_scanner_profiles (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    spider_timeout smallint,
    target_timeout smallint,
    name text NOT NULL,
    scan_type smallint DEFAULT 1 NOT NULL,
    use_ajax_spider boolean DEFAULT false NOT NULL,
    show_debug_messages boolean DEFAULT false NOT NULL,
    CONSTRAINT check_568568fabf CHECK ((char_length(name) <= 255))
);

CREATE TABLE dast_scanner_profiles_builds (
    dast_scanner_profile_id bigint NOT NULL,
    ci_build_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_2f3b8ab3e6 CHECK ((project_id IS NOT NULL))
);

COMMENT ON TABLE dast_scanner_profiles_builds IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Scanner Profiles and CI Builds"}';

CREATE SEQUENCE dast_scanner_profiles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_scanner_profiles_id_seq OWNED BY dast_scanner_profiles.id;

CREATE TABLE dast_site_profile_secret_variables (
    id bigint NOT NULL,
    dast_site_profile_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    variable_type smallint DEFAULT 1 NOT NULL,
    key text NOT NULL,
    encrypted_value bytea NOT NULL,
    encrypted_value_iv bytea NOT NULL,
    project_id bigint,
    CONSTRAINT check_236213f179 CHECK ((length(encrypted_value) <= 13352)),
    CONSTRAINT check_8cbef204b2 CHECK ((char_length(key) <= 255)),
    CONSTRAINT check_b49080abbf CHECK ((length(encrypted_value_iv) <= 17)),
    CONSTRAINT check_d972e5f59d CHECK ((project_id IS NOT NULL))
);

COMMENT ON TABLE dast_site_profile_secret_variables IS '{"owner":"group::dynamic analysis","description":"Secret variables used in DAST on-demand scans"}';

CREATE SEQUENCE dast_site_profile_secret_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_site_profile_secret_variables_id_seq OWNED BY dast_site_profile_secret_variables.id;

CREATE TABLE dast_site_profiles (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    dast_site_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    excluded_urls text[] DEFAULT '{}'::text[] NOT NULL,
    auth_enabled boolean DEFAULT false NOT NULL,
    auth_url text,
    auth_username_field text,
    auth_password_field text,
    auth_username text,
    target_type smallint DEFAULT 0 NOT NULL,
    scan_method smallint DEFAULT 0 NOT NULL,
    auth_submit_field text,
    scan_file_path text,
    optional_variables jsonb DEFAULT '[]'::jsonb NOT NULL,
    CONSTRAINT check_5203110fee CHECK ((char_length(auth_username_field) <= 255)),
    CONSTRAINT check_6cfab17b48 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_8d2aa0f66d CHECK ((char_length(scan_file_path) <= 1024)),
    CONSTRAINT check_af44f54c96 CHECK ((char_length(auth_submit_field) <= 255)),
    CONSTRAINT check_c329dffdba CHECK ((char_length(auth_password_field) <= 255)),
    CONSTRAINT check_d446f7047b CHECK ((char_length(auth_url) <= 1024)),
    CONSTRAINT check_f22f18002a CHECK ((char_length(auth_username) <= 255))
);

CREATE TABLE dast_site_profiles_builds (
    dast_site_profile_id bigint NOT NULL,
    ci_build_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_581c9bb699 CHECK ((project_id IS NOT NULL))
);

COMMENT ON TABLE dast_site_profiles_builds IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Site Profiles and CI Builds"}';

CREATE SEQUENCE dast_site_profiles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_site_profiles_id_seq OWNED BY dast_site_profiles.id;

CREATE TABLE dast_site_tokens (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    expired_at timestamp with time zone,
    token text NOT NULL,
    url text NOT NULL,
    CONSTRAINT check_02a6bf20a7 CHECK ((char_length(token) <= 255)),
    CONSTRAINT check_69ab8622a6 CHECK ((char_length(url) <= 255))
);

CREATE SEQUENCE dast_site_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_site_tokens_id_seq OWNED BY dast_site_tokens.id;

CREATE TABLE dast_site_validations (
    id bigint NOT NULL,
    dast_site_token_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    validation_started_at timestamp with time zone,
    validation_passed_at timestamp with time zone,
    validation_failed_at timestamp with time zone,
    validation_last_retried_at timestamp with time zone,
    validation_strategy smallint NOT NULL,
    url_base text NOT NULL,
    url_path text NOT NULL,
    state text DEFAULT 'pending'::text NOT NULL,
    project_id bigint,
    CONSTRAINT check_13b34efe4b CHECK ((char_length(url_path) <= 255)),
    CONSTRAINT check_283be72e9b CHECK ((char_length(state) <= 255)),
    CONSTRAINT check_cb7514c7d3 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_cd3b538210 CHECK ((char_length(url_base) <= 255))
);

CREATE SEQUENCE dast_site_validations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_site_validations_id_seq OWNED BY dast_site_validations.id;

CREATE TABLE dast_sites (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    url text NOT NULL,
    dast_site_validation_id bigint,
    CONSTRAINT check_46df8b449c CHECK ((char_length(url) <= 255))
);

CREATE SEQUENCE dast_sites_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dast_sites_id_seq OWNED BY dast_sites.id;

CREATE TABLE dependency_list_export_part_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE dependency_list_export_parts (
    id bigint NOT NULL,
    dependency_list_export_id bigint NOT NULL,
    start_id bigint NOT NULL,
    end_id bigint NOT NULL,
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store integer,
    file text,
    CONSTRAINT check_f799431fc1 CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE dependency_list_export_parts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dependency_list_export_parts_id_seq OWNED BY dependency_list_export_parts.id;

CREATE TABLE dependency_list_export_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE dependency_list_exports (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    user_id bigint,
    file_store integer,
    status smallint DEFAULT 0 NOT NULL,
    file text,
    group_id bigint,
    pipeline_id bigint,
    export_type smallint DEFAULT 0 NOT NULL,
    organization_id bigint,
    expires_at timestamp with time zone,
    send_email boolean DEFAULT false NOT NULL,
    CONSTRAINT check_67a9c23e79 CHECK ((num_nonnulls(group_id, organization_id, project_id) > 0)),
    CONSTRAINT check_fff6fc9b2f CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE dependency_list_exports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dependency_list_exports_id_seq OWNED BY dependency_list_exports.id;

CREATE TABLE dependency_proxy_blob_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    dependency_proxy_blob_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    group_id bigint,
    CONSTRAINT check_8e4f76fffe CHECK ((char_length(verification_failure) <= 255))
);

COMMENT ON TABLE dependency_proxy_blob_states IS '{"owner":"group::geo","description":"Geo-specific table to store the verification state of DependencyProxy::Blob objects"}';

CREATE TABLE dependency_proxy_blobs (
    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,
    size bigint,
    file_store integer,
    file_name character varying NOT NULL,
    file text NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    read_at timestamp with time zone DEFAULT now() NOT NULL
);

CREATE SEQUENCE dependency_proxy_blobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dependency_proxy_blobs_id_seq OWNED BY dependency_proxy_blobs.id;

CREATE TABLE dependency_proxy_group_settings (
    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,
    enabled boolean DEFAULT true NOT NULL,
    identity jsonb,
    secret jsonb,
    CONSTRAINT check_7ed6c2f608 CHECK (((num_nonnulls(identity, secret) = 2) OR (num_nulls(identity, secret) = 2)))
);

CREATE SEQUENCE dependency_proxy_group_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dependency_proxy_group_settings_id_seq OWNED BY dependency_proxy_group_settings.id;

CREATE TABLE dependency_proxy_image_ttl_group_policies (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    ttl integer DEFAULT 90,
    enabled boolean DEFAULT false NOT NULL
);

CREATE TABLE dependency_proxy_manifest_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    dependency_proxy_manifest_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    group_id bigint,
    CONSTRAINT check_fdd5d9791b CHECK ((char_length(verification_failure) <= 255))
);

CREATE TABLE dependency_proxy_manifests (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    size bigint,
    file_store smallint,
    file_name text NOT NULL,
    file text NOT NULL,
    digest text NOT NULL,
    content_type text,
    status smallint DEFAULT 0 NOT NULL,
    read_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT check_079b293a7b CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_167a9a8a91 CHECK ((char_length(content_type) <= 255)),
    CONSTRAINT check_c579e3f586 CHECK ((char_length(file_name) <= 255)),
    CONSTRAINT check_f5d9996bf1 CHECK ((char_length(digest) <= 255))
);

CREATE SEQUENCE dependency_proxy_manifests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dependency_proxy_manifests_id_seq OWNED BY dependency_proxy_manifests.id;

CREATE TABLE dependency_proxy_packages_settings (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    enabled boolean DEFAULT false,
    maven_external_registry_url text,
    encrypted_maven_external_registry_username bytea,
    encrypted_maven_external_registry_username_iv bytea,
    encrypted_maven_external_registry_password bytea,
    encrypted_maven_external_registry_password_iv bytea,
    npm_external_registry_url text,
    encrypted_npm_external_registry_basic_auth bytea,
    encrypted_npm_external_registry_basic_auth_iv bytea,
    encrypted_npm_external_registry_auth_token bytea,
    encrypted_npm_external_registry_auth_token_iv bytea,
    CONSTRAINT check_12c046b67f CHECK ((char_length(npm_external_registry_url) <= 255)),
    CONSTRAINT check_14a2818907 CHECK (((num_nulls(encrypted_maven_external_registry_username, encrypted_maven_external_registry_password) = 0) OR (num_nulls(encrypted_maven_external_registry_username, encrypted_maven_external_registry_password) = 2))),
    CONSTRAINT check_353c7ecafd CHECK ((octet_length(encrypted_maven_external_registry_username) <= 1020)),
    CONSTRAINT check_48643112c8 CHECK ((octet_length(encrypted_npm_external_registry_auth_token) <= 1020)),
    CONSTRAINT check_54126e21c1 CHECK ((octet_length(encrypted_npm_external_registry_basic_auth) <= 1020)),
    CONSTRAINT check_7fafb5606e CHECK ((octet_length(encrypted_npm_external_registry_basic_auth_iv) <= 1020)),
    CONSTRAINT check_93afb1690f CHECK ((num_nulls(encrypted_npm_external_registry_basic_auth, encrypted_npm_external_registry_auth_token) > 0)),
    CONSTRAINT check_ac55c514a5 CHECK ((char_length(maven_external_registry_url) <= 255)),
    CONSTRAINT check_c6f700648d CHECK ((octet_length(encrypted_maven_external_registry_password) <= 1020)),
    CONSTRAINT check_c8613a3d35 CHECK ((octet_length(encrypted_npm_external_registry_auth_token_iv) <= 1020)),
    CONSTRAINT check_cdf5f9a434 CHECK ((octet_length(encrypted_maven_external_registry_password_iv) <= 1020)),
    CONSTRAINT check_fd5def68ba CHECK ((octet_length(encrypted_maven_external_registry_username_iv) <= 1020))
);

CREATE TABLE deploy_keys_projects (
    id bigint NOT NULL,
    deploy_key_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    can_push boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE deploy_keys_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE deploy_keys_projects_id_seq OWNED BY deploy_keys_projects.id;

CREATE TABLE deploy_tokens (
    id bigint NOT NULL,
    revoked boolean DEFAULT false,
    read_repository boolean DEFAULT false NOT NULL,
    read_registry boolean DEFAULT false NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    name character varying NOT NULL,
    username character varying,
    token_encrypted character varying(255),
    deploy_token_type smallint DEFAULT 2 NOT NULL,
    write_registry boolean DEFAULT false NOT NULL,
    read_package_registry boolean DEFAULT false NOT NULL,
    write_package_registry boolean DEFAULT false NOT NULL,
    creator_id bigint,
    read_virtual_registry boolean DEFAULT false NOT NULL,
    project_id bigint,
    group_id bigint,
    write_virtual_registry boolean DEFAULT false NOT NULL,
    seven_days_notification_sent_at timestamp with time zone,
    thirty_days_notification_sent_at timestamp with time zone,
    sixty_days_notification_sent_at timestamp with time zone
);

CREATE SEQUENCE deploy_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE deploy_tokens_id_seq OWNED BY deploy_tokens.id;

CREATE TABLE deployment_approvals (
    id bigint NOT NULL,
    deployment_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint NOT NULL,
    comment text,
    approval_rule_id bigint,
    project_id bigint,
    ci_build_id bigint,
    CONSTRAINT check_692c1d1b90 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_e2eb6a17d8 CHECK ((char_length(comment) <= 255))
);

CREATE SEQUENCE deployment_approvals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE deployment_approvals_id_seq OWNED BY deployment_approvals.id;

CREATE TABLE deployment_clusters (
    deployment_id bigint NOT NULL,
    cluster_id bigint NOT NULL,
    kubernetes_namespace character varying(255)
);

CREATE TABLE deployment_merge_requests (
    deployment_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    environment_id bigint,
    project_id bigint
);

CREATE TABLE deployments (
    id bigint NOT NULL,
    iid integer NOT NULL,
    project_id bigint NOT NULL,
    environment_id bigint NOT NULL,
    ref character varying NOT NULL,
    tag boolean NOT NULL,
    sha character varying NOT NULL,
    user_id bigint,
    deployable_type character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    on_stop character varying,
    status smallint NOT NULL,
    finished_at timestamp with time zone,
    deployable_id bigint,
    archived boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE deployments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE deployments_id_seq OWNED BY deployments.id;

CREATE TABLE description_versions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_id bigint,
    merge_request_id bigint,
    epic_id bigint,
    description text,
    deleted_at timestamp with time zone,
    namespace_id bigint NOT NULL,
    CONSTRAINT check_76c1eb7122 CHECK ((num_nonnulls(epic_id, issue_id, merge_request_id) = 1))
);

CREATE SEQUENCE description_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE description_versions_id_seq OWNED BY description_versions.id;

CREATE TABLE design_management_action_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE design_management_designs (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    issue_id bigint,
    filename character varying NOT NULL,
    relative_position integer,
    iid integer,
    cached_markdown_version integer,
    description text,
    description_html text,
    imported_from smallint DEFAULT 0 NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)),
    CONSTRAINT check_aaf9fa6ae5 CHECK ((char_length(description) <= 1000000)),
    CONSTRAINT check_cfb92df01a CHECK ((iid IS NOT NULL)),
    CONSTRAINT check_ed4c70e3f1 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE design_management_designs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE design_management_designs_id_seq OWNED BY design_management_designs.id;

CREATE TABLE design_management_designs_versions (
    id bigint NOT NULL,
    design_id bigint NOT NULL,
    version_id bigint NOT NULL,
    event smallint DEFAULT 0 NOT NULL,
    image_v432x230 character varying(255),
    namespace_id bigint,
    CONSTRAINT check_ae7359f44b CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE design_management_designs_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE design_management_designs_versions_id_seq OWNED BY design_management_designs_versions.id;

CREATE TABLE design_management_repositories (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_4f95da7ef9 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE design_management_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE design_management_repositories_id_seq OWNED BY design_management_repositories.id;

CREATE TABLE design_management_repository_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    design_management_repository_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    namespace_id bigint,
    CONSTRAINT check_380bdde342 CHECK ((namespace_id IS NOT NULL)),
    CONSTRAINT check_bf1387c28b CHECK ((char_length(verification_failure) <= 255))
);

CREATE TABLE design_management_versions (
    id bigint NOT NULL,
    sha bytea NOT NULL,
    issue_id bigint,
    created_at timestamp with time zone NOT NULL,
    author_id bigint,
    namespace_id bigint,
    CONSTRAINT check_1d0291f47a CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE design_management_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE design_management_versions_id_seq OWNED BY design_management_versions.id;

CREATE TABLE design_user_mentions (
    id bigint NOT NULL,
    design_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    note_id bigint NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_6e9fbd8673 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE design_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE design_user_mentions_id_seq OWNED BY design_user_mentions.id;

CREATE TABLE detached_partitions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    drop_after timestamp with time zone NOT NULL,
    table_name text NOT NULL,
    CONSTRAINT check_aecee24ba3 CHECK ((char_length(table_name) <= 63))
);

CREATE SEQUENCE detached_partitions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE detached_partitions_id_seq OWNED BY detached_partitions.id;

CREATE TABLE diff_note_positions (
    id bigint NOT NULL,
    note_id bigint NOT NULL,
    old_line integer,
    new_line integer,
    diff_content_type smallint NOT NULL,
    diff_type smallint NOT NULL,
    line_code character varying(255) NOT NULL,
    base_sha bytea NOT NULL,
    start_sha bytea NOT NULL,
    head_sha bytea NOT NULL,
    old_path text NOT NULL,
    new_path text NOT NULL
);

CREATE SEQUENCE diff_note_positions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE diff_note_positions_id_seq OWNED BY diff_note_positions.id;

CREATE TABLE dingtalk_tracker_data (
    id bigint NOT NULL,
    integration_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    corpid text,
    CONSTRAINT check_d3fe332e6a CHECK ((char_length(corpid) <= 255))
);

COMMENT ON TABLE dingtalk_tracker_data IS 'JiHu-specific table';

COMMENT ON COLUMN dingtalk_tracker_data.integration_id IS 'JiHu-specific column';

COMMENT ON COLUMN dingtalk_tracker_data.corpid IS 'JiHu-specific column';

CREATE SEQUENCE dingtalk_tracker_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dingtalk_tracker_data_id_seq OWNED BY dingtalk_tracker_data.id;

CREATE TABLE dora_configurations (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    branches_for_lead_time_for_changes text[] DEFAULT '{}'::text[] NOT NULL
);

CREATE SEQUENCE dora_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dora_configurations_id_seq OWNED BY dora_configurations.id;

CREATE TABLE dora_daily_metrics (
    id bigint NOT NULL,
    environment_id bigint NOT NULL,
    date date NOT NULL,
    deployment_frequency integer,
    lead_time_for_changes_in_seconds integer,
    time_to_restore_service_in_seconds integer,
    incidents_count integer,
    project_id bigint,
    CONSTRAINT check_25a1971e50 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT dora_daily_metrics_deployment_frequency_positive CHECK ((deployment_frequency >= 0)),
    CONSTRAINT dora_daily_metrics_lead_time_for_changes_in_seconds_positive CHECK ((lead_time_for_changes_in_seconds >= 0))
);

CREATE SEQUENCE dora_daily_metrics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dora_daily_metrics_id_seq OWNED BY dora_daily_metrics.id;

CREATE TABLE dora_performance_scores (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    date date NOT NULL,
    deployment_frequency smallint,
    lead_time_for_changes smallint,
    time_to_restore_service smallint,
    change_failure_rate smallint
);

CREATE SEQUENCE dora_performance_scores_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE dora_performance_scores_id_seq OWNED BY dora_performance_scores.id;

CREATE TABLE draft_notes (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    author_id bigint NOT NULL,
    resolve_discussion boolean DEFAULT false NOT NULL,
    discussion_id character varying,
    note text NOT NULL,
    "position" text,
    original_position text,
    change_position text,
    commit_id bytea,
    line_code text,
    internal boolean DEFAULT false NOT NULL,
    note_type smallint,
    project_id bigint,
    CONSTRAINT check_2a752d05fe CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_c497a94a0e CHECK ((char_length(line_code) <= 255))
);

CREATE SEQUENCE draft_notes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE draft_notes_id_seq OWNED BY draft_notes.id;

CREATE TABLE duo_workflows_checkpoint_writes (
    id bigint NOT NULL,
    workflow_id bigint NOT NULL,
    project_id bigint,
    idx integer NOT NULL,
    thread_ts text NOT NULL,
    task text NOT NULL,
    channel text NOT NULL,
    write_type text NOT NULL,
    data text NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_38dc205bb2 CHECK ((char_length(data) <= 10000)),
    CONSTRAINT check_3d119c06ee CHECK ((num_nonnulls(namespace_id, project_id) = 1)),
    CONSTRAINT check_c64af76670 CHECK ((char_length(write_type) <= 255)),
    CONSTRAINT check_d66d09c813 CHECK ((char_length(task) <= 255)),
    CONSTRAINT check_ddb83bc2d5 CHECK ((char_length(channel) <= 255)),
    CONSTRAINT check_f12e0c8f88 CHECK ((char_length(thread_ts) <= 255))
);

CREATE SEQUENCE duo_workflows_checkpoint_writes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE duo_workflows_checkpoint_writes_id_seq OWNED BY duo_workflows_checkpoint_writes.id;

CREATE TABLE duo_workflows_checkpoints (
    id bigint NOT NULL,
    workflow_id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    thread_ts text NOT NULL,
    parent_ts text,
    checkpoint jsonb NOT NULL,
    metadata jsonb NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_3dcc551d16 CHECK ((char_length(parent_ts) <= 255)),
    CONSTRAINT check_4b59da71b6 CHECK ((num_nonnulls(namespace_id, project_id) = 1)),
    CONSTRAINT check_5d3139b983 CHECK ((char_length(thread_ts) <= 255))
);

CREATE SEQUENCE duo_workflows_checkpoints_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE duo_workflows_checkpoints_id_seq OWNED BY duo_workflows_checkpoints.id;

CREATE TABLE duo_workflows_events (
    id bigint NOT NULL,
    workflow_id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    event_type smallint NOT NULL,
    event_status smallint NOT NULL,
    message text,
    correlation_id_value text,
    namespace_id bigint,
    CONSTRAINT check_125840165c CHECK ((char_length(message) <= 16384)),
    CONSTRAINT check_5e35596b00 CHECK ((char_length(correlation_id_value) <= 128)),
    CONSTRAINT check_9014d33202 CHECK ((num_nonnulls(namespace_id, project_id) = 1))
);

CREATE SEQUENCE duo_workflows_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE duo_workflows_events_id_seq OWNED BY duo_workflows_events.id;

CREATE TABLE duo_workflows_workflows (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    goal text,
    agent_privileges smallint[] DEFAULT '{1,2}'::smallint[] NOT NULL,
    workflow_definition text DEFAULT 'software_development'::text NOT NULL,
    allow_agent_to_request_user boolean DEFAULT true NOT NULL,
    pre_approved_agent_privileges smallint[] DEFAULT '{1,2}'::smallint[] NOT NULL,
    image text,
    environment smallint,
    namespace_id bigint,
    CONSTRAINT check_30ca07a4ef CHECK ((char_length(goal) <= 16384)),
    CONSTRAINT check_3a9162f1ae CHECK ((char_length(image) <= 2048)),
    CONSTRAINT check_73884a5839 CHECK ((num_nonnulls(namespace_id, project_id) = 1)),
    CONSTRAINT check_ec723e2a1a CHECK ((char_length(workflow_definition) <= 255))
);

CREATE SEQUENCE duo_workflows_workflows_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE duo_workflows_workflows_id_seq OWNED BY duo_workflows_workflows.id;

CREATE TABLE duo_workflows_workloads (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    workflow_id bigint NOT NULL,
    workload_id bigint NOT NULL
);

CREATE SEQUENCE duo_workflows_workloads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE duo_workflows_workloads_id_seq OWNED BY duo_workflows_workloads.id;

CREATE TABLE early_access_program_tracking_events (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    event_name text NOT NULL,
    event_label text,
    category text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_4faf711d09 CHECK ((char_length(event_label) <= 255)),
    CONSTRAINT check_573cf46c14 CHECK ((char_length(event_name) <= 255)),
    CONSTRAINT check_e631e07806 CHECK ((char_length(category) <= 255))
);

CREATE SEQUENCE early_access_program_tracking_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE early_access_program_tracking_events_id_seq OWNED BY early_access_program_tracking_events.id;

CREATE TABLE elastic_group_index_statuses (
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    wiki_indexed_at timestamp with time zone,
    last_wiki_commit bytea
);

CREATE TABLE elastic_index_settings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    number_of_replicas smallint DEFAULT 1 NOT NULL,
    number_of_shards smallint DEFAULT 5 NOT NULL,
    alias_name text NOT NULL,
    CONSTRAINT check_c30005c325 CHECK ((char_length(alias_name) <= 255))
);

CREATE SEQUENCE elastic_index_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE elastic_index_settings_id_seq OWNED BY elastic_index_settings.id;

CREATE TABLE elastic_reindexing_slices (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    elastic_reindexing_subtask_id bigint NOT NULL,
    elastic_slice smallint DEFAULT 0 NOT NULL,
    elastic_max_slice smallint DEFAULT 0 NOT NULL,
    retry_attempt smallint DEFAULT 0 NOT NULL,
    elastic_task text,
    CONSTRAINT check_ca30e1396e CHECK ((char_length(elastic_task) <= 255))
);

CREATE SEQUENCE elastic_reindexing_slices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE elastic_reindexing_slices_id_seq OWNED BY elastic_reindexing_slices.id;

CREATE TABLE elastic_reindexing_subtasks (
    id bigint NOT NULL,
    elastic_reindexing_task_id bigint NOT NULL,
    alias_name text NOT NULL,
    index_name_from text NOT NULL,
    index_name_to text NOT NULL,
    elastic_task text,
    documents_count_target integer,
    documents_count integer,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_4910adc798 CHECK ((char_length(elastic_task) <= 255)),
    CONSTRAINT check_88f56216a4 CHECK ((char_length(alias_name) <= 255)),
    CONSTRAINT check_a1fbd9faa9 CHECK ((char_length(index_name_from) <= 255)),
    CONSTRAINT check_f456494bd8 CHECK ((char_length(index_name_to) <= 255))
);

CREATE SEQUENCE elastic_reindexing_subtasks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE elastic_reindexing_subtasks_id_seq OWNED BY elastic_reindexing_subtasks.id;

CREATE TABLE elastic_reindexing_tasks (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    in_progress boolean DEFAULT true NOT NULL,
    error_message text,
    delete_original_index_at timestamp with time zone,
    max_slices_running smallint DEFAULT 60 NOT NULL,
    slice_multiplier smallint DEFAULT 2 NOT NULL,
    targets text[],
    options jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT check_7f64acda8e CHECK ((char_length(error_message) <= 255))
);

CREATE SEQUENCE elastic_reindexing_tasks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE elastic_reindexing_tasks_id_seq OWNED BY elastic_reindexing_tasks.id;

CREATE TABLE elasticsearch_indexed_namespaces (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE TABLE elasticsearch_indexed_projects (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL
);

CREATE TABLE emails (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    email character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    confirmation_token character varying,
    confirmed_at timestamp without time zone,
    confirmation_sent_at timestamp without time zone,
    detumbled_email text,
    CONSTRAINT check_319f6999dc CHECK ((char_length(detumbled_email) <= 255))
);

CREATE SEQUENCE emails_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE emails_id_seq OWNED BY emails.id;

CREATE TABLE environments (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    external_url character varying,
    environment_type character varying,
    state character varying DEFAULT 'available'::character varying NOT NULL,
    slug character varying NOT NULL,
    auto_stop_at timestamp with time zone,
    auto_delete_at timestamp with time zone,
    tier smallint,
    merge_request_id bigint,
    cluster_agent_id bigint,
    kubernetes_namespace text,
    flux_resource_path text,
    description text,
    description_html text,
    cached_markdown_version integer,
    auto_stop_setting smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_23b1eb18a2 CHECK ((char_length(flux_resource_path) <= 255)),
    CONSTRAINT check_ad5e1ed5e1 CHECK ((char_length(description) <= 10000)),
    CONSTRAINT check_b5373a1804 CHECK ((char_length(kubernetes_namespace) <= 63)),
    CONSTRAINT check_d26221226f CHECK ((char_length(description_html) <= 50000))
);

CREATE SEQUENCE environments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE environments_id_seq OWNED BY environments.id;

CREATE TABLE epic_issues (
    id bigint NOT NULL,
    epic_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    relative_position integer,
    namespace_id bigint,
    work_item_parent_link_id bigint,
    CONSTRAINT check_885d672eec CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE epic_issues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE epic_issues_id_seq OWNED BY epic_issues.id;

CREATE TABLE epic_user_mentions (
    id bigint NOT NULL,
    epic_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    note_id bigint,
    group_id bigint,
    CONSTRAINT check_4865a37c73 CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE epic_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE epic_user_mentions_id_seq OWNED BY epic_user_mentions.id;

CREATE TABLE epics (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    author_id bigint NOT NULL,
    assignee_id bigint,
    iid integer NOT NULL,
    cached_markdown_version integer,
    updated_by_id bigint,
    last_edited_by_id bigint,
    lock_version integer DEFAULT 0,
    start_date date,
    end_date date,
    last_edited_at timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    title character varying NOT NULL,
    title_html character varying NOT NULL,
    description text,
    description_html text,
    start_date_sourcing_milestone_id bigint,
    due_date_sourcing_milestone_id bigint,
    start_date_fixed date,
    due_date_fixed date,
    start_date_is_fixed boolean,
    due_date_is_fixed boolean,
    closed_by_id bigint,
    closed_at timestamp without time zone,
    parent_id bigint,
    relative_position integer,
    state_id smallint DEFAULT 1 NOT NULL,
    start_date_sourcing_epic_id bigint,
    due_date_sourcing_epic_id bigint,
    confidential boolean DEFAULT false NOT NULL,
    external_key character varying(255),
    color text DEFAULT '#1068bf'::text,
    total_opened_issue_weight integer DEFAULT 0 NOT NULL,
    total_closed_issue_weight integer DEFAULT 0 NOT NULL,
    total_opened_issue_count integer DEFAULT 0 NOT NULL,
    total_closed_issue_count integer DEFAULT 0 NOT NULL,
    issue_id bigint,
    imported smallint DEFAULT 0 NOT NULL,
    imported_from smallint DEFAULT 0 NOT NULL,
    work_item_parent_link_id bigint,
    CONSTRAINT check_450724d1bb CHECK ((issue_id IS NOT NULL)),
    CONSTRAINT check_ca608c40b3 CHECK ((char_length(color) <= 7)),
    CONSTRAINT check_fcfb4a93ff CHECK ((lock_version IS NOT NULL))
);

CREATE SEQUENCE epics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE epics_id_seq OWNED BY epics.id;

CREATE TABLE error_tracking_client_keys (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    active boolean DEFAULT true NOT NULL,
    public_key text NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_840b719790 CHECK ((char_length(public_key) <= 255))
);

CREATE SEQUENCE error_tracking_client_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE error_tracking_client_keys_id_seq OWNED BY error_tracking_client_keys.id;

CREATE TABLE error_tracking_error_events (
    id bigint NOT NULL,
    error_id bigint NOT NULL,
    description text NOT NULL,
    environment text,
    level text,
    occurred_at timestamp with time zone NOT NULL,
    payload jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_4af348772e CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_92ecc3077b CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_c67d5b8007 CHECK ((char_length(level) <= 255)),
    CONSTRAINT check_f4b52474ad CHECK ((char_length(environment) <= 255))
);

CREATE SEQUENCE error_tracking_error_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE error_tracking_error_events_id_seq OWNED BY error_tracking_error_events.id;

CREATE TABLE error_tracking_errors (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    description text NOT NULL,
    actor text NOT NULL,
    first_seen_at timestamp with time zone DEFAULT now() NOT NULL,
    last_seen_at timestamp with time zone DEFAULT now() NOT NULL,
    platform text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    events_count bigint DEFAULT 0 NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_18a758e537 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_b5cb4d3888 CHECK ((char_length(actor) <= 255)),
    CONSTRAINT check_c739788b12 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_fe99886883 CHECK ((char_length(platform) <= 255))
);

CREATE SEQUENCE error_tracking_errors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE error_tracking_errors_id_seq OWNED BY error_tracking_errors.id;

CREATE TABLE events (
    project_id bigint,
    author_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    action smallint NOT NULL,
    target_type character varying,
    group_id bigint,
    fingerprint bytea,
    id bigint NOT NULL,
    target_id bigint,
    imported_from smallint DEFAULT 0 NOT NULL,
    personal_namespace_id bigint,
    CONSTRAINT check_97e06e05ad CHECK ((octet_length(fingerprint) <= 128)),
    CONSTRAINT check_events_sharding_key_is_not_null CHECK (((group_id IS NOT NULL) OR (project_id IS NOT NULL) OR (personal_namespace_id IS NOT NULL)))
);

CREATE SEQUENCE events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE events_id_seq OWNED BY events.id;

CREATE TABLE evidences (
    id bigint NOT NULL,
    release_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    summary_sha bytea,
    summary jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_32e833c325 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE evidences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE evidences_id_seq OWNED BY evidences.id;

CREATE TABLE excluded_merge_requests (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL
);

CREATE SEQUENCE excluded_merge_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE excluded_merge_requests_id_seq OWNED BY excluded_merge_requests.id;

CREATE TABLE external_approval_rules (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_url text NOT NULL,
    name text NOT NULL,
    CONSTRAINT check_1c64b53ea5 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_b634ca168d CHECK ((char_length(external_url) <= 255))
);

CREATE SEQUENCE external_approval_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE external_approval_rules_id_seq OWNED BY external_approval_rules.id;

CREATE TABLE external_pull_requests (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    pull_request_iid integer NOT NULL,
    status smallint NOT NULL,
    source_branch character varying(255) NOT NULL,
    target_branch character varying(255) NOT NULL,
    source_repository character varying(255) NOT NULL,
    target_repository character varying(255) NOT NULL,
    source_sha bytea NOT NULL,
    target_sha bytea NOT NULL
);

CREATE SEQUENCE external_pull_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE external_pull_requests_id_seq OWNED BY external_pull_requests.id;

CREATE TABLE external_status_checks (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    external_url text NOT NULL,
    name text NOT NULL,
    encrypted_shared_secret bytea,
    encrypted_shared_secret_iv bytea,
    CONSTRAINT check_7e3b9eb41a CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_ae0dec3f61 CHECK ((char_length(external_url) <= 255))
);

CREATE SEQUENCE external_status_checks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE external_status_checks_id_seq OWNED BY external_status_checks.id;

CREATE TABLE external_status_checks_protected_branches (
    id bigint NOT NULL,
    external_status_check_id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_94f27f1988 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE external_status_checks_protected_branches_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE external_status_checks_protected_branches_id_seq OWNED BY external_status_checks_protected_branches.id;

CREATE TABLE feature_gates (
    id bigint NOT NULL,
    feature_key character varying NOT NULL,
    key character varying NOT NULL,
    value character varying,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE feature_gates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE feature_gates_id_seq OWNED BY feature_gates.id;

CREATE TABLE features (
    id bigint NOT NULL,
    key character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE features_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE features_id_seq OWNED BY features.id;

CREATE TABLE fork_network_members (
    id bigint NOT NULL,
    fork_network_id bigint NOT NULL,
    project_id bigint NOT NULL,
    forked_from_project_id bigint
);

CREATE SEQUENCE fork_network_members_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE fork_network_members_id_seq OWNED BY fork_network_members.id;

CREATE TABLE fork_networks (
    id bigint NOT NULL,
    root_project_id bigint,
    deleted_root_project_name character varying,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE fork_networks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE fork_networks_id_seq OWNED BY fork_networks.id;

CREATE TABLE geo_cache_invalidation_events (
    id bigint NOT NULL,
    key character varying NOT NULL
);

CREATE SEQUENCE geo_cache_invalidation_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE geo_cache_invalidation_events_id_seq OWNED BY geo_cache_invalidation_events.id;

CREATE TABLE geo_event_log (
    id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    cache_invalidation_event_id bigint,
    geo_event_id bigint
);

CREATE SEQUENCE geo_event_log_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE geo_event_log_id_seq OWNED BY geo_event_log.id;

CREATE TABLE geo_events (
    id bigint NOT NULL,
    replicable_name character varying(255) NOT NULL,
    event_name character varying(255) NOT NULL,
    payload jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE geo_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE geo_events_id_seq OWNED BY geo_events.id;

CREATE TABLE geo_node_namespace_links (
    id bigint NOT NULL,
    geo_node_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE geo_node_namespace_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE geo_node_namespace_links_id_seq OWNED BY geo_node_namespace_links.id;

CREATE TABLE geo_node_statuses (
    id bigint NOT NULL,
    geo_node_id bigint NOT NULL,
    db_replication_lag_seconds integer,
    last_event_id bigint,
    last_event_date timestamp without time zone,
    cursor_last_event_id bigint,
    cursor_last_event_date timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    last_successful_status_check_at timestamp without time zone,
    status_message character varying,
    replication_slots_count integer,
    replication_slots_used_count integer,
    replication_slots_max_retained_wal_bytes bigint,
    version character varying,
    revision character varying,
    storage_configuration_digest bytea,
    projects_count integer,
    status jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE geo_node_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE geo_node_statuses_id_seq OWNED BY geo_node_statuses.id;

CREATE TABLE geo_nodes (
    id bigint NOT NULL,
    "primary" boolean DEFAULT false NOT NULL,
    oauth_application_id bigint,
    enabled boolean DEFAULT true NOT NULL,
    access_key character varying,
    encrypted_secret_access_key character varying,
    encrypted_secret_access_key_iv character varying,
    clone_url_prefix character varying,
    files_max_capacity integer DEFAULT 10 NOT NULL,
    repos_max_capacity integer DEFAULT 10 NOT NULL,
    url character varying NOT NULL,
    selective_sync_type character varying,
    selective_sync_shards text,
    verification_max_capacity integer DEFAULT 10 NOT NULL,
    minimum_reverification_interval integer DEFAULT 90 NOT NULL,
    internal_url character varying,
    name character varying NOT NULL,
    container_repositories_max_capacity integer DEFAULT 2 NOT NULL,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    sync_object_storage boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE geo_nodes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE geo_nodes_id_seq OWNED BY geo_nodes.id;

CREATE TABLE ghost_user_migrations (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    initiator_user_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    hard_delete boolean DEFAULT false NOT NULL,
    consume_after timestamp with time zone DEFAULT now() NOT NULL
);

CREATE SEQUENCE ghost_user_migrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ghost_user_migrations_id_seq OWNED BY ghost_user_migrations.id;

CREATE TABLE gitlab_subscription_histories (
    id bigint NOT NULL,
    gitlab_subscription_created_at timestamp with time zone,
    gitlab_subscription_updated_at timestamp with time zone,
    start_date date,
    end_date date,
    trial_ends_on date,
    namespace_id bigint,
    hosted_plan_id bigint,
    max_seats_used integer,
    seats integer,
    trial boolean,
    change_type smallint,
    gitlab_subscription_id bigint NOT NULL,
    created_at timestamp with time zone,
    trial_starts_on date,
    auto_renew boolean,
    trial_extension_type smallint,
    seats_in_use integer,
    CONSTRAINT check_6d5f27a106 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE gitlab_subscription_histories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE gitlab_subscription_histories_id_seq OWNED BY gitlab_subscription_histories.id;

CREATE TABLE gitlab_subscriptions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    start_date date,
    end_date date,
    trial_ends_on date,
    namespace_id bigint,
    hosted_plan_id bigint,
    max_seats_used integer DEFAULT 0,
    seats integer DEFAULT 0,
    trial boolean DEFAULT false,
    trial_starts_on date,
    auto_renew boolean,
    seats_in_use integer DEFAULT 0 NOT NULL,
    seats_owed integer DEFAULT 0 NOT NULL,
    trial_extension_type smallint,
    max_seats_used_changed_at timestamp with time zone,
    last_seat_refresh_at timestamp with time zone,
    CONSTRAINT check_77fea3f0e7 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE gitlab_subscriptions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE gitlab_subscriptions_id_seq OWNED BY gitlab_subscriptions.id;

CREATE TABLE gpg_key_subkeys (
    id bigint NOT NULL,
    gpg_key_id bigint NOT NULL,
    keyid bytea,
    fingerprint bytea
);

CREATE SEQUENCE gpg_key_subkeys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE gpg_key_subkeys_id_seq OWNED BY gpg_key_subkeys.id;

CREATE TABLE gpg_keys (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint,
    primary_keyid bytea,
    fingerprint bytea,
    key text,
    externally_verified boolean DEFAULT false NOT NULL,
    externally_verified_at timestamp with time zone
);

CREATE SEQUENCE gpg_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE gpg_keys_id_seq OWNED BY gpg_keys.id;

CREATE TABLE gpg_signatures (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    gpg_key_id bigint,
    commit_sha bytea,
    gpg_key_primary_keyid bytea,
    gpg_key_user_name text,
    gpg_key_user_email text,
    verification_status smallint DEFAULT 0 NOT NULL,
    gpg_key_subkey_id bigint,
    author_email text,
    CONSTRAINT check_d113461ed1 CHECK ((char_length(author_email) <= 255))
);

CREATE SEQUENCE gpg_signatures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE gpg_signatures_id_seq OWNED BY gpg_signatures.id;

CREATE TABLE grafana_integrations (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    encrypted_token character varying(255) NOT NULL,
    encrypted_token_iv character varying(255) NOT NULL,
    grafana_url character varying(1024) NOT NULL,
    enabled boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE grafana_integrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE grafana_integrations_id_seq OWNED BY grafana_integrations.id;

CREATE TABLE group_crm_settings (
    group_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    enabled boolean DEFAULT true NOT NULL,
    source_group_id bigint
);

CREATE SEQUENCE group_crm_settings_group_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_crm_settings_group_id_seq OWNED BY group_crm_settings.group_id;

CREATE TABLE group_custom_attributes (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    key character varying NOT NULL,
    value character varying NOT NULL
);

CREATE SEQUENCE group_custom_attributes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_custom_attributes_id_seq OWNED BY group_custom_attributes.id;

CREATE TABLE group_deletion_schedules (
    group_id bigint NOT NULL,
    user_id bigint NOT NULL,
    marked_for_deletion_on date NOT NULL
);

CREATE TABLE group_deploy_keys (
    id bigint NOT NULL,
    user_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    last_used_at timestamp with time zone,
    expires_at timestamp with time zone,
    key text NOT NULL,
    title text,
    fingerprint text,
    fingerprint_sha256 bytea,
    CONSTRAINT check_cc0365908d CHECK ((char_length(title) <= 255)),
    CONSTRAINT check_e4526dcf91 CHECK ((char_length(fingerprint) <= 255)),
    CONSTRAINT check_f58fa0a0f7 CHECK ((char_length(key) <= 4096))
);

CREATE TABLE group_deploy_keys_groups (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    group_deploy_key_id bigint NOT NULL,
    can_push boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE group_deploy_keys_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_deploy_keys_groups_id_seq OWNED BY group_deploy_keys_groups.id;

CREATE SEQUENCE group_deploy_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_deploy_keys_id_seq OWNED BY group_deploy_keys.id;

CREATE TABLE group_deploy_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    deploy_token_id bigint NOT NULL
);

CREATE SEQUENCE group_deploy_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_deploy_tokens_id_seq OWNED BY group_deploy_tokens.id;

CREATE TABLE group_features (
    group_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    wiki_access_level smallint DEFAULT 20 NOT NULL
);

CREATE TABLE group_group_links (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    shared_group_id bigint NOT NULL,
    shared_with_group_id bigint NOT NULL,
    expires_at date,
    group_access smallint DEFAULT 30 NOT NULL,
    member_role_id bigint
);

CREATE SEQUENCE group_group_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_group_links_id_seq OWNED BY group_group_links.id;

CREATE TABLE group_import_states (
    group_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    jid text,
    last_error text,
    user_id bigint,
    CONSTRAINT check_87b58f6b30 CHECK ((char_length(last_error) <= 255)),
    CONSTRAINT check_96558fff96 CHECK ((char_length(jid) <= 100))
);

CREATE SEQUENCE group_import_states_group_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_import_states_group_id_seq OWNED BY group_import_states.group_id;

CREATE TABLE group_merge_request_approval_settings (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    allow_author_approval boolean DEFAULT false NOT NULL,
    allow_committer_approval boolean DEFAULT false NOT NULL,
    allow_overrides_to_approver_list_per_merge_request boolean DEFAULT false NOT NULL,
    retain_approvals_on_push boolean DEFAULT false NOT NULL,
    require_password_to_approve boolean DEFAULT false NOT NULL,
    require_saml_auth_to_approve boolean DEFAULT false NOT NULL,
    require_reauthentication_to_approve boolean DEFAULT false NOT NULL
);

CREATE TABLE group_push_rules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    max_file_size integer DEFAULT 0 NOT NULL,
    member_check boolean DEFAULT false NOT NULL,
    prevent_secrets boolean DEFAULT false NOT NULL,
    commit_committer_name_check boolean DEFAULT false NOT NULL,
    deny_delete_tag boolean,
    reject_unsigned_commits boolean,
    commit_committer_check boolean,
    reject_non_dco_commits boolean,
    commit_message_regex text,
    branch_name_regex text,
    commit_message_negative_regex text,
    author_email_regex text,
    file_name_regex text,
    CONSTRAINT check_0bba2c16da CHECK ((char_length(commit_message_negative_regex) <= 2047)),
    CONSTRAINT check_41c1a11ab8 CHECK ((char_length(file_name_regex) <= 511)),
    CONSTRAINT check_6f0da85c6c CHECK ((char_length(commit_message_regex) <= 511)),
    CONSTRAINT check_710cf4213a CHECK ((char_length(author_email_regex) <= 511)),
    CONSTRAINT check_b02376d0ad CHECK ((char_length(branch_name_regex) <= 511))
);

CREATE SEQUENCE group_push_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_push_rules_id_seq OWNED BY group_push_rules.id;

CREATE TABLE group_repository_storage_moves (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    state smallint DEFAULT 1 NOT NULL,
    source_storage_name text NOT NULL,
    destination_storage_name text NOT NULL,
    error_message text,
    CONSTRAINT check_266d0cf596 CHECK ((char_length(error_message) <= 256)),
    CONSTRAINT group_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)),
    CONSTRAINT group_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255))
);

CREATE SEQUENCE group_repository_storage_moves_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_repository_storage_moves_id_seq OWNED BY group_repository_storage_moves.id;

CREATE TABLE group_saved_replies (
    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,
    name text NOT NULL,
    content text NOT NULL,
    CONSTRAINT check_13510378d3 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_4a96378d43 CHECK ((char_length(content) <= 10000))
);

CREATE SEQUENCE group_saved_replies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_saved_replies_id_seq OWNED BY group_saved_replies.id;

CREATE TABLE group_scim_auth_access_tokens (
    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,
    temp_source_id bigint,
    token_encrypted bytea NOT NULL
);

COMMENT ON COLUMN group_scim_auth_access_tokens.temp_source_id IS 'Temporary column to store scim_tokens id';

CREATE SEQUENCE group_scim_auth_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_scim_auth_access_tokens_id_seq OWNED BY group_scim_auth_access_tokens.id;

CREATE TABLE group_scim_identities (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    temp_source_id bigint,
    active boolean DEFAULT false,
    extern_uid text NOT NULL,
    CONSTRAINT check_53de3ba272 CHECK ((char_length(extern_uid) <= 255))
);

COMMENT ON COLUMN group_scim_identities.temp_source_id IS 'Temporary column to store scim_idenity id';

CREATE SEQUENCE group_scim_identities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_scim_identities_id_seq OWNED BY group_scim_identities.id;

CREATE TABLE group_security_exclusions (
    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,
    scanner smallint NOT NULL,
    type smallint NOT NULL,
    active boolean DEFAULT true NOT NULL,
    description text,
    value text NOT NULL,
    CONSTRAINT check_12e9b59302 CHECK ((char_length(description) <= 255)),
    CONSTRAINT check_45d9a8e422 CHECK ((char_length(value) <= 255))
);

CREATE SEQUENCE group_security_exclusions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_security_exclusions_id_seq OWNED BY group_security_exclusions.id;

CREATE TABLE group_ssh_certificates (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    fingerprint bytea NOT NULL,
    title text NOT NULL,
    key text NOT NULL,
    CONSTRAINT check_480296705f CHECK ((char_length(title) <= 256)),
    CONSTRAINT check_6c1d920167 CHECK ((char_length(key) <= 524288))
);

CREATE SEQUENCE group_ssh_certificates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_ssh_certificates_id_seq OWNED BY group_ssh_certificates.id;

CREATE TABLE group_type_ci_runner_machines (
    id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    contacted_at timestamp with time zone,
    creation_state smallint DEFAULT 0 NOT NULL,
    executor_type smallint,
    runner_type smallint NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    system_xid text NOT NULL,
    platform text,
    architecture text,
    revision text,
    ip_address text,
    version text,
    runtime_features jsonb DEFAULT '{}'::jsonb NOT NULL,
    organization_id bigint,
    CONSTRAINT check_3d8736b3af CHECK ((char_length(system_xid) <= 64)),
    CONSTRAINT check_5bad2a6944 CHECK ((char_length(revision) <= 255)),
    CONSTRAINT check_7dc4eee8a5 CHECK ((char_length(version) <= 2048)),
    CONSTRAINT check_b1e456641b CHECK ((char_length(ip_address) <= 1024)),
    CONSTRAINT check_c788f4b18a CHECK ((char_length(platform) <= 255)),
    CONSTRAINT check_f3d25ab844 CHECK ((char_length(architecture) <= 255)),
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NOT NULL))
);

CREATE TABLE group_type_ci_runners (
    id bigint NOT NULL,
    creator_id bigint,
    sharding_key_id bigint,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    contacted_at timestamp with time zone,
    token_expires_at timestamp with time zone,
    public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    access_level integer DEFAULT 0 NOT NULL,
    maximum_timeout integer,
    runner_type smallint NOT NULL,
    registration_type smallint DEFAULT 0 NOT NULL,
    creation_state smallint DEFAULT 0 NOT NULL,
    active boolean DEFAULT true NOT NULL,
    run_untagged boolean DEFAULT true NOT NULL,
    locked boolean DEFAULT false NOT NULL,
    name text,
    token_encrypted text,
    token text,
    description text,
    maintainer_note text,
    allowed_plans text[] DEFAULT '{}'::text[] NOT NULL,
    allowed_plan_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    organization_id bigint,
    CONSTRAINT check_030ad0773d CHECK ((char_length(token_encrypted) <= 512)),
    CONSTRAINT check_1f8618ab23 CHECK ((char_length(name) <= 256)),
    CONSTRAINT check_24b281f5bf CHECK ((char_length(maintainer_note) <= 1024)),
    CONSTRAINT check_5db8ae9d30 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_af25130d5a CHECK ((char_length(token) <= 128)),
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NOT NULL))
);

CREATE TABLE group_wiki_repositories (
    shard_id bigint NOT NULL,
    group_id bigint NOT NULL,
    disk_path text NOT NULL,
    CONSTRAINT check_07f1c81806 CHECK ((char_length(disk_path) <= 80))
);

CREATE TABLE group_wiki_repository_states (
    id bigint NOT NULL,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    group_wiki_repository_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    group_id bigint,
    CONSTRAINT check_14d288436d CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE group_wiki_repository_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE group_wiki_repository_states_id_seq OWNED BY group_wiki_repository_states.id;

CREATE TABLE routes (
    id bigint NOT NULL,
    source_id bigint NOT NULL,
    source_type character varying NOT NULL,
    path character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    name character varying,
    namespace_id bigint,
    CONSTRAINT check_af84c6c93f CHECK ((namespace_id IS NOT NULL))
);

CREATE TABLE shards (
    id bigint NOT NULL,
    name character varying NOT NULL
);

CREATE VIEW group_wikis_routes_view AS
 SELECT gr.group_id,
    sh.name AS repository_storage,
    gr.disk_path,
    r.path AS path_with_namespace,
    r.name AS name_with_namespace
   FROM ((group_wiki_repositories gr
     JOIN routes r ON (((r.source_id = gr.group_id) AND ((r.source_type)::text = 'Namespace'::text))))
     JOIN shards sh ON ((gr.shard_id = sh.id)));

CREATE SEQUENCE groups_visits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE groups_visits_id_seq OWNED BY groups_visits.id;

CREATE TABLE historical_data (
    id bigint NOT NULL,
    date date,
    active_user_count integer,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    recorded_at timestamp with time zone,
    CONSTRAINT check_640e8cf66c CHECK ((recorded_at IS NOT NULL))
);

CREATE SEQUENCE historical_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE historical_data_id_seq OWNED BY historical_data.id;

CREATE TABLE identities (
    id bigint NOT NULL,
    extern_uid character varying,
    provider character varying,
    user_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    secondary_extern_uid character varying,
    saml_provider_id bigint,
    trusted_extern_uid boolean DEFAULT true
);

CREATE SEQUENCE identities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE identities_id_seq OWNED BY identities.id;

CREATE TABLE import_export_upload_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE import_export_uploads (
    id bigint NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    import_file text,
    export_file text,
    group_id bigint,
    remote_import_url text,
    user_id bigint,
    CONSTRAINT check_58f0d37481 CHECK ((char_length(remote_import_url) <= 2048)),
    CONSTRAINT check_e54579866d CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE import_export_uploads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE import_export_uploads_id_seq OWNED BY import_export_uploads.id;

CREATE TABLE import_failures (
    id bigint NOT NULL,
    relation_index integer,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    relation_key character varying(64),
    exception_class character varying(128),
    correlation_id_value character varying(128),
    exception_message character varying(255),
    retry_count integer,
    group_id bigint,
    source character varying(128),
    external_identifiers jsonb DEFAULT '{}'::jsonb NOT NULL,
    user_id bigint,
    organization_id bigint,
    CONSTRAINT check_df3c29175a CHECK ((num_nonnulls(group_id, organization_id, project_id) = 1))
);

CREATE SEQUENCE import_failures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE import_failures_id_seq OWNED BY import_failures.id;

CREATE TABLE import_placeholder_memberships (
    id bigint NOT NULL,
    source_user_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    group_id bigint,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    expires_at date,
    access_level smallint NOT NULL
);

CREATE SEQUENCE import_placeholder_memberships_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE import_placeholder_memberships_id_seq OWNED BY import_placeholder_memberships.id;

CREATE TABLE import_placeholder_user_details (
    id bigint NOT NULL,
    placeholder_user_id bigint NOT NULL,
    namespace_id bigint,
    deletion_attempts integer DEFAULT 0 NOT NULL,
    organization_id bigint NOT NULL,
    last_deletion_attempt_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE import_placeholder_user_details_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE import_placeholder_user_details_id_seq OWNED BY import_placeholder_user_details.id;

CREATE TABLE import_source_user_placeholder_references (
    id bigint NOT NULL,
    source_user_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    numeric_key bigint,
    created_at timestamp with time zone NOT NULL,
    model text NOT NULL,
    user_reference_column text NOT NULL,
    composite_key jsonb,
    alias_version smallint NOT NULL,
    CONSTRAINT check_782140eb9d CHECK ((char_length(user_reference_column) <= 50)),
    CONSTRAINT check_d17bd9dd4d CHECK ((char_length(model) <= 150))
);

CREATE SEQUENCE import_source_user_placeholder_references_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE import_source_user_placeholder_references_id_seq OWNED BY import_source_user_placeholder_references.id;

CREATE TABLE import_source_users (
    id bigint NOT NULL,
    placeholder_user_id bigint,
    reassign_to_user_id bigint,
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    source_username text,
    source_name text,
    source_user_identifier text NOT NULL,
    source_hostname text NOT NULL,
    import_type text NOT NULL,
    reassigned_by_user_id bigint,
    reassignment_error text,
    reassignment_token text,
    CONSTRAINT check_05708218cd CHECK ((char_length(reassignment_error) <= 255)),
    CONSTRAINT check_0d7295a307 CHECK ((char_length(import_type) <= 255)),
    CONSTRAINT check_199c28ec54 CHECK ((char_length(source_username) <= 255)),
    CONSTRAINT check_562655155f CHECK ((char_length(source_name) <= 255)),
    CONSTRAINT check_cc9d4093b5 CHECK ((char_length(source_user_identifier) <= 255)),
    CONSTRAINT check_cd2edb9334 CHECK ((char_length(reassignment_token) <= 32)),
    CONSTRAINT check_e2039840c5 CHECK ((char_length(source_hostname) <= 255))
);

CREATE SEQUENCE import_source_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE import_source_users_id_seq OWNED BY import_source_users.id;

CREATE TABLE incident_management_escalation_policies (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    description text,
    CONSTRAINT check_510b2a5258 CHECK ((char_length(description) <= 160)),
    CONSTRAINT check_9a26365850 CHECK ((char_length(name) <= 72))
);

CREATE SEQUENCE incident_management_escalation_policies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_escalation_policies_id_seq OWNED BY incident_management_escalation_policies.id;

CREATE TABLE incident_management_escalation_rules (
    id bigint NOT NULL,
    policy_id bigint NOT NULL,
    oncall_schedule_id bigint,
    status smallint NOT NULL,
    elapsed_time_seconds integer NOT NULL,
    is_removed boolean DEFAULT false NOT NULL,
    user_id bigint,
    project_id bigint,
    CONSTRAINT check_a54b79b2fa CHECK ((project_id IS NOT NULL)),
    CONSTRAINT escalation_rules_one_of_oncall_schedule_or_user CHECK ((num_nonnulls(oncall_schedule_id, user_id) = 1))
);

CREATE SEQUENCE incident_management_escalation_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_escalation_rules_id_seq OWNED BY incident_management_escalation_rules.id;

CREATE TABLE incident_management_issuable_escalation_statuses (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_id bigint NOT NULL,
    policy_id bigint,
    escalations_started_at timestamp with time zone,
    resolved_at timestamp with time zone,
    status smallint DEFAULT 0 NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_ad48232311 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE incident_management_issuable_escalation_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_issuable_escalation_statuses_id_seq OWNED BY incident_management_issuable_escalation_statuses.id;

CREATE TABLE incident_management_oncall_participants (
    id bigint NOT NULL,
    oncall_rotation_id bigint NOT NULL,
    user_id bigint NOT NULL,
    color_palette smallint NOT NULL,
    color_weight smallint NOT NULL,
    is_removed boolean DEFAULT false NOT NULL,
    project_id bigint,
    CONSTRAINT check_d53b689825 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE incident_management_oncall_participants_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_oncall_participants_id_seq OWNED BY incident_management_oncall_participants.id;

CREATE TABLE incident_management_oncall_rotations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    oncall_schedule_id bigint NOT NULL,
    length integer NOT NULL,
    length_unit smallint NOT NULL,
    starts_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    ends_at timestamp with time zone,
    active_period_start time without time zone,
    active_period_end time without time zone,
    project_id bigint,
    CONSTRAINT check_28c39f8a0c CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_5209fb5d02 CHECK ((char_length(name) <= 200))
);

CREATE SEQUENCE incident_management_oncall_rotations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_oncall_rotations_id_seq OWNED BY incident_management_oncall_rotations.id;

CREATE TABLE incident_management_oncall_schedules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    iid integer NOT NULL,
    name text NOT NULL,
    description text,
    timezone text,
    CONSTRAINT check_7ed1fd5aa7 CHECK ((char_length(description) <= 1000)),
    CONSTRAINT check_cc77cbb103 CHECK ((char_length(timezone) <= 100)),
    CONSTRAINT check_e6ef43a664 CHECK ((char_length(name) <= 200))
);

CREATE SEQUENCE incident_management_oncall_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_oncall_schedules_id_seq OWNED BY incident_management_oncall_schedules.id;

CREATE TABLE incident_management_oncall_shifts (
    id bigint NOT NULL,
    rotation_id bigint NOT NULL,
    participant_id bigint NOT NULL,
    starts_at timestamp with time zone NOT NULL,
    ends_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_a37955f387 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE incident_management_oncall_shifts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_oncall_shifts_id_seq OWNED BY incident_management_oncall_shifts.id;

CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_pending_alert_escalations_id_seq OWNED BY incident_management_pending_alert_escalations.id;

CREATE SEQUENCE incident_management_pending_issue_escalations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_pending_issue_escalations_id_seq OWNED BY incident_management_pending_issue_escalations.id;

CREATE TABLE incident_management_timeline_event_tag_links (
    id bigint NOT NULL,
    timeline_event_id bigint NOT NULL,
    timeline_event_tag_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_e693cb4516 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE incident_management_timeline_event_tag_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_timeline_event_tag_links_id_seq OWNED BY incident_management_timeline_event_tag_links.id;

CREATE TABLE incident_management_timeline_event_tags (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    CONSTRAINT check_8717184e2c CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE incident_management_timeline_event_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_timeline_event_tags_id_seq OWNED BY incident_management_timeline_event_tags.id;

CREATE TABLE incident_management_timeline_events (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    occurred_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    author_id bigint,
    issue_id bigint NOT NULL,
    updated_by_user_id bigint,
    promoted_from_note_id bigint,
    cached_markdown_version integer,
    editable boolean DEFAULT false NOT NULL,
    note text NOT NULL,
    note_html text NOT NULL,
    action text NOT NULL,
    CONSTRAINT check_18fd072206 CHECK ((char_length(action) <= 128)),
    CONSTRAINT check_3875ed0aac CHECK ((char_length(note) <= 10000)),
    CONSTRAINT check_94a235d6a4 CHECK ((char_length(note_html) <= 10000))
);

CREATE SEQUENCE incident_management_timeline_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE incident_management_timeline_events_id_seq OWNED BY incident_management_timeline_events.id;

CREATE TABLE index_statuses (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    indexed_at timestamp without time zone,
    note text,
    last_commit character varying,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    last_wiki_commit bytea,
    wiki_indexed_at timestamp with time zone
);

CREATE SEQUENCE index_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE index_statuses_id_seq OWNED BY index_statuses.id;

CREATE TABLE insights (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE SEQUENCE insights_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE insights_id_seq OWNED BY insights.id;

CREATE TABLE instance_audit_events_streaming_headers (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    instance_external_audit_event_destination_id bigint NOT NULL,
    key text NOT NULL,
    value text NOT NULL,
    active boolean DEFAULT true NOT NULL,
    CONSTRAINT check_d52adbbabb CHECK ((char_length(value) <= 2000)),
    CONSTRAINT check_e92010d531 CHECK ((char_length(key) <= 255))
);

CREATE SEQUENCE instance_audit_events_streaming_headers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE instance_audit_events_streaming_headers_id_seq OWNED BY instance_audit_events_streaming_headers.id;

CREATE TABLE instance_integrations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    comment_detail integer,
    active boolean DEFAULT false NOT NULL,
    push_events boolean DEFAULT true,
    issues_events boolean DEFAULT true,
    merge_requests_events boolean DEFAULT true,
    tag_push_events boolean DEFAULT true,
    note_events boolean DEFAULT true NOT NULL,
    wiki_page_events boolean DEFAULT true,
    pipeline_events boolean DEFAULT false NOT NULL,
    confidential_issues_events boolean DEFAULT true NOT NULL,
    commit_events boolean DEFAULT true NOT NULL,
    job_events boolean DEFAULT false NOT NULL,
    confidential_note_events boolean DEFAULT true,
    deployment_events boolean DEFAULT false NOT NULL,
    comment_on_event_enabled boolean DEFAULT true NOT NULL,
    alert_events boolean,
    vulnerability_events boolean DEFAULT false NOT NULL,
    archive_trace_events boolean DEFAULT false NOT NULL,
    incident_events boolean DEFAULT false NOT NULL,
    group_mention_events boolean DEFAULT false NOT NULL,
    group_confidential_mention_events boolean DEFAULT false NOT NULL,
    category text DEFAULT 'common'::text,
    encrypted_properties bytea,
    encrypted_properties_iv bytea,
    project_id bigint,
    group_id bigint,
    inherit_from_id bigint,
    instance boolean DEFAULT true,
    type_new text,
    CONSTRAINT check_2f305455fe CHECK ((char_length(type_new) <= 255)),
    CONSTRAINT check_611836812c CHECK ((char_length(category) <= 255)),
    CONSTRAINT group_id_null_constraint CHECK ((group_id IS NULL)),
    CONSTRAINT inherit_from_id_null_constraint CHECK ((inherit_from_id IS NULL)),
    CONSTRAINT instance_is_true_constraint CHECK ((instance = true)),
    CONSTRAINT project_id_null_constraint CHECK ((project_id IS NULL))
);

CREATE SEQUENCE instance_integrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE instance_integrations_id_seq OWNED BY instance_integrations.id;

CREATE TABLE instance_type_ci_runner_machines (
    id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    contacted_at timestamp with time zone,
    creation_state smallint DEFAULT 0 NOT NULL,
    executor_type smallint,
    runner_type smallint NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    system_xid text NOT NULL,
    platform text,
    architecture text,
    revision text,
    ip_address text,
    version text,
    runtime_features jsonb DEFAULT '{}'::jsonb NOT NULL,
    organization_id bigint,
    CONSTRAINT check_3d8736b3af CHECK ((char_length(system_xid) <= 64)),
    CONSTRAINT check_5bad2a6944 CHECK ((char_length(revision) <= 255)),
    CONSTRAINT check_7dc4eee8a5 CHECK ((char_length(version) <= 2048)),
    CONSTRAINT check_b1e456641b CHECK ((char_length(ip_address) <= 1024)),
    CONSTRAINT check_c788f4b18a CHECK ((char_length(platform) <= 255)),
    CONSTRAINT check_f3d25ab844 CHECK ((char_length(architecture) <= 255)),
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NULL))
);

CREATE TABLE instance_type_ci_runners (
    id bigint NOT NULL,
    creator_id bigint,
    sharding_key_id bigint,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    contacted_at timestamp with time zone,
    token_expires_at timestamp with time zone,
    public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    access_level integer DEFAULT 0 NOT NULL,
    maximum_timeout integer,
    runner_type smallint NOT NULL,
    registration_type smallint DEFAULT 0 NOT NULL,
    creation_state smallint DEFAULT 0 NOT NULL,
    active boolean DEFAULT true NOT NULL,
    run_untagged boolean DEFAULT true NOT NULL,
    locked boolean DEFAULT false NOT NULL,
    name text,
    token_encrypted text,
    token text,
    description text,
    maintainer_note text,
    allowed_plans text[] DEFAULT '{}'::text[] NOT NULL,
    allowed_plan_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    organization_id bigint,
    CONSTRAINT check_030ad0773d CHECK ((char_length(token_encrypted) <= 512)),
    CONSTRAINT check_1f8618ab23 CHECK ((char_length(name) <= 256)),
    CONSTRAINT check_24b281f5bf CHECK ((char_length(maintainer_note) <= 1024)),
    CONSTRAINT check_5db8ae9d30 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_af25130d5a CHECK ((char_length(token) <= 128)),
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NULL))
);

CREATE TABLE integrations (
    id bigint NOT NULL,
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    active boolean DEFAULT false NOT NULL,
    push_events boolean DEFAULT true,
    issues_events boolean DEFAULT true,
    merge_requests_events boolean DEFAULT true,
    tag_push_events boolean DEFAULT true,
    note_events boolean DEFAULT true NOT NULL,
    category character varying DEFAULT 'common'::character varying NOT NULL,
    wiki_page_events boolean DEFAULT true,
    pipeline_events boolean DEFAULT false NOT NULL,
    confidential_issues_events boolean DEFAULT true NOT NULL,
    commit_events boolean DEFAULT true NOT NULL,
    job_events boolean DEFAULT false NOT NULL,
    confidential_note_events boolean DEFAULT true,
    deployment_events boolean DEFAULT false NOT NULL,
    comment_on_event_enabled boolean DEFAULT true NOT NULL,
    instance boolean DEFAULT false NOT NULL,
    comment_detail smallint,
    inherit_from_id bigint,
    alert_events boolean,
    group_id bigint,
    type_new text,
    vulnerability_events boolean DEFAULT false NOT NULL,
    archive_trace_events boolean DEFAULT false NOT NULL,
    encrypted_properties bytea,
    encrypted_properties_iv bytea,
    incident_events boolean DEFAULT false NOT NULL,
    group_mention_events boolean DEFAULT false NOT NULL,
    group_confidential_mention_events boolean DEFAULT false NOT NULL,
    organization_id bigint,
    CONSTRAINT check_a948a0aa7e CHECK ((char_length(type_new) <= 255))
);

CREATE SEQUENCE integrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE integrations_id_seq OWNED BY integrations.id;

CREATE TABLE internal_ids (
    id bigint NOT NULL,
    project_id bigint,
    usage integer NOT NULL,
    last_value integer NOT NULL,
    namespace_id bigint
);

CREATE SEQUENCE internal_ids_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE internal_ids_id_seq OWNED BY internal_ids.id;

CREATE TABLE ip_restrictions (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    range character varying NOT NULL
);

CREATE SEQUENCE ip_restrictions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ip_restrictions_id_seq OWNED BY ip_restrictions.id;

CREATE TABLE issuable_metric_image_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE issuable_metric_images (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store smallint,
    file text NOT NULL,
    url text,
    url_text text,
    namespace_id bigint,
    CONSTRAINT check_10213e2b5c CHECK ((namespace_id IS NOT NULL)),
    CONSTRAINT check_3bc6d47661 CHECK ((char_length(url_text) <= 128)),
    CONSTRAINT check_5b3011e234 CHECK ((char_length(url) <= 255)),
    CONSTRAINT check_7ed527062f CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE issuable_metric_images_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issuable_metric_images_id_seq OWNED BY issuable_metric_images.id;

CREATE TABLE issuable_resource_links (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    link_text text,
    link text NOT NULL,
    link_type smallint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    is_unique boolean,
    namespace_id bigint,
    CONSTRAINT check_67be6729db CHECK ((char_length(link) <= 2200)),
    CONSTRAINT check_897e487714 CHECK ((namespace_id IS NOT NULL)),
    CONSTRAINT check_b137147e0b CHECK ((char_length(link_text) <= 255))
);

CREATE SEQUENCE issuable_resource_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issuable_resource_links_id_seq OWNED BY issuable_resource_links.id;

CREATE TABLE issuable_severities (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    severity smallint DEFAULT 0 NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_34d8321a84 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issuable_severities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issuable_severities_id_seq OWNED BY issuable_severities.id;

CREATE TABLE issuable_slas (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    due_at timestamp with time zone NOT NULL,
    label_applied boolean DEFAULT false NOT NULL,
    issuable_closed boolean DEFAULT false NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_1ae7689c41 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issuable_slas_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issuable_slas_id_seq OWNED BY issuable_slas.id;

CREATE TABLE issue_assignees (
    user_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    namespace_id bigint
);

CREATE TABLE issue_assignment_events (
    id bigint NOT NULL,
    user_id bigint,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    action smallint DEFAULT 1 NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_b1ee75f25d CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issue_assignment_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_assignment_events_id_seq OWNED BY issue_assignment_events.id;

CREATE TABLE issue_customer_relations_contacts (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    contact_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_9fd68b6ded CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issue_customer_relations_contacts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_customer_relations_contacts_id_seq OWNED BY issue_customer_relations_contacts.id;

CREATE TABLE issue_email_participants (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    email text NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_2c321d408d CHECK ((char_length(email) <= 255)),
    CONSTRAINT check_9d8a1ecc85 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issue_email_participants_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_email_participants_id_seq OWNED BY issue_email_participants.id;

CREATE TABLE issue_emails (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    email_message_id text NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_0c81c7ea61 CHECK ((namespace_id IS NOT NULL)),
    CONSTRAINT check_5abf3e6aea CHECK ((char_length(email_message_id) <= 1000))
);

CREATE SEQUENCE issue_emails_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_emails_id_seq OWNED BY issue_emails.id;

CREATE TABLE issue_links (
    id bigint NOT NULL,
    source_id bigint NOT NULL,
    target_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    link_type smallint DEFAULT 0 NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_c32f659c75 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issue_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_links_id_seq OWNED BY issue_links.id;

CREATE TABLE issue_metrics (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    first_mentioned_in_commit_at timestamp without time zone,
    first_associated_with_milestone_at timestamp without time zone,
    first_added_to_board_at timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_ed784787ee CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issue_metrics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_metrics_id_seq OWNED BY issue_metrics.id;

CREATE TABLE issue_tracker_data (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    encrypted_project_url character varying,
    encrypted_project_url_iv character varying,
    encrypted_issues_url character varying,
    encrypted_issues_url_iv character varying,
    encrypted_new_issue_url character varying,
    encrypted_new_issue_url_iv character varying,
    integration_id bigint,
    instance_integration_id bigint,
    project_id bigint,
    group_id bigint,
    organization_id bigint,
    CONSTRAINT check_d525c6d20b CHECK ((num_nonnulls(instance_integration_id, integration_id) = 1))
);

CREATE SEQUENCE issue_tracker_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_tracker_data_id_seq OWNED BY issue_tracker_data.id;

CREATE TABLE issue_user_mentions (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    note_id bigint,
    namespace_id bigint,
    CONSTRAINT check_34b2c10b9c CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE issue_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issue_user_mentions_id_seq OWNED BY issue_user_mentions.id;

CREATE TABLE issues (
    id bigint NOT NULL,
    title character varying,
    author_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    description text,
    milestone_id bigint,
    iid integer,
    updated_by_id bigint,
    weight integer,
    confidential boolean DEFAULT false NOT NULL,
    due_date date,
    moved_to_id bigint,
    lock_version integer DEFAULT 0,
    title_html text,
    description_html text,
    time_estimate integer DEFAULT 0,
    relative_position integer,
    service_desk_reply_to character varying,
    cached_markdown_version integer,
    last_edited_at timestamp without time zone,
    last_edited_by_id bigint,
    discussion_locked boolean,
    closed_at timestamp with time zone,
    closed_by_id bigint,
    state_id smallint DEFAULT 1 NOT NULL,
    duplicated_to_id bigint,
    promoted_to_epic_id bigint,
    health_status smallint,
    external_key character varying(255),
    sprint_id bigint,
    blocking_issues_count integer DEFAULT 0 NOT NULL,
    upvotes_count integer DEFAULT 0 NOT NULL,
    work_item_type_id bigint,
    namespace_id bigint,
    start_date date,
    imported_from smallint DEFAULT 0 NOT NULL,
    author_id_convert_to_bigint bigint,
    closed_by_id_convert_to_bigint bigint,
    duplicated_to_id_convert_to_bigint bigint,
    id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
    last_edited_by_id_convert_to_bigint bigint,
    milestone_id_convert_to_bigint bigint,
    moved_to_id_convert_to_bigint bigint,
    project_id_convert_to_bigint bigint,
    promoted_to_epic_id_convert_to_bigint bigint,
    updated_by_id_convert_to_bigint bigint,
    CONSTRAINT check_2addf801cd CHECK ((work_item_type_id IS NOT NULL)),
    CONSTRAINT check_c33362cd43 CHECK ((namespace_id IS NOT NULL)),
    CONSTRAINT check_fba63f706d CHECK ((lock_version IS NOT NULL))
);

CREATE SEQUENCE issues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE issues_id_seq OWNED BY issues.id;

CREATE TABLE iterations_cadences (
    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,
    start_date date,
    duration_in_weeks integer,
    iterations_in_advance integer,
    active boolean DEFAULT true NOT NULL,
    automatic boolean DEFAULT true NOT NULL,
    title text NOT NULL,
    roll_over boolean DEFAULT false NOT NULL,
    description text,
    next_run_date date,
    CONSTRAINT check_5c5d2b44bd CHECK ((char_length(description) <= 5000)),
    CONSTRAINT check_fedff82d3b CHECK ((char_length(title) <= 255))
);

CREATE SEQUENCE iterations_cadences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE iterations_cadences_id_seq OWNED BY iterations_cadences.id;

CREATE TABLE jira_connect_installations (
    id bigint NOT NULL,
    client_key character varying,
    encrypted_shared_secret character varying,
    encrypted_shared_secret_iv character varying,
    base_url character varying,
    instance_url text,
    CONSTRAINT check_4c6abed669 CHECK ((char_length(instance_url) <= 255))
);

CREATE SEQUENCE jira_connect_installations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE jira_connect_installations_id_seq OWNED BY jira_connect_installations.id;

CREATE TABLE jira_connect_subscriptions (
    id bigint NOT NULL,
    jira_connect_installation_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
);

CREATE SEQUENCE jira_connect_subscriptions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE jira_connect_subscriptions_id_seq OWNED BY jira_connect_subscriptions.id;

CREATE TABLE jira_imports (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint,
    label_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    finished_at timestamp with time zone,
    jira_project_xid bigint NOT NULL,
    total_issue_count integer DEFAULT 0 NOT NULL,
    imported_issues_count integer DEFAULT 0 NOT NULL,
    failed_to_import_count integer DEFAULT 0 NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    jid character varying(255),
    jira_project_key character varying(255) NOT NULL,
    jira_project_name character varying(255) NOT NULL,
    scheduled_at timestamp with time zone,
    error_message text,
    CONSTRAINT check_9ed451c5b1 CHECK ((char_length(error_message) <= 1000))
);

CREATE SEQUENCE jira_imports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE jira_imports_id_seq OWNED BY jira_imports.id;

CREATE TABLE jira_tracker_data (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    encrypted_url character varying,
    encrypted_url_iv character varying,
    encrypted_api_url character varying,
    encrypted_api_url_iv character varying,
    encrypted_username character varying,
    encrypted_username_iv character varying,
    encrypted_password character varying,
    encrypted_password_iv character varying,
    jira_issue_transition_id character varying,
    project_key text,
    issues_enabled boolean DEFAULT false NOT NULL,
    deployment_type smallint DEFAULT 0 NOT NULL,
    vulnerabilities_issuetype text,
    vulnerabilities_enabled boolean DEFAULT false NOT NULL,
    jira_issue_transition_automatic boolean DEFAULT false NOT NULL,
    integration_id bigint,
    jira_issue_prefix text,
    jira_issue_regex text,
    jira_auth_type smallint DEFAULT 0 NOT NULL,
    project_keys text[] DEFAULT '{}'::text[] NOT NULL,
    customize_jira_issue_enabled boolean DEFAULT false,
    instance_integration_id bigint,
    project_id bigint,
    group_id bigint,
    organization_id bigint,
    CONSTRAINT check_0bf84b76e9 CHECK ((char_length(vulnerabilities_issuetype) <= 255)),
    CONSTRAINT check_160e0f9fe2 CHECK ((num_nonnulls(instance_integration_id, integration_id) = 1)),
    CONSTRAINT check_214cf6a48b CHECK ((char_length(project_key) <= 255)),
    CONSTRAINT check_4cc5bbc801 CHECK ((char_length(jira_issue_prefix) <= 255)),
    CONSTRAINT check_9863a0a5fd CHECK ((char_length(jira_issue_regex) <= 255))
);

CREATE SEQUENCE jira_tracker_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE jira_tracker_data_id_seq OWNED BY jira_tracker_data.id;

CREATE TABLE keys (
    id bigint NOT NULL,
    user_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    key text,
    title character varying,
    type character varying,
    fingerprint character varying,
    public boolean DEFAULT false NOT NULL,
    last_used_at timestamp without time zone,
    fingerprint_sha256 bytea,
    expires_at timestamp with time zone,
    expiry_notification_delivered_at timestamp with time zone,
    before_expiry_notification_delivered_at timestamp with time zone,
    usage_type smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE keys_id_seq OWNED BY keys.id;

CREATE TABLE label_links (
    id bigint NOT NULL,
    label_id bigint,
    target_id bigint,
    target_type character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);

CREATE SEQUENCE label_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE label_links_id_seq OWNED BY label_links.id;

CREATE TABLE label_priorities (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    label_id bigint NOT NULL,
    priority integer NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE label_priorities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE label_priorities_id_seq OWNED BY label_priorities.id;

CREATE TABLE labels (
    id bigint NOT NULL,
    title character varying,
    color character varying,
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    template boolean DEFAULT false,
    description character varying,
    description_html text,
    type character varying,
    group_id bigint,
    cached_markdown_version integer,
    lock_on_merge boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE labels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE labels_id_seq OWNED BY labels.id;

CREATE TABLE ldap_admin_role_links (
    id bigint NOT NULL,
    member_role_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    provider text NOT NULL,
    cn text,
    filter text,
    sync_status smallint DEFAULT 0 NOT NULL,
    sync_started_at timestamp with time zone,
    sync_ended_at timestamp with time zone,
    last_successful_sync_at timestamp with time zone,
    sync_error text,
    CONSTRAINT check_044d783383 CHECK ((char_length(sync_error) <= 255)),
    CONSTRAINT check_7f4c5b8292 CHECK ((char_length(filter) <= 255)),
    CONSTRAINT check_db3fe65cb5 CHECK ((char_length(cn) <= 255)),
    CONSTRAINT check_f2efc15b43 CHECK ((char_length(provider) <= 255))
);

CREATE SEQUENCE ldap_admin_role_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ldap_admin_role_links_id_seq OWNED BY ldap_admin_role_links.id;

CREATE TABLE ldap_group_links (
    id bigint NOT NULL,
    cn character varying,
    group_access integer NOT NULL,
    group_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    provider character varying,
    filter character varying,
    member_role_id bigint
);

CREATE SEQUENCE ldap_group_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ldap_group_links_id_seq OWNED BY ldap_group_links.id;

CREATE TABLE lfs_file_locks (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    path character varying(511)
);

CREATE SEQUENCE lfs_file_locks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE lfs_file_locks_id_seq OWNED BY lfs_file_locks.id;

CREATE TABLE lfs_object_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    lfs_object_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    CONSTRAINT check_efe45a8ab3 CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE lfs_object_states_lfs_object_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE lfs_object_states_lfs_object_id_seq OWNED BY lfs_object_states.lfs_object_id;

CREATE TABLE lfs_objects (
    id bigint NOT NULL,
    oid character varying NOT NULL,
    size bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    file character varying,
    file_store integer DEFAULT 1,
    CONSTRAINT check_eecfc5717d CHECK ((file_store IS NOT NULL))
);

CREATE SEQUENCE lfs_objects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE lfs_objects_id_seq OWNED BY lfs_objects.id;

CREATE TABLE lfs_objects_projects (
    id bigint NOT NULL,
    lfs_object_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    repository_type smallint,
    oid text,
    CONSTRAINT check_76ef4585ad CHECK ((char_length(oid) <= 255))
);

CREATE SEQUENCE lfs_objects_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE lfs_objects_projects_id_seq OWNED BY lfs_objects_projects.id;

CREATE TABLE licenses (
    id bigint NOT NULL,
    data text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    cloud boolean DEFAULT false,
    last_synced_at timestamp with time zone
);

CREATE SEQUENCE licenses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE licenses_id_seq OWNED BY licenses.id;

CREATE TABLE list_user_preferences (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    list_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    collapsed boolean
);

CREATE SEQUENCE list_user_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE list_user_preferences_id_seq OWNED BY list_user_preferences.id;

CREATE TABLE lists (
    id bigint NOT NULL,
    board_id bigint NOT NULL,
    label_id bigint,
    list_type integer DEFAULT 1 NOT NULL,
    "position" integer,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    user_id bigint,
    milestone_id bigint,
    max_issue_count integer DEFAULT 0 NOT NULL,
    max_issue_weight integer DEFAULT 0 NOT NULL,
    limit_metric character varying(20),
    iteration_id bigint,
    group_id bigint,
    project_id bigint,
    custom_status_id bigint,
    system_defined_status_identifier smallint,
    CONSTRAINT check_5ed14cb08c CHECK (((list_type <> 6) OR (num_nonnulls(system_defined_status_identifier, custom_status_id) = 1))),
    CONSTRAINT check_6dadb82d36 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE lists_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE lists_id_seq OWNED BY lists.id;

CREATE SEQUENCE loose_foreign_keys_deleted_records_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE loose_foreign_keys_deleted_records_id_seq OWNED BY loose_foreign_keys_deleted_records.id;

CREATE TABLE member_approvals (
    id bigint NOT NULL,
    reviewed_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    member_id bigint,
    member_namespace_id bigint NOT NULL,
    requested_by_id bigint,
    reviewed_by_id bigint,
    new_access_level integer NOT NULL,
    old_access_level integer,
    status smallint DEFAULT 0 NOT NULL,
    user_id bigint NOT NULL,
    member_role_id bigint,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE member_approvals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE member_approvals_id_seq OWNED BY member_approvals.id;

CREATE TABLE member_roles (
    id bigint NOT NULL,
    namespace_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    base_access_level integer,
    name text DEFAULT 'Custom'::text NOT NULL,
    description text,
    occupies_seat boolean DEFAULT false NOT NULL,
    permissions jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT check_4364846f58 CHECK ((char_length(description) <= 255)),
    CONSTRAINT check_9907916995 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE member_roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE member_roles_id_seq OWNED BY member_roles.id;

CREATE TABLE members (
    id bigint NOT NULL,
    access_level integer NOT NULL,
    source_id bigint NOT NULL,
    source_type character varying NOT NULL,
    user_id bigint,
    notification_level integer NOT NULL,
    type character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    created_by_id bigint,
    invite_email character varying,
    invite_token character varying,
    invite_accepted_at timestamp without time zone,
    requested_at timestamp without time zone,
    expires_at date,
    ldap boolean DEFAULT false NOT NULL,
    override boolean DEFAULT false NOT NULL,
    state smallint DEFAULT 0,
    invite_email_success boolean DEFAULT true NOT NULL,
    member_namespace_id bigint,
    member_role_id bigint,
    expiry_notified_at timestamp with time zone,
    request_accepted_at timestamp with time zone,
    CONSTRAINT check_508774aac0 CHECK ((member_namespace_id IS NOT NULL))
);

CREATE TABLE members_deletion_schedules (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    user_id bigint NOT NULL,
    scheduled_by_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE members_deletion_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE members_deletion_schedules_id_seq OWNED BY members_deletion_schedules.id;

CREATE SEQUENCE members_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE members_id_seq OWNED BY members.id;

CREATE TABLE merge_request_approval_metrics (
    merge_request_id bigint NOT NULL,
    last_approved_at timestamp with time zone NOT NULL,
    target_project_id bigint NOT NULL
);

CREATE TABLE merge_request_assignees (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    created_at timestamp with time zone,
    project_id bigint,
    CONSTRAINT check_1442f79624 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_assignees_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_assignees_id_seq OWNED BY merge_request_assignees.id;

CREATE TABLE merge_request_assignment_events (
    id bigint NOT NULL,
    user_id bigint,
    merge_request_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    action smallint DEFAULT 1 NOT NULL,
    project_id bigint,
    CONSTRAINT check_31395542a4 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_assignment_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_assignment_events_id_seq OWNED BY merge_request_assignment_events.id;

CREATE TABLE merge_request_blocks (
    id bigint NOT NULL,
    blocking_merge_request_id bigint NOT NULL,
    blocked_merge_request_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_f8034ca45e CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_blocks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_blocks_id_seq OWNED BY merge_request_blocks.id;

CREATE TABLE merge_request_cleanup_schedules (
    merge_request_id bigint NOT NULL,
    scheduled_at timestamp with time zone NOT NULL,
    completed_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    failed_count integer DEFAULT 0 NOT NULL,
    project_id bigint
);

CREATE SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq OWNED BY merge_request_cleanup_schedules.merge_request_id;

CREATE SEQUENCE merge_request_commits_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_commits_metadata_id_seq OWNED BY merge_request_commits_metadata.id;

CREATE TABLE merge_request_context_commit_diff_files (
    sha bytea NOT NULL,
    relative_order integer NOT NULL,
    new_file boolean NOT NULL,
    renamed_file boolean NOT NULL,
    deleted_file boolean NOT NULL,
    too_large boolean NOT NULL,
    a_mode character varying(255) NOT NULL,
    b_mode character varying(255) NOT NULL,
    new_path text NOT NULL,
    old_path text NOT NULL,
    diff text,
    "binary" boolean,
    merge_request_context_commit_id bigint NOT NULL,
    generated boolean,
    encoded_file_path boolean DEFAULT false NOT NULL,
    project_id bigint
);

CREATE TABLE merge_request_context_commits (
    id bigint NOT NULL,
    authored_date timestamp with time zone,
    committed_date timestamp with time zone,
    relative_order integer NOT NULL,
    sha bytea NOT NULL,
    author_name text,
    author_email text,
    committer_name text,
    committer_email text,
    message text,
    merge_request_id bigint,
    trailers jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_1dc6b5f2ac CHECK ((merge_request_id IS NOT NULL)),
    CONSTRAINT check_777e62d390 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_context_commits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_context_commits_id_seq OWNED BY merge_request_context_commits.id;

CREATE TABLE merge_request_diff_commit_users (
    id bigint NOT NULL,
    name text,
    email text,
    organization_id bigint DEFAULT 1 NOT NULL,
    CONSTRAINT check_147358fc42 CHECK ((char_length(name) <= 512)),
    CONSTRAINT check_f5fa206cf7 CHECK ((char_length(email) <= 512)),
    CONSTRAINT merge_request_diff_commit_users_name_or_email_existence CHECK (((COALESCE(name, ''::text) <> ''::text) OR (COALESCE(email, ''::text) <> ''::text)))
);

CREATE SEQUENCE merge_request_diff_commit_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_diff_commit_users_id_seq OWNED BY merge_request_diff_commit_users.id;

CREATE TABLE merge_request_diff_commits (
    authored_date timestamp without time zone,
    committed_date timestamp without time zone,
    merge_request_diff_id bigint NOT NULL,
    relative_order integer NOT NULL,
    sha bytea,
    message text,
    trailers jsonb DEFAULT '{}'::jsonb,
    commit_author_id bigint,
    committer_id bigint,
    merge_request_commits_metadata_id bigint,
    project_id bigint
);

CREATE TABLE merge_request_diff_details (
    merge_request_diff_id bigint NOT NULL,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_started_at timestamp with time zone,
    project_id bigint,
    CONSTRAINT check_81429e3622 CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE merge_request_diff_details_merge_request_diff_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_diff_details_merge_request_diff_id_seq OWNED BY merge_request_diff_details.merge_request_diff_id;

CREATE TABLE merge_request_diff_files (
    merge_request_diff_id bigint NOT NULL,
    relative_order integer NOT NULL,
    new_file boolean NOT NULL,
    renamed_file boolean NOT NULL,
    deleted_file boolean NOT NULL,
    too_large boolean NOT NULL,
    a_mode character varying NOT NULL,
    b_mode character varying NOT NULL,
    new_path text NOT NULL,
    old_path text NOT NULL,
    diff text,
    "binary" boolean,
    external_diff_offset integer,
    external_diff_size integer,
    generated boolean,
    encoded_file_path boolean DEFAULT false NOT NULL,
    project_id bigint
);

CREATE TABLE merge_request_diffs (
    id bigint NOT NULL,
    state character varying,
    merge_request_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    base_commit_sha character varying,
    real_size character varying,
    head_commit_sha character varying,
    start_commit_sha character varying,
    commits_count integer,
    external_diff character varying,
    external_diff_store integer DEFAULT 1,
    stored_externally boolean,
    files_count smallint,
    sorted boolean DEFAULT false NOT NULL,
    diff_type smallint DEFAULT 1 NOT NULL,
    patch_id_sha bytea,
    project_id bigint,
    CONSTRAINT check_11c5f029ad CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_93ee616ac9 CHECK ((external_diff_store IS NOT NULL))
);

CREATE SEQUENCE merge_request_diffs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_diffs_id_seq OWNED BY merge_request_diffs.id;

CREATE TABLE merge_request_merge_schedules (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    merge_after timestamp with time zone,
    project_id bigint NOT NULL
);

CREATE SEQUENCE merge_request_merge_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_merge_schedules_id_seq OWNED BY merge_request_merge_schedules.id;

CREATE TABLE merge_request_metrics (
    merge_request_id bigint NOT NULL,
    latest_build_started_at timestamp without time zone,
    latest_build_finished_at timestamp without time zone,
    first_deployed_to_production_at timestamp without time zone,
    merged_at timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    merged_by_id bigint,
    latest_closed_by_id bigint,
    latest_closed_at timestamp with time zone,
    first_comment_at timestamp with time zone,
    first_commit_at timestamp with time zone,
    last_commit_at timestamp with time zone,
    diff_size integer,
    modified_paths_size integer,
    commits_count integer,
    first_approved_at timestamp with time zone,
    first_reassigned_at timestamp with time zone,
    added_lines integer,
    removed_lines integer,
    target_project_id bigint,
    id bigint NOT NULL,
    first_contribution boolean DEFAULT false NOT NULL,
    pipeline_id bigint,
    reviewer_first_assigned_at timestamp with time zone,
    CONSTRAINT check_e03d0900bf CHECK ((target_project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_metrics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_metrics_id_seq OWNED BY merge_request_metrics.id;

CREATE TABLE merge_request_predictions (
    merge_request_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    suggested_reviewers jsonb DEFAULT '{}'::jsonb NOT NULL,
    accepted_reviewers jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint
);

CREATE SEQUENCE merge_request_predictions_merge_request_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_predictions_merge_request_id_seq OWNED BY merge_request_predictions.merge_request_id;

CREATE TABLE merge_request_requested_changes (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE merge_request_requested_changes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_requested_changes_id_seq OWNED BY merge_request_requested_changes.id;

CREATE TABLE merge_request_reviewers (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_fb72c99774 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_reviewers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_reviewers_id_seq OWNED BY merge_request_reviewers.id;

CREATE TABLE merge_request_user_mentions (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    note_id bigint,
    project_id bigint,
    CONSTRAINT check_0f5d7f30e4 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_request_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_request_user_mentions_id_seq OWNED BY merge_request_user_mentions.id;

CREATE TABLE merge_requests (
    id bigint NOT NULL,
    target_branch character varying NOT NULL,
    source_branch character varying NOT NULL,
    source_project_id bigint,
    author_id bigint,
    assignee_id bigint,
    title character varying,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    milestone_id bigint,
    merge_status character varying DEFAULT 'unchecked'::character varying NOT NULL,
    target_project_id bigint NOT NULL,
    iid integer,
    description text,
    updated_by_id bigint,
    merge_error text,
    merge_params text,
    merge_when_pipeline_succeeds boolean DEFAULT false NOT NULL,
    merge_user_id bigint,
    merge_commit_sha character varying,
    approvals_before_merge integer,
    rebase_commit_sha character varying,
    in_progress_merge_commit_sha character varying,
    lock_version integer DEFAULT 0,
    title_html text,
    description_html text,
    time_estimate integer DEFAULT 0,
    squash boolean DEFAULT false NOT NULL,
    cached_markdown_version integer,
    last_edited_at timestamp without time zone,
    last_edited_by_id bigint,
    merge_jid character varying,
    discussion_locked boolean,
    latest_merge_request_diff_id bigint,
    allow_maintainer_to_push boolean DEFAULT true,
    state_id smallint DEFAULT 1 NOT NULL,
    rebase_jid character varying,
    squash_commit_sha bytea,
    sprint_id bigint,
    merge_ref_sha bytea,
    draft boolean DEFAULT false NOT NULL,
    prepared_at timestamp with time zone,
    merged_commit_sha bytea,
    override_requested_changes boolean DEFAULT false NOT NULL,
    head_pipeline_id bigint,
    imported_from smallint DEFAULT 0 NOT NULL,
    retargeted boolean DEFAULT false NOT NULL,
    CONSTRAINT check_970d272570 CHECK ((lock_version IS NOT NULL))
);

CREATE TABLE merge_requests_approval_rules (
    id bigint NOT NULL,
    name text NOT NULL,
    approvals_required integer DEFAULT 0 NOT NULL,
    rule_type smallint DEFAULT 0 NOT NULL,
    origin smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    group_id bigint,
    source_rule_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_ba7b03c61a CHECK ((num_nonnulls(group_id, project_id) = 1)),
    CONSTRAINT check_c7c36145b7 CHECK ((char_length(name) <= 255))
);

CREATE TABLE merge_requests_approval_rules_approver_groups (
    id bigint NOT NULL,
    approval_rule_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
);

CREATE SEQUENCE merge_requests_approval_rules_approver_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_approval_rules_approver_groups_id_seq OWNED BY merge_requests_approval_rules_approver_groups.id;

CREATE TABLE merge_requests_approval_rules_approver_users (
    id bigint NOT NULL,
    approval_rule_id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint,
    group_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_ccdbd0e37e CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE merge_requests_approval_rules_approver_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_approval_rules_approver_users_id_seq OWNED BY merge_requests_approval_rules_approver_users.id;

CREATE TABLE merge_requests_approval_rules_groups (
    id bigint NOT NULL,
    approval_rule_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
);

CREATE SEQUENCE merge_requests_approval_rules_groups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_approval_rules_groups_id_seq OWNED BY merge_requests_approval_rules_groups.id;

CREATE SEQUENCE merge_requests_approval_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_approval_rules_id_seq OWNED BY merge_requests_approval_rules.id;

CREATE TABLE merge_requests_approval_rules_merge_requests (
    id bigint NOT NULL,
    approval_rule_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE merge_requests_approval_rules_merge_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_approval_rules_merge_requests_id_seq OWNED BY merge_requests_approval_rules_merge_requests.id;

CREATE TABLE merge_requests_approval_rules_projects (
    id bigint NOT NULL,
    approval_rule_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE merge_requests_approval_rules_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_approval_rules_projects_id_seq OWNED BY merge_requests_approval_rules_projects.id;

CREATE TABLE merge_requests_closing_issues (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    from_mr_description boolean DEFAULT true NOT NULL,
    project_id bigint,
    CONSTRAINT check_8532dd8dc4 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE merge_requests_closing_issues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_closing_issues_id_seq OWNED BY merge_requests_closing_issues.id;

CREATE TABLE merge_requests_compliance_violations (
    id bigint NOT NULL,
    violating_user_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    reason smallint NOT NULL,
    severity_level smallint DEFAULT 0 NOT NULL,
    merged_at timestamp with time zone,
    target_project_id bigint,
    title text,
    target_branch text,
    CONSTRAINT check_860e317e6f CHECK ((target_project_id IS NOT NULL))
);

CREATE SEQUENCE merge_requests_compliance_violations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_compliance_violations_id_seq OWNED BY merge_requests_compliance_violations.id;

CREATE SEQUENCE merge_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_requests_id_seq OWNED BY merge_requests.id;

CREATE TABLE merge_trains (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    target_project_id bigint NOT NULL,
    target_branch text NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    merged_at timestamp with time zone,
    duration integer,
    pipeline_id bigint
);

CREATE SEQUENCE merge_trains_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE merge_trains_id_seq OWNED BY merge_trains.id;

CREATE TABLE milestone_releases (
    milestone_id bigint NOT NULL,
    release_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_8141b5b804 CHECK ((project_id IS NOT NULL))
);

CREATE TABLE milestones (
    id bigint NOT NULL,
    title character varying NOT NULL,
    project_id bigint,
    description text,
    due_date date,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    state character varying,
    iid integer,
    title_html text,
    description_html text,
    start_date date,
    cached_markdown_version integer,
    group_id bigint,
    lock_version integer DEFAULT 0 NOT NULL,
    CONSTRAINT check_08e9c27987 CHECK ((num_nonnulls(group_id, project_id) = 1))
);

CREATE SEQUENCE milestones_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE milestones_id_seq OWNED BY milestones.id;

CREATE TABLE ml_candidate_metadata (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    candidate_id bigint NOT NULL,
    name text NOT NULL,
    value text NOT NULL,
    project_id bigint,
    CONSTRAINT check_6b38a286a5 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_9453f4a8e9 CHECK ((char_length(value) <= 5000)),
    CONSTRAINT check_b964e2ac27 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ml_candidate_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_candidate_metadata_id_seq OWNED BY ml_candidate_metadata.id;

CREATE TABLE ml_candidate_metrics (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    candidate_id bigint,
    value double precision,
    step integer,
    is_nan bytea,
    name text NOT NULL,
    tracked_at bigint,
    project_id bigint,
    CONSTRAINT check_3bb4a3fbd9 CHECK ((char_length(name) <= 250)),
    CONSTRAINT check_d7dfd3de26 CHECK ((candidate_id IS NOT NULL)),
    CONSTRAINT check_e0012be52e CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ml_candidate_metrics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_candidate_metrics_id_seq OWNED BY ml_candidate_metrics.id;

CREATE TABLE ml_candidate_params (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    candidate_id bigint,
    name text NOT NULL,
    value text NOT NULL,
    project_id bigint,
    CONSTRAINT check_093034d049 CHECK ((char_length(name) <= 250)),
    CONSTRAINT check_28a3c29e43 CHECK ((char_length(value) <= 250)),
    CONSTRAINT check_7a0505ca91 CHECK ((candidate_id IS NOT NULL)),
    CONSTRAINT check_b42534522f CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ml_candidate_params_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_candidate_params_id_seq OWNED BY ml_candidate_params.id;

CREATE TABLE ml_candidates (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    experiment_id bigint NOT NULL,
    user_id bigint,
    start_time bigint,
    end_time bigint,
    status smallint DEFAULT 0 NOT NULL,
    name text,
    package_id bigint,
    eid uuid,
    project_id bigint,
    internal_id bigint,
    ci_build_id bigint,
    model_version_id bigint,
    CONSTRAINT check_01584ca6db CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_25e6c65051 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_cd160587d4 CHECK ((eid IS NOT NULL))
);

CREATE SEQUENCE ml_candidates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_candidates_id_seq OWNED BY ml_candidates.id;

CREATE TABLE ml_experiment_metadata (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    experiment_id bigint NOT NULL,
    name text NOT NULL,
    value text NOT NULL,
    project_id bigint,
    CONSTRAINT check_112fe5002d CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_a91c633d68 CHECK ((char_length(value) <= 5000)),
    CONSTRAINT check_ca9b8315ef CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ml_experiment_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_experiment_metadata_id_seq OWNED BY ml_experiment_metadata.id;

CREATE TABLE ml_experiments (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    iid bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint,
    name text NOT NULL,
    deleted_on timestamp with time zone,
    model_id bigint,
    CONSTRAINT check_ee07a0be2c CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE ml_experiments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_experiments_id_seq OWNED BY ml_experiments.id;

CREATE TABLE ml_model_metadata (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    model_id bigint NOT NULL,
    name text NOT NULL,
    value text NOT NULL,
    project_id bigint,
    CONSTRAINT check_26d3322153 CHECK ((char_length(value) <= 5000)),
    CONSTRAINT check_36240c80a7 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_9a8615c7cc CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE ml_model_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_model_metadata_id_seq OWNED BY ml_model_metadata.id;

CREATE TABLE ml_model_version_metadata (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    model_version_id bigint NOT NULL,
    name text NOT NULL,
    value text NOT NULL,
    CONSTRAINT check_09a0e5cb5b CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_21c444e039 CHECK ((char_length(value) <= 5000))
);

CREATE SEQUENCE ml_model_version_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_model_version_metadata_id_seq OWNED BY ml_model_version_metadata.id;

CREATE TABLE ml_model_versions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    model_id bigint NOT NULL,
    package_id bigint,
    version text NOT NULL,
    description text,
    semver_major integer,
    semver_minor integer,
    semver_patch integer,
    semver_prerelease text,
    cached_markdown_version integer,
    description_html text,
    CONSTRAINT check_246f5048b5 CHECK ((char_length(semver_prerelease) <= 255)),
    CONSTRAINT check_28b2d892c8 CHECK ((char_length(version) <= 255)),
    CONSTRAINT check_4d50116294 CHECK ((char_length(description_html) <= 50000)),
    CONSTRAINT check_f1545d8a9e CHECK ((char_length(description) <= 10000))
);

CREATE SEQUENCE ml_model_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_model_versions_id_seq OWNED BY ml_model_versions.id;

CREATE TABLE ml_models (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    description text,
    user_id bigint,
    cached_markdown_version integer,
    description_html text,
    CONSTRAINT check_1fd2cc7d93 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_51a38acdaa CHECK ((char_length(description_html) <= 50000)),
    CONSTRAINT check_f8df2fefc5 CHECK ((char_length(description) <= 10000))
);

CREATE SEQUENCE ml_models_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ml_models_id_seq OWNED BY ml_models.id;

CREATE TABLE namespace_admin_notes (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    note text,
    CONSTRAINT check_e9d2e71b5d CHECK ((char_length(note) <= 1000))
);

CREATE SEQUENCE namespace_admin_notes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_admin_notes_id_seq OWNED BY namespace_admin_notes.id;

CREATE TABLE namespace_aggregation_schedules (
    namespace_id bigint NOT NULL
);

CREATE TABLE namespace_ai_settings (
    namespace_id bigint NOT NULL,
    duo_workflow_mcp_enabled boolean DEFAULT false NOT NULL
);

CREATE TABLE namespace_bans (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE namespace_bans_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_bans_id_seq OWNED BY namespace_bans.id;

CREATE TABLE namespace_ci_cd_settings (
    namespace_id bigint NOT NULL,
    allow_stale_runner_pruning boolean DEFAULT false NOT NULL
);

CREATE TABLE namespace_cluster_agent_mappings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    cluster_agent_id bigint NOT NULL,
    creator_id bigint
);

CREATE SEQUENCE namespace_cluster_agent_mappings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_cluster_agent_mappings_id_seq OWNED BY namespace_cluster_agent_mappings.id;

CREATE TABLE namespace_commit_emails (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    email_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE namespace_commit_emails_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_commit_emails_id_seq OWNED BY namespace_commit_emails.id;

CREATE TABLE namespace_deletion_schedules (
    namespace_id bigint NOT NULL,
    user_id bigint NOT NULL,
    marked_for_deletion_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE namespace_deletion_schedules_namespace_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_deletion_schedules_namespace_id_seq OWNED BY namespace_deletion_schedules.namespace_id;

CREATE TABLE namespace_details (
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    cached_markdown_version integer,
    description text,
    description_html text,
    creator_id bigint,
    deleted_at timestamp with time zone
);

CREATE TABLE namespace_import_users (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE namespace_import_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_import_users_id_seq OWNED BY namespace_import_users.id;

CREATE TABLE namespace_ldap_settings (
    namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    sync_last_start_at timestamp with time zone,
    sync_last_update_at timestamp with time zone,
    sync_last_successful_at timestamp with time zone,
    sync_status smallint DEFAULT 0 NOT NULL,
    sync_error text,
    CONSTRAINT check_51a03d26b6 CHECK ((char_length(sync_error) <= 255))
);

CREATE TABLE namespace_limits (
    additional_purchased_storage_size bigint DEFAULT 0 NOT NULL,
    additional_purchased_storage_ends_on date,
    namespace_id bigint NOT NULL,
    pre_enforcement_notification_at timestamp with time zone,
    first_enforced_at timestamp with time zone,
    last_enforced_at timestamp with time zone,
    last_seat_all_used_seats_notification_at timestamp with time zone,
    max_number_of_vulnerabilities_per_project integer
);

CREATE TABLE namespace_package_settings (
    namespace_id bigint NOT NULL,
    maven_duplicates_allowed boolean DEFAULT true NOT NULL,
    maven_duplicate_exception_regex text DEFAULT ''::text NOT NULL,
    generic_duplicates_allowed boolean DEFAULT true NOT NULL,
    generic_duplicate_exception_regex text DEFAULT ''::text NOT NULL,
    maven_package_requests_forwarding boolean,
    lock_maven_package_requests_forwarding boolean DEFAULT false NOT NULL,
    pypi_package_requests_forwarding boolean,
    lock_pypi_package_requests_forwarding boolean DEFAULT false NOT NULL,
    npm_package_requests_forwarding boolean,
    lock_npm_package_requests_forwarding boolean DEFAULT false NOT NULL,
    nuget_duplicates_allowed boolean DEFAULT true NOT NULL,
    nuget_duplicate_exception_regex text DEFAULT ''::text NOT NULL,
    nuget_symbol_server_enabled boolean DEFAULT false NOT NULL,
    terraform_module_duplicates_allowed boolean DEFAULT false NOT NULL,
    terraform_module_duplicate_exception_regex text DEFAULT ''::text NOT NULL,
    audit_events_enabled boolean DEFAULT false NOT NULL,
    CONSTRAINT check_31340211b1 CHECK ((char_length(generic_duplicate_exception_regex) <= 255)),
    CONSTRAINT check_d63274b2b6 CHECK ((char_length(maven_duplicate_exception_regex) <= 255)),
    CONSTRAINT check_eedcf85c48 CHECK ((char_length(nuget_duplicate_exception_regex) <= 255)),
    CONSTRAINT check_f10503f1ad CHECK ((char_length(terraform_module_duplicate_exception_regex) <= 255))
);

CREATE TABLE namespace_root_storage_statistics (
    namespace_id bigint NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    repository_size bigint DEFAULT 0 NOT NULL,
    lfs_objects_size bigint DEFAULT 0 NOT NULL,
    wiki_size bigint DEFAULT 0 NOT NULL,
    build_artifacts_size bigint DEFAULT 0 NOT NULL,
    storage_size bigint DEFAULT 0 NOT NULL,
    packages_size bigint DEFAULT 0 NOT NULL,
    snippets_size bigint DEFAULT 0 NOT NULL,
    pipeline_artifacts_size bigint DEFAULT 0 NOT NULL,
    uploads_size bigint DEFAULT 0 NOT NULL,
    dependency_proxy_size bigint DEFAULT 0 NOT NULL,
    notification_level smallint DEFAULT 100 NOT NULL,
    container_registry_size bigint DEFAULT 0 NOT NULL,
    registry_size_estimated boolean DEFAULT false NOT NULL,
    public_forks_storage_size bigint DEFAULT 0 NOT NULL,
    internal_forks_storage_size bigint DEFAULT 0 NOT NULL,
    private_forks_storage_size bigint DEFAULT 0 NOT NULL
);

CREATE TABLE namespace_settings (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    prevent_forking_outside_group boolean DEFAULT false NOT NULL,
    allow_mfa_for_subgroups boolean DEFAULT true NOT NULL,
    default_branch_name text,
    repository_read_only boolean DEFAULT false NOT NULL,
    resource_access_token_creation_allowed boolean DEFAULT true NOT NULL,
    prevent_sharing_groups_outside_hierarchy boolean DEFAULT false NOT NULL,
    new_user_signups_cap integer,
    setup_for_company boolean,
    jobs_to_be_done smallint,
    runner_token_expiration_interval integer,
    subgroup_runner_token_expiration_interval integer,
    project_runner_token_expiration_interval integer,
    show_diff_preview_in_email boolean DEFAULT true NOT NULL,
    enabled_git_access_protocol smallint DEFAULT 0 NOT NULL,
    unique_project_download_limit smallint DEFAULT 0 NOT NULL,
    unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL,
    unique_project_download_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
    auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL,
    only_allow_merge_if_pipeline_succeeds boolean DEFAULT false NOT NULL,
    allow_merge_on_skipped_pipeline boolean DEFAULT false NOT NULL,
    only_allow_merge_if_all_discussions_are_resolved boolean DEFAULT false NOT NULL,
    default_compliance_framework_id bigint,
    runner_registration_enabled boolean DEFAULT true,
    allow_runner_registration_token boolean DEFAULT true NOT NULL,
    unique_project_download_limit_alertlist integer[] DEFAULT '{}'::integer[] NOT NULL,
    emails_enabled boolean DEFAULT true NOT NULL,
    experiment_features_enabled boolean DEFAULT false NOT NULL,
    default_branch_protection_defaults jsonb DEFAULT '{}'::jsonb NOT NULL,
    service_access_tokens_expiration_enforced boolean DEFAULT true NOT NULL,
    product_analytics_enabled boolean DEFAULT false NOT NULL,
    allow_merge_without_pipeline boolean DEFAULT false NOT NULL,
    enforce_ssh_certificates boolean DEFAULT false NOT NULL,
    math_rendering_limits_enabled boolean,
    lock_math_rendering_limits_enabled boolean DEFAULT false NOT NULL,
    duo_features_enabled boolean,
    lock_duo_features_enabled boolean DEFAULT false NOT NULL,
    disable_personal_access_tokens boolean DEFAULT false NOT NULL,
    enable_auto_assign_gitlab_duo_pro_seats boolean DEFAULT false NOT NULL,
    early_access_program_participant boolean DEFAULT false NOT NULL,
    remove_dormant_members boolean DEFAULT false NOT NULL,
    remove_dormant_members_period integer DEFAULT 90 NOT NULL,
    early_access_program_joined_by_id bigint,
    seat_control smallint DEFAULT 0 NOT NULL,
    last_dormant_member_review_at timestamp with time zone,
    enterprise_users_extensions_marketplace_opt_in_status smallint DEFAULT 0 NOT NULL,
    spp_repository_pipeline_access boolean,
    lock_spp_repository_pipeline_access boolean DEFAULT false NOT NULL,
    archived boolean DEFAULT false NOT NULL,
    token_expiry_notify_inherited boolean DEFAULT true NOT NULL,
    resource_access_token_notify_inherited boolean,
    lock_resource_access_token_notify_inherited boolean DEFAULT false NOT NULL,
    pipeline_variables_default_role smallint DEFAULT 2 NOT NULL,
    force_pages_access_control boolean DEFAULT false NOT NULL,
    extended_grat_expiry_webhooks_execute boolean DEFAULT false NOT NULL,
    jwt_ci_cd_job_token_enabled boolean DEFAULT false NOT NULL,
    jwt_ci_cd_job_token_opted_out boolean DEFAULT false NOT NULL,
    require_dpop_for_manage_api_endpoints boolean DEFAULT false NOT NULL,
    job_token_policies_enabled boolean DEFAULT false NOT NULL,
    security_policies jsonb DEFAULT '{}'::jsonb NOT NULL,
    duo_nano_features_enabled boolean,
    model_prompt_cache_enabled boolean,
    lock_model_prompt_cache_enabled boolean DEFAULT false NOT NULL,
    disable_invite_members boolean DEFAULT false NOT NULL,
    web_based_commit_signing_enabled boolean,
    lock_web_based_commit_signing_enabled boolean DEFAULT false NOT NULL,
    allow_enterprise_bypass_placeholder_confirmation boolean DEFAULT false NOT NULL,
    enterprise_bypass_expires_at timestamp with time zone,
    CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)),
    CONSTRAINT check_namespace_settings_security_policies_is_hash CHECK ((jsonb_typeof(security_policies) = 'object'::text)),
    CONSTRAINT namespace_settings_unique_project_download_limit_alertlist_size CHECK ((cardinality(unique_project_download_limit_alertlist) <= 100)),
    CONSTRAINT namespace_settings_unique_project_download_limit_allowlist_size CHECK ((cardinality(unique_project_download_limit_allowlist) <= 100))
);

CREATE TABLE namespace_statistics (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    shared_runners_seconds integer DEFAULT 0 NOT NULL,
    shared_runners_seconds_last_reset timestamp without time zone,
    storage_size bigint DEFAULT 0 NOT NULL,
    wiki_size bigint DEFAULT 0 NOT NULL,
    dependency_proxy_size bigint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE namespace_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespace_statistics_id_seq OWNED BY namespace_statistics.id;

CREATE TABLE namespace_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE SEQUENCE namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespaces_id_seq OWNED BY namespaces.id;

CREATE TABLE namespaces_storage_limit_exclusions (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    reason text NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_81640b2ee2 CHECK ((char_length(reason) <= 255))
);

CREATE SEQUENCE namespaces_storage_limit_exclusions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespaces_storage_limit_exclusions_id_seq OWNED BY namespaces_storage_limit_exclusions.id;

CREATE TABLE namespaces_sync_events (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE namespaces_sync_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE namespaces_sync_events_id_seq OWNED BY namespaces_sync_events.id;

CREATE TABLE non_sql_service_pings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    recorded_at timestamp with time zone NOT NULL,
    payload jsonb NOT NULL,
    organization_id bigint NOT NULL,
    metadata jsonb
);

CREATE SEQUENCE non_sql_service_pings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE non_sql_service_pings_id_seq OWNED BY non_sql_service_pings.id;

CREATE TABLE note_diff_files (
    id bigint NOT NULL,
    diff text NOT NULL,
    new_file boolean NOT NULL,
    renamed_file boolean NOT NULL,
    deleted_file boolean NOT NULL,
    a_mode character varying NOT NULL,
    b_mode character varying NOT NULL,
    new_path text NOT NULL,
    old_path text NOT NULL,
    diff_note_id bigint NOT NULL
);

CREATE SEQUENCE note_diff_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE note_diff_files_id_seq OWNED BY note_diff_files.id;

CREATE TABLE note_metadata (
    note_id bigint NOT NULL,
    email_participant text,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    CONSTRAINT check_40aa5ff1c6 CHECK ((char_length(email_participant) <= 255))
);

CREATE SEQUENCE note_metadata_note_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE note_metadata_note_id_seq OWNED BY note_metadata.note_id;

CREATE TABLE note_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE notes (
    note text,
    noteable_type character varying,
    author_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    project_id bigint,
    line_code character varying,
    commit_id character varying,
    noteable_id bigint,
    system boolean DEFAULT false NOT NULL,
    st_diff text,
    updated_by_id bigint,
    type character varying,
    "position" text,
    original_position text,
    resolved_at timestamp without time zone,
    resolved_by_id bigint,
    discussion_id character varying,
    note_html text,
    cached_markdown_version integer,
    change_position text,
    resolved_by_push boolean,
    review_id bigint,
    confidential boolean,
    last_edited_at timestamp with time zone,
    internal boolean DEFAULT false NOT NULL,
    id bigint NOT NULL,
    namespace_id bigint,
    imported_from smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_1244cbd7d0 CHECK ((noteable_type IS NOT NULL))
);

CREATE SEQUENCE notes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE notes_id_seq OWNED BY notes.id;

CREATE TABLE notification_settings (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    source_id bigint,
    source_type character varying,
    level integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    new_note boolean,
    new_issue boolean,
    reopen_issue boolean,
    close_issue boolean,
    reassign_issue boolean,
    new_merge_request boolean,
    reopen_merge_request boolean,
    close_merge_request boolean,
    reassign_merge_request boolean,
    merge_merge_request boolean,
    failed_pipeline boolean,
    success_pipeline boolean,
    push_to_merge_request boolean,
    issue_due boolean,
    new_epic boolean,
    notification_email character varying,
    fixed_pipeline boolean,
    new_release boolean,
    moved_project boolean DEFAULT true NOT NULL,
    change_reviewer_merge_request boolean,
    merge_when_pipeline_succeeds boolean DEFAULT false NOT NULL,
    approver boolean DEFAULT false NOT NULL,
    service_account_failed_pipeline boolean DEFAULT false NOT NULL,
    service_account_success_pipeline boolean DEFAULT false NOT NULL,
    service_account_fixed_pipeline boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE notification_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE notification_settings_id_seq OWNED BY notification_settings.id;

CREATE TABLE oauth_access_grants (
    id bigint NOT NULL,
    resource_owner_id bigint NOT NULL,
    application_id bigint NOT NULL,
    token character varying NOT NULL,
    expires_in integer NOT NULL,
    redirect_uri text NOT NULL,
    created_at timestamp without time zone NOT NULL,
    revoked_at timestamp without time zone,
    scopes character varying,
    code_challenge text,
    code_challenge_method text,
    organization_id bigint NOT NULL,
    CONSTRAINT oauth_access_grants_code_challenge CHECK ((char_length(code_challenge) <= 128)),
    CONSTRAINT oauth_access_grants_code_challenge_method CHECK ((char_length(code_challenge_method) <= 5))
);

CREATE SEQUENCE oauth_access_grants_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE oauth_access_grants_id_seq OWNED BY oauth_access_grants.id;

CREATE TABLE oauth_access_tokens (
    id bigint NOT NULL,
    resource_owner_id bigint,
    application_id bigint,
    token character varying NOT NULL,
    refresh_token character varying,
    expires_in integer DEFAULT 7200,
    revoked_at timestamp without time zone,
    created_at timestamp without time zone NOT NULL,
    scopes character varying,
    organization_id bigint NOT NULL,
    CONSTRAINT check_70f294ef54 CHECK ((expires_in IS NOT NULL))
);

CREATE SEQUENCE oauth_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE oauth_access_tokens_id_seq OWNED BY oauth_access_tokens.id;

CREATE TABLE oauth_applications (
    id bigint NOT NULL,
    name character varying NOT NULL,
    uid character varying NOT NULL,
    secret character varying NOT NULL,
    redirect_uri text NOT NULL,
    scopes text DEFAULT ''::text NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    owner_id bigint,
    owner_type character varying,
    trusted boolean DEFAULT false NOT NULL,
    confidential boolean DEFAULT true NOT NULL,
    expire_access_tokens boolean DEFAULT false NOT NULL,
    ropc_enabled boolean DEFAULT true NOT NULL
);

CREATE SEQUENCE oauth_applications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE oauth_applications_id_seq OWNED BY oauth_applications.id;

CREATE TABLE oauth_device_grants (
    id bigint NOT NULL,
    resource_owner_id bigint,
    application_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    last_polling_at timestamp with time zone,
    expires_in integer NOT NULL,
    scopes text DEFAULT ''::text NOT NULL,
    device_code text NOT NULL,
    user_code text,
    organization_id bigint NOT NULL,
    CONSTRAINT check_a6271f2c07 CHECK ((char_length(device_code) <= 255)),
    CONSTRAINT check_b0459113c7 CHECK ((char_length(scopes) <= 255)),
    CONSTRAINT check_b36370c6df CHECK ((char_length(user_code) <= 255))
);

CREATE SEQUENCE oauth_device_grants_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE oauth_device_grants_id_seq OWNED BY oauth_device_grants.id;

CREATE TABLE oauth_openid_requests (
    id bigint NOT NULL,
    access_grant_id bigint NOT NULL,
    nonce character varying NOT NULL,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE oauth_openid_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE oauth_openid_requests_id_seq OWNED BY oauth_openid_requests.id;

CREATE TABLE observability_group_o11y_settings (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    o11y_service_url text NOT NULL,
    o11y_service_user_email text NOT NULL,
    o11y_service_password jsonb NOT NULL,
    o11y_service_post_message_encryption_key jsonb NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_470a188df1 CHECK ((char_length(o11y_service_user_email) <= 255)),
    CONSTRAINT check_9a69bf69bb CHECK ((char_length(o11y_service_url) <= 255))
);

CREATE SEQUENCE observability_group_o11y_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE observability_group_o11y_settings_id_seq OWNED BY observability_group_o11y_settings.id;

CREATE TABLE observability_logs_issues_connections (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    project_id bigint NOT NULL,
    log_timestamp timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    severity_number smallint NOT NULL,
    service_name text NOT NULL,
    trace_identifier text NOT NULL,
    log_fingerprint text NOT NULL,
    CONSTRAINT check_80945187b6 CHECK ((char_length(trace_identifier) <= 128)),
    CONSTRAINT check_ab38275544 CHECK ((char_length(log_fingerprint) <= 128)),
    CONSTRAINT check_d86a20d56b CHECK ((char_length(service_name) <= 500))
);

CREATE SEQUENCE observability_logs_issues_connections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE observability_logs_issues_connections_id_seq OWNED BY observability_logs_issues_connections.id;

CREATE TABLE observability_metrics_issues_connections (
    id bigint NOT NULL,
    issue_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,
    metric_type smallint NOT NULL,
    metric_name text NOT NULL,
    project_id bigint,
    CONSTRAINT check_3c743c1262 CHECK ((char_length(metric_name) <= 500))
);

CREATE SEQUENCE observability_metrics_issues_connections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE observability_metrics_issues_connections_id_seq OWNED BY observability_metrics_issues_connections.id;

CREATE TABLE observability_traces_issues_connections (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    trace_identifier text NOT NULL,
    CONSTRAINT check_5b51f9ea15 CHECK ((char_length(trace_identifier) <= 128))
);

CREATE SEQUENCE observability_traces_issues_connections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE observability_traces_issues_connections_id_seq OWNED BY observability_traces_issues_connections.id;

CREATE TABLE onboarding_progresses (
    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,
    merge_request_created_at timestamp with time zone,
    pipeline_created_at timestamp with time zone,
    user_added_at timestamp with time zone,
    trial_started_at timestamp with time zone,
    required_mr_approvals_enabled_at timestamp with time zone,
    code_owners_enabled_at timestamp with time zone,
    issue_created_at timestamp with time zone,
    secure_dependency_scanning_run_at timestamp with time zone,
    secure_dast_run_at timestamp with time zone,
    license_scanning_run_at timestamp with time zone,
    code_added_at timestamp with time zone,
    ended_at timestamp with time zone,
    duo_seat_assigned_at timestamp with time zone
);

CREATE SEQUENCE onboarding_progresses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE onboarding_progresses_id_seq OWNED BY onboarding_progresses.id;

CREATE TABLE operations_feature_flags (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    active boolean NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name character varying NOT NULL,
    description text,
    iid integer NOT NULL,
    version smallint DEFAULT 1 NOT NULL
);

CREATE TABLE operations_feature_flags_clients (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    token_encrypted character varying,
    last_feature_flag_updated_at timestamp with time zone
);

CREATE SEQUENCE operations_feature_flags_clients_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_feature_flags_clients_id_seq OWNED BY operations_feature_flags_clients.id;

CREATE SEQUENCE operations_feature_flags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_feature_flags_id_seq OWNED BY operations_feature_flags.id;

CREATE TABLE operations_feature_flags_issues (
    id bigint NOT NULL,
    feature_flag_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_0e57762955 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE operations_feature_flags_issues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_feature_flags_issues_id_seq OWNED BY operations_feature_flags_issues.id;

CREATE TABLE operations_scopes (
    id bigint NOT NULL,
    strategy_id bigint NOT NULL,
    environment_scope character varying(255) NOT NULL,
    project_id bigint,
    CONSTRAINT check_722a570b84 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE operations_scopes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_scopes_id_seq OWNED BY operations_scopes.id;

CREATE TABLE operations_strategies (
    id bigint NOT NULL,
    feature_flag_id bigint NOT NULL,
    name character varying(255) NOT NULL,
    parameters jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_85b486853f CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE operations_strategies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_strategies_id_seq OWNED BY operations_strategies.id;

CREATE TABLE operations_strategies_user_lists (
    id bigint NOT NULL,
    strategy_id bigint NOT NULL,
    user_list_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_be4b61e4d3 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE operations_strategies_user_lists_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_strategies_user_lists_id_seq OWNED BY operations_strategies_user_lists.id;

CREATE TABLE operations_user_lists (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    iid integer NOT NULL,
    name character varying(255) NOT NULL,
    user_xids text DEFAULT ''::text NOT NULL
);

CREATE SEQUENCE operations_user_lists_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE operations_user_lists_id_seq OWNED BY operations_user_lists.id;

CREATE TABLE organization_cluster_agent_mappings (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    cluster_agent_id bigint NOT NULL,
    creator_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE organization_cluster_agent_mappings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE organization_cluster_agent_mappings_id_seq OWNED BY organization_cluster_agent_mappings.id;

CREATE TABLE organization_detail_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE organization_details (
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    cached_markdown_version integer,
    description text,
    description_html text,
    avatar text,
    CONSTRAINT check_71dfb7807f CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_9fbd483b51 CHECK ((char_length(avatar) <= 255))
);

CREATE TABLE organization_push_rules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    organization_id bigint NOT NULL,
    max_file_size integer DEFAULT 0 NOT NULL,
    member_check boolean DEFAULT false NOT NULL,
    prevent_secrets boolean DEFAULT false NOT NULL,
    commit_committer_name_check boolean DEFAULT false NOT NULL,
    deny_delete_tag boolean,
    reject_unsigned_commits boolean,
    commit_committer_check boolean,
    reject_non_dco_commits boolean,
    commit_message_regex text,
    branch_name_regex text,
    commit_message_negative_regex text,
    author_email_regex text,
    file_name_regex text,
    CONSTRAINT author_email_regex_size_constraint CHECK ((char_length(author_email_regex) <= 511)),
    CONSTRAINT branch_name_regex_size_constraint CHECK ((char_length(branch_name_regex) <= 511)),
    CONSTRAINT commit_message_negative_regex_size_constraint CHECK ((char_length(commit_message_negative_regex) <= 2047)),
    CONSTRAINT commit_message_regex_size_constraint CHECK ((char_length(commit_message_regex) <= 511)),
    CONSTRAINT file_name_regex_size_constraint CHECK ((char_length(file_name_regex) <= 511))
);

CREATE SEQUENCE organization_push_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE organization_push_rules_id_seq OWNED BY organization_push_rules.id;

CREATE TABLE organization_settings (
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    settings jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE TABLE organization_user_aliases (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    user_id bigint NOT NULL,
    username character varying NOT NULL,
    display_name character varying,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE organization_user_aliases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE organization_user_aliases_id_seq OWNED BY organization_user_aliases.id;

CREATE TABLE organization_user_details (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    user_id bigint NOT NULL,
    username text NOT NULL,
    display_name text NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_470dbccf9b CHECK ((char_length(display_name) <= 510)),
    CONSTRAINT check_dc5e9cf6f2 CHECK ((char_length(username) <= 510))
);

CREATE SEQUENCE organization_user_details_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE organization_user_details_id_seq OWNED BY organization_user_details.id;

CREATE TABLE organization_users (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    access_level smallint DEFAULT 10 NOT NULL
);

CREATE SEQUENCE organization_users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE organization_users_id_seq OWNED BY organization_users.id;

CREATE TABLE organizations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text DEFAULT ''::text NOT NULL,
    path text NOT NULL,
    visibility_level smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_0b4296b5ea CHECK ((char_length(path) <= 255)),
    CONSTRAINT check_d130d769e0 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE organizations_id_seq
    START WITH 1000
    INCREMENT BY 1
    MINVALUE 1000
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE organizations_id_seq OWNED BY organizations.id;

CREATE SEQUENCE p_ai_active_context_code_enabled_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ai_active_context_code_enabled_namespaces_id_seq OWNED BY p_ai_active_context_code_enabled_namespaces.id;

CREATE SEQUENCE p_ai_active_context_code_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ai_active_context_code_repositories_id_seq OWNED BY p_ai_active_context_code_repositories.id;

CREATE SEQUENCE p_batched_git_ref_updates_deletions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_batched_git_ref_updates_deletions_id_seq OWNED BY p_batched_git_ref_updates_deletions.id;

CREATE SEQUENCE p_catalog_resource_sync_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_catalog_resource_sync_events_id_seq OWNED BY p_catalog_resource_sync_events.id;

CREATE SEQUENCE p_ci_build_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ci_build_tags_id_seq OWNED BY p_ci_build_tags.id;

CREATE SEQUENCE p_ci_builds_execution_configs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ci_builds_execution_configs_id_seq OWNED BY p_ci_builds_execution_configs.id;

CREATE SEQUENCE p_ci_job_annotations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ci_job_annotations_id_seq OWNED BY p_ci_job_annotations.id;

CREATE SEQUENCE p_ci_job_inputs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ci_job_inputs_id_seq OWNED BY p_ci_job_inputs.id;

CREATE SEQUENCE p_ci_workloads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_ci_workloads_id_seq OWNED BY p_ci_workloads.id;

CREATE SEQUENCE p_duo_workflows_checkpoints_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_duo_workflows_checkpoints_id_seq OWNED BY p_duo_workflows_checkpoints.id;

CREATE SEQUENCE p_knowledge_graph_enabled_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_knowledge_graph_enabled_namespaces_id_seq OWNED BY p_knowledge_graph_enabled_namespaces.id;

CREATE SEQUENCE p_knowledge_graph_replicas_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_knowledge_graph_replicas_id_seq OWNED BY p_knowledge_graph_replicas.id;

CREATE SEQUENCE p_knowledge_graph_tasks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE p_knowledge_graph_tasks_id_seq OWNED BY p_knowledge_graph_tasks.id;

CREATE TABLE packages_build_infos (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    pipeline_id bigint,
    project_id bigint,
    CONSTRAINT check_d979c653e1 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_build_infos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_build_infos_id_seq OWNED BY packages_build_infos.id;

CREATE TABLE packages_cleanup_policies (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    next_run_at timestamp with time zone,
    keep_n_duplicated_package_files text DEFAULT 'all'::text NOT NULL,
    CONSTRAINT check_e53f35ab7b CHECK ((char_length(keep_n_duplicated_package_files) <= 255))
);

CREATE TABLE packages_composer_metadata (
    package_id bigint NOT NULL,
    target_sha bytea NOT NULL,
    composer_json jsonb DEFAULT '{}'::jsonb NOT NULL,
    version_cache_sha bytea,
    project_id bigint,
    CONSTRAINT check_250f62a87a CHECK ((project_id IS NOT NULL))
);

CREATE TABLE packages_packages (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name character varying NOT NULL,
    version character varying,
    package_type smallint NOT NULL,
    creator_id bigint,
    status smallint DEFAULT 0 NOT NULL,
    last_downloaded_at timestamp with time zone,
    status_message text
);

CREATE SEQUENCE packages_packages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_packages_id_seq OWNED BY packages_packages.id;

CREATE TABLE packages_composer_packages (
    id bigint DEFAULT nextval('packages_packages_id_seq'::regclass) NOT NULL,
    project_id bigint NOT NULL,
    creator_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    last_downloaded_at timestamp with time zone,
    status smallint DEFAULT 0 NOT NULL,
    name text NOT NULL,
    version text,
    target_sha bytea,
    version_cache_sha bytea,
    status_message text,
    composer_json jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT check_2168170eb8 CHECK ((char_length(status_message) <= 255))
);

CREATE TABLE packages_conan_file_metadata (
    id bigint NOT NULL,
    package_file_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    conan_file_type smallint NOT NULL,
    recipe_revision_id bigint,
    package_revision_id bigint,
    package_reference_id bigint,
    project_id bigint,
    CONSTRAINT check_7a4526796d CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_conan_file_metadata_ref_null_for_recipe_files CHECK ((NOT ((conan_file_type = 1) AND (package_reference_id IS NOT NULL))))
);

CREATE SEQUENCE packages_conan_file_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_conan_file_metadata_id_seq OWNED BY packages_conan_file_metadata.id;

CREATE TABLE packages_conan_metadata (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_username character varying(255) NOT NULL,
    package_channel character varying(255) NOT NULL,
    project_id bigint,
    CONSTRAINT check_9cda5a20a8 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_conan_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_conan_metadata_id_seq OWNED BY packages_conan_metadata.id;

CREATE TABLE packages_conan_package_references (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    project_id bigint NOT NULL,
    recipe_revision_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    reference bytea NOT NULL,
    info jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT chk_conan_references_info_length CHECK ((char_length((info)::text) <= 20000))
);

CREATE SEQUENCE packages_conan_package_references_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_conan_package_references_id_seq OWNED BY packages_conan_package_references.id;

CREATE TABLE packages_conan_package_revisions (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    project_id bigint NOT NULL,
    package_reference_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    revision bytea NOT NULL
);

CREATE SEQUENCE packages_conan_package_revisions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_conan_package_revisions_id_seq OWNED BY packages_conan_package_revisions.id;

CREATE TABLE packages_conan_recipe_revisions (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    revision bytea NOT NULL
);

CREATE SEQUENCE packages_conan_recipe_revisions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_conan_recipe_revisions_id_seq OWNED BY packages_conan_recipe_revisions.id;

CREATE TABLE packages_debian_file_metadata (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_file_id bigint NOT NULL,
    file_type smallint NOT NULL,
    component text,
    architecture text,
    fields jsonb,
    project_id bigint,
    CONSTRAINT check_2ebedda4b6 CHECK ((char_length(component) <= 255)),
    CONSTRAINT check_58297dfb13 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_e6e1fffcca CHECK ((char_length(architecture) <= 255))
);

CREATE TABLE packages_debian_group_architectures (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    distribution_id bigint NOT NULL,
    name text NOT NULL,
    group_id bigint,
    CONSTRAINT check_7a087a5b9f CHECK ((group_id IS NOT NULL)),
    CONSTRAINT check_ddb220164a CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE packages_debian_group_architectures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_group_architectures_id_seq OWNED BY packages_debian_group_architectures.id;

CREATE TABLE packages_debian_group_component_files (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    component_id bigint NOT NULL,
    architecture_id bigint,
    size integer NOT NULL,
    file_type smallint NOT NULL,
    compression_type smallint,
    file_store smallint DEFAULT 1 NOT NULL,
    file text NOT NULL,
    file_sha256 bytea NOT NULL,
    group_id bigint,
    CONSTRAINT check_6d7454a717 CHECK ((group_id IS NOT NULL)),
    CONSTRAINT check_839e1685bc CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE packages_debian_group_component_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_group_component_files_id_seq OWNED BY packages_debian_group_component_files.id;

CREATE TABLE packages_debian_group_components (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    distribution_id bigint NOT NULL,
    name text NOT NULL,
    group_id bigint,
    CONSTRAINT check_a9bc7d85be CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_bb77e71a15 CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE packages_debian_group_components_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_group_components_id_seq OWNED BY packages_debian_group_components.id;

CREATE TABLE packages_debian_group_distribution_keys (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    distribution_id bigint NOT NULL,
    encrypted_private_key text NOT NULL,
    encrypted_private_key_iv text NOT NULL,
    encrypted_passphrase text NOT NULL,
    encrypted_passphrase_iv text NOT NULL,
    public_key text NOT NULL,
    fingerprint text NOT NULL,
    group_id bigint,
    CONSTRAINT check_008dba9ceb CHECK ((group_id IS NOT NULL)),
    CONSTRAINT check_bc95dc3fbe CHECK ((char_length(fingerprint) <= 255)),
    CONSTRAINT check_f708183491 CHECK ((char_length(public_key) <= 524288))
);

CREATE SEQUENCE packages_debian_group_distribution_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_group_distribution_keys_id_seq OWNED BY packages_debian_group_distribution_keys.id;

CREATE TABLE packages_debian_group_distributions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    creator_id bigint,
    valid_time_duration_seconds integer,
    file_store smallint DEFAULT 1 NOT NULL,
    automatic boolean DEFAULT true NOT NULL,
    automatic_upgrades boolean DEFAULT false NOT NULL,
    codename text NOT NULL,
    suite text,
    origin text,
    label text,
    version text,
    description text,
    file text,
    file_signature text,
    signed_file text,
    signed_file_store smallint DEFAULT 1 NOT NULL,
    CONSTRAINT check_0007e0bf61 CHECK ((char_length(signed_file) <= 255)),
    CONSTRAINT check_310ac457b8 CHECK ((char_length(description) <= 255)),
    CONSTRAINT check_3d6f87fc31 CHECK ((char_length(file_signature) <= 4096)),
    CONSTRAINT check_3fdadf4a0c CHECK ((char_length(version) <= 255)),
    CONSTRAINT check_590e18405a CHECK ((char_length(codename) <= 255)),
    CONSTRAINT check_b057cd840a CHECK ((char_length(origin) <= 255)),
    CONSTRAINT check_be5ed8d307 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_d3244bfc0b CHECK ((char_length(label) <= 255)),
    CONSTRAINT check_e7c928a24b CHECK ((char_length(suite) <= 255))
);

CREATE SEQUENCE packages_debian_group_distributions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_group_distributions_id_seq OWNED BY packages_debian_group_distributions.id;

CREATE TABLE packages_debian_project_architectures (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    distribution_id bigint NOT NULL,
    name text NOT NULL,
    project_id bigint,
    CONSTRAINT check_9c2e1c99d8 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_e187c75bb4 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_debian_project_architectures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_project_architectures_id_seq OWNED BY packages_debian_project_architectures.id;

CREATE TABLE packages_debian_project_component_files (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    component_id bigint NOT NULL,
    architecture_id bigint,
    size integer NOT NULL,
    file_type smallint NOT NULL,
    compression_type smallint,
    file_store smallint DEFAULT 1 NOT NULL,
    file text NOT NULL,
    file_sha256 bytea NOT NULL,
    project_id bigint,
    CONSTRAINT check_4eafc9503d CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_e5af03fa2d CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE packages_debian_project_component_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_project_component_files_id_seq OWNED BY packages_debian_project_component_files.id;

CREATE TABLE packages_debian_project_components (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    distribution_id bigint NOT NULL,
    name text NOT NULL,
    project_id bigint,
    CONSTRAINT check_517559f298 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_6c727037a7 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_debian_project_components_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_project_components_id_seq OWNED BY packages_debian_project_components.id;

CREATE TABLE packages_debian_project_distribution_keys (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    distribution_id bigint NOT NULL,
    encrypted_private_key text NOT NULL,
    encrypted_private_key_iv text NOT NULL,
    encrypted_passphrase text NOT NULL,
    encrypted_passphrase_iv text NOT NULL,
    public_key text NOT NULL,
    fingerprint text NOT NULL,
    project_id bigint,
    CONSTRAINT check_9e8a5eef0a CHECK ((char_length(fingerprint) <= 255)),
    CONSTRAINT check_c2a4dc05d5 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_d188f6547f CHECK ((char_length(public_key) <= 524288))
);

CREATE SEQUENCE packages_debian_project_distribution_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_project_distribution_keys_id_seq OWNED BY packages_debian_project_distribution_keys.id;

CREATE TABLE packages_debian_project_distributions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    creator_id bigint,
    valid_time_duration_seconds integer,
    file_store smallint DEFAULT 1 NOT NULL,
    automatic boolean DEFAULT true NOT NULL,
    automatic_upgrades boolean DEFAULT false NOT NULL,
    codename text NOT NULL,
    suite text,
    origin text,
    label text,
    version text,
    description text,
    file text,
    file_signature text,
    signed_file text,
    signed_file_store smallint DEFAULT 1 NOT NULL,
    CONSTRAINT check_6177ccd4a6 CHECK ((char_length(origin) <= 255)),
    CONSTRAINT check_6f6b55a4c4 CHECK ((char_length(label) <= 255)),
    CONSTRAINT check_834dabadb6 CHECK ((char_length(codename) <= 255)),
    CONSTRAINT check_96965792c2 CHECK ((char_length(version) <= 255)),
    CONSTRAINT check_9e5e22b7ff CHECK ((char_length(signed_file) <= 255)),
    CONSTRAINT check_a56ae58a17 CHECK ((char_length(suite) <= 255)),
    CONSTRAINT check_a5a2ac6af2 CHECK ((char_length(file_signature) <= 4096)),
    CONSTRAINT check_b93154339f CHECK ((char_length(description) <= 255)),
    CONSTRAINT check_cb4ac9599e CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE packages_debian_project_distributions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_project_distributions_id_seq OWNED BY packages_debian_project_distributions.id;

CREATE TABLE packages_debian_publications (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    distribution_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_30a36cda06 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_debian_publications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_debian_publications_id_seq OWNED BY packages_debian_publications.id;

CREATE TABLE packages_dependencies (
    id bigint NOT NULL,
    name character varying(255) NOT NULL,
    version_pattern character varying(255) NOT NULL,
    project_id bigint,
    CONSTRAINT check_83faf1f5e7 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_dependencies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_dependencies_id_seq OWNED BY packages_dependencies.id;

CREATE TABLE packages_dependency_links (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    dependency_id bigint NOT NULL,
    dependency_type smallint NOT NULL,
    project_id bigint,
    CONSTRAINT check_dea82eaa8e CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_dependency_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_dependency_links_id_seq OWNED BY packages_dependency_links.id;

CREATE TABLE packages_helm_file_metadata (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_file_id bigint NOT NULL,
    channel text NOT NULL,
    metadata jsonb,
    project_id bigint,
    CONSTRAINT check_06e8d100af CHECK ((char_length(channel) <= 255)),
    CONSTRAINT check_109d878e47 CHECK ((project_id IS NOT NULL))
);

CREATE TABLE packages_helm_metadata_caches (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    last_downloaded_at timestamp with time zone,
    project_id bigint NOT NULL,
    size integer NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    file_store integer DEFAULT 1,
    channel text NOT NULL,
    file text NOT NULL,
    object_storage_key text NOT NULL,
    CONSTRAINT check_1ad8e76464 CHECK ((char_length(object_storage_key) <= 255)),
    CONSTRAINT check_471469b475 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_9b1333efe0 CHECK ((char_length(channel) <= 255))
);

CREATE SEQUENCE packages_helm_metadata_caches_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_helm_metadata_caches_id_seq OWNED BY packages_helm_metadata_caches.id;

CREATE TABLE packages_maven_metadata (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    app_group character varying NOT NULL,
    app_name character varying NOT NULL,
    app_version character varying,
    path character varying(512) NOT NULL,
    project_id bigint,
    CONSTRAINT check_bf287ce98c CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_maven_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_maven_metadata_id_seq OWNED BY packages_maven_metadata.id;

CREATE TABLE packages_npm_metadata (
    package_id bigint NOT NULL,
    package_json jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_8d2e047947 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT chk_rails_e5cbc301ae CHECK ((char_length((package_json)::text) < 20000))
);

CREATE TABLE packages_npm_metadata_caches (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    last_downloaded_at timestamp with time zone,
    project_id bigint,
    file_store integer DEFAULT 1,
    size integer NOT NULL,
    file text NOT NULL,
    package_name text NOT NULL,
    object_storage_key text NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_57aa07a4b2 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_734454a615 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_f97c15aa60 CHECK ((char_length(object_storage_key) <= 255))
);

CREATE SEQUENCE packages_npm_metadata_caches_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_npm_metadata_caches_id_seq OWNED BY packages_npm_metadata_caches.id;

CREATE TABLE packages_nuget_dependency_link_metadata (
    dependency_link_id bigint NOT NULL,
    target_framework text NOT NULL,
    project_id bigint,
    CONSTRAINT check_1c3e07cfff CHECK ((project_id IS NOT NULL)),
    CONSTRAINT packages_nuget_dependency_link_metadata_target_framework_constr CHECK ((char_length(target_framework) <= 255))
);

CREATE TABLE packages_nuget_metadata (
    package_id bigint NOT NULL,
    license_url text,
    project_url text,
    icon_url text,
    authors text,
    description text,
    normalized_version text,
    project_id bigint,
    CONSTRAINT check_6b272cad10 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_9973c0cc33 CHECK ((char_length(normalized_version) <= 255)),
    CONSTRAINT check_d39a5fe9ee CHECK ((char_length(description) <= 4000)),
    CONSTRAINT check_e2fc129ebd CHECK ((char_length(authors) <= 255)),
    CONSTRAINT packages_nuget_metadata_icon_url_constraint CHECK ((char_length(icon_url) <= 255)),
    CONSTRAINT packages_nuget_metadata_license_url_constraint CHECK ((char_length(license_url) <= 255)),
    CONSTRAINT packages_nuget_metadata_project_url_constraint CHECK ((char_length(project_url) <= 255))
);

CREATE TABLE packages_nuget_symbols (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_id bigint,
    size integer NOT NULL,
    file_store smallint DEFAULT 1,
    file text NOT NULL,
    file_path text NOT NULL,
    signature text NOT NULL,
    object_storage_key text NOT NULL,
    file_sha256 bytea,
    status smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_0e93ca58b7 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_28b82b08fa CHECK ((char_length(object_storage_key) <= 255)),
    CONSTRAINT check_30b0ef2ca2 CHECK ((char_length(file_path) <= 255)),
    CONSTRAINT check_7a67b0fc8b CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_8dc7152679 CHECK ((char_length(signature) <= 255))
);

CREATE SEQUENCE packages_nuget_symbols_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_nuget_symbols_id_seq OWNED BY packages_nuget_symbols.id;

CREATE TABLE packages_package_file_build_infos (
    id bigint NOT NULL,
    package_file_id bigint NOT NULL,
    pipeline_id bigint,
    project_id bigint,
    CONSTRAINT check_102fc16781 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_package_file_build_infos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_package_file_build_infos_id_seq OWNED BY packages_package_file_build_infos.id;

CREATE TABLE packages_package_files (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    size bigint,
    file_store integer DEFAULT 1,
    file_md5 bytea,
    file_sha1 bytea,
    file_name character varying NOT NULL,
    file text NOT NULL,
    file_sha256 bytea,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    verification_failure character varying(255),
    verification_retry_count integer,
    verification_checksum bytea,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_started_at timestamp with time zone,
    status smallint DEFAULT 0 NOT NULL,
    file_final_path text,
    project_id bigint,
    CONSTRAINT check_0f29938b18 CHECK ((char_length(file_final_path) <= 1024)),
    CONSTRAINT check_43773f06dc CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL))
);

CREATE SEQUENCE packages_package_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_package_files_id_seq OWNED BY packages_package_files.id;

CREATE TABLE packages_protection_rules (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_type smallint NOT NULL,
    package_name_pattern text NOT NULL,
    minimum_access_level_for_push smallint,
    minimum_access_level_for_delete smallint,
    CONSTRAINT check_520a0596a3 CHECK ((num_nonnulls(minimum_access_level_for_delete, minimum_access_level_for_push) > 0)),
    CONSTRAINT check_d2d75d206d CHECK ((char_length(package_name_pattern) <= 255))
);

CREATE SEQUENCE packages_protection_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_protection_rules_id_seq OWNED BY packages_protection_rules.id;

CREATE TABLE packages_pypi_metadata (
    package_id bigint NOT NULL,
    required_python text DEFAULT ''::text,
    metadata_version text,
    summary text,
    keywords text,
    author_email text,
    description text,
    description_content_type text,
    project_id bigint,
    CONSTRAINT check_0d9aed55b2 CHECK ((required_python IS NOT NULL)),
    CONSTRAINT check_222e4f5b58 CHECK ((char_length(keywords) <= 1024)),
    CONSTRAINT check_2d3ed32225 CHECK ((char_length(metadata_version) <= 16)),
    CONSTRAINT check_379019d5da CHECK ((char_length(required_python) <= 255)),
    CONSTRAINT check_65d8dbbd9f CHECK ((char_length(author_email) <= 2048)),
    CONSTRAINT check_76afb6d4f3 CHECK ((char_length(summary) <= 255)),
    CONSTRAINT check_77e2d63abb CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_80308aa9bd CHECK ((char_length(description) <= 4000)),
    CONSTRAINT check_b1f32be96c CHECK ((char_length(description_content_type) <= 128))
);

CREATE TABLE packages_rpm_metadata (
    package_id bigint NOT NULL,
    release text DEFAULT '1'::text NOT NULL,
    summary text DEFAULT ''::text NOT NULL,
    description text DEFAULT ''::text NOT NULL,
    arch text DEFAULT ''::text NOT NULL,
    license text,
    url text,
    epoch integer DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_3798bae3d6 CHECK ((char_length(arch) <= 255)),
    CONSTRAINT check_4506c26fc1 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_5d29ba59ac CHECK ((char_length(description) <= 5000)),
    CONSTRAINT check_6e8cbd536d CHECK ((char_length(url) <= 1000)),
    CONSTRAINT check_845ba4d7d0 CHECK ((char_length(license) <= 1000)),
    CONSTRAINT check_b010bf4870 CHECK ((char_length(summary) <= 1000)),
    CONSTRAINT check_c3e2fc2e89 CHECK ((char_length(release) <= 128))
);

CREATE TABLE packages_rpm_repository_files (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    file_store integer DEFAULT 1,
    status smallint DEFAULT 0 NOT NULL,
    size integer,
    file_md5 bytea,
    file_sha1 bytea,
    file_sha256 bytea,
    file text NOT NULL,
    file_name text NOT NULL,
    CONSTRAINT check_a9fef187f5 CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_b6b721b275 CHECK ((char_length(file_name) <= 255))
);

CREATE SEQUENCE packages_rpm_repository_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_rpm_repository_files_id_seq OWNED BY packages_rpm_repository_files.id;

CREATE TABLE packages_rubygems_metadata (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_id bigint NOT NULL,
    authors text,
    files text,
    summary text,
    description text,
    email text,
    homepage text,
    licenses text,
    metadata text,
    author text,
    bindir text,
    cert_chain text,
    executables text,
    extensions text,
    extra_rdoc_files text,
    platform text,
    post_install_message text,
    rdoc_options text,
    require_paths text,
    required_ruby_version text,
    required_rubygems_version text,
    requirements text,
    rubygems_version text,
    signing_key text,
    project_id bigint,
    CONSTRAINT check_0154a18c82 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_22814c771b CHECK ((char_length(email) <= 255)),
    CONSTRAINT check_242293030e CHECK ((char_length(extensions) <= 255)),
    CONSTRAINT check_27619a7922 CHECK ((char_length(rubygems_version) <= 255)),
    CONSTRAINT check_3d1b6f3a39 CHECK ((char_length(post_install_message) <= 255)),
    CONSTRAINT check_545f7606f9 CHECK ((char_length(required_rubygems_version) <= 255)),
    CONSTRAINT check_5988451714 CHECK ((char_length(executables) <= 255)),
    CONSTRAINT check_5f9c84ea17 CHECK ((char_length(platform) <= 255)),
    CONSTRAINT check_64f1cecf05 CHECK ((char_length(requirements) <= 255)),
    CONSTRAINT check_6ac7043c50 CHECK ((char_length(extra_rdoc_files) <= 255)),
    CONSTRAINT check_6ff3abe325 CHECK ((char_length(cert_chain) <= 255)),
    CONSTRAINT check_7cb01436df CHECK ((char_length(licenses) <= 255)),
    CONSTRAINT check_8be21d92e7 CHECK ((char_length(summary) <= 1024)),
    CONSTRAINT check_946cb96acb CHECK ((char_length(homepage) <= 255)),
    CONSTRAINT check_9824fc9efc CHECK ((char_length(bindir) <= 255)),
    CONSTRAINT check_994b68eb64 CHECK ((char_length(authors) <= 255)),
    CONSTRAINT check_9d42fa48ae CHECK ((char_length(signing_key) <= 255)),
    CONSTRAINT check_b0f4f8c853 CHECK ((char_length(files) <= 255)),
    CONSTRAINT check_b7b296b420 CHECK ((char_length(author) <= 255)),
    CONSTRAINT check_bf16b21a47 CHECK ((char_length(rdoc_options) <= 255)),
    CONSTRAINT check_ca641a3354 CHECK ((char_length(required_ruby_version) <= 255)),
    CONSTRAINT check_e7009bea46 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_ea02f4800f CHECK ((char_length(metadata) <= 30000)),
    CONSTRAINT check_f76bad1a9a CHECK ((char_length(require_paths) <= 255))
);

CREATE TABLE packages_tags (
    id bigint NOT NULL,
    package_id bigint NOT NULL,
    name character varying(255) NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_91b8472153 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE packages_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE packages_tags_id_seq OWNED BY packages_tags.id;

CREATE TABLE packages_terraform_module_metadata (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    package_id bigint NOT NULL,
    project_id bigint NOT NULL,
    fields jsonb NOT NULL,
    semver_major integer,
    semver_minor integer,
    semver_prerelease text,
    semver_patch bigint,
    CONSTRAINT check_46aa6c883a CHECK ((char_length(semver_prerelease) <= 255)),
    CONSTRAINT chk_rails_49f7b485ae CHECK ((char_length((fields)::text) <= 10485760))
);

CREATE TABLE pages_deployment_states (
    pages_deployment_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    project_id bigint,
    CONSTRAINT check_15217e8c3a CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE pages_deployment_states_pages_deployment_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pages_deployment_states_pages_deployment_id_seq OWNED BY pages_deployment_states.pages_deployment_id;

CREATE TABLE pages_deployments (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    ci_build_id bigint,
    file_store smallint NOT NULL,
    file text NOT NULL,
    file_count integer NOT NULL,
    file_sha256 bytea NOT NULL,
    size bigint,
    root_directory text DEFAULT 'public'::text,
    path_prefix text,
    build_ref text,
    deleted_at timestamp with time zone,
    upload_ready boolean DEFAULT false,
    expires_at timestamp with time zone,
    CONSTRAINT check_4d04b8dc9a CHECK ((char_length(path_prefix) <= 128)),
    CONSTRAINT check_5f9132a958 CHECK ((size IS NOT NULL)),
    CONSTRAINT check_7e938c810a CHECK ((char_length(root_directory) <= 255)),
    CONSTRAINT check_b44e900e5c CHECK ((char_length(build_ref) <= 512)),
    CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE pages_deployments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pages_deployments_id_seq OWNED BY pages_deployments.id;

CREATE TABLE pages_domain_acme_orders (
    id bigint NOT NULL,
    pages_domain_id bigint NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    url character varying NOT NULL,
    challenge_token character varying NOT NULL,
    challenge_file_content text NOT NULL,
    encrypted_private_key text NOT NULL,
    encrypted_private_key_iv text NOT NULL,
    project_id bigint,
    CONSTRAINT check_07cb634b65 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE pages_domain_acme_orders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pages_domain_acme_orders_id_seq OWNED BY pages_domain_acme_orders.id;

CREATE TABLE pages_domains (
    id bigint NOT NULL,
    project_id bigint,
    certificate text,
    encrypted_key text,
    encrypted_key_iv character varying,
    encrypted_key_salt character varying,
    domain character varying,
    verified_at timestamp with time zone,
    verification_code character varying NOT NULL,
    enabled_until timestamp with time zone,
    remove_at timestamp with time zone,
    auto_ssl_enabled boolean DEFAULT false NOT NULL,
    certificate_valid_not_before timestamp with time zone,
    certificate_valid_not_after timestamp with time zone,
    certificate_source smallint DEFAULT 0 NOT NULL,
    wildcard boolean DEFAULT false NOT NULL,
    usage smallint DEFAULT 0 NOT NULL,
    scope smallint DEFAULT 2 NOT NULL,
    auto_ssl_failed boolean DEFAULT false NOT NULL,
    CONSTRAINT check_790fbb64fa CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE pages_domains_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pages_domains_id_seq OWNED BY pages_domains.id;

CREATE TABLE path_locks (
    id bigint NOT NULL,
    path character varying NOT NULL,
    project_id bigint,
    user_id bigint,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    CONSTRAINT check_e1de2eb0f1 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE path_locks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE path_locks_id_seq OWNED BY path_locks.id;

CREATE TABLE personal_access_token_last_used_ips (
    id bigint NOT NULL,
    personal_access_token_id bigint NOT NULL,
    organization_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    ip_address inet
);

CREATE SEQUENCE personal_access_token_last_used_ips_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE personal_access_token_last_used_ips_id_seq OWNED BY personal_access_token_last_used_ips.id;

CREATE TABLE personal_access_tokens (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    name character varying NOT NULL,
    revoked boolean DEFAULT false,
    expires_at date,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    scopes character varying DEFAULT '--- []
'::character varying NOT NULL,
    impersonation boolean DEFAULT false NOT NULL,
    token_digest character varying,
    expire_notification_delivered boolean DEFAULT false NOT NULL,
    last_used_at timestamp with time zone,
    after_expiry_notification_delivered boolean DEFAULT false NOT NULL,
    previous_personal_access_token_id bigint,
    organization_id bigint NOT NULL,
    seven_days_notification_sent_at timestamp with time zone,
    thirty_days_notification_sent_at timestamp with time zone,
    sixty_days_notification_sent_at timestamp with time zone,
    description text,
    CONSTRAINT check_6d2ddc9355 CHECK ((char_length(description) <= 255))
);

CREATE SEQUENCE personal_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE personal_access_tokens_id_seq OWNED BY personal_access_tokens.id;

CREATE TABLE snippet_repositories (
    snippet_id bigint NOT NULL,
    shard_id bigint NOT NULL,
    disk_path character varying(80) NOT NULL,
    verification_retry_count smallint,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    verification_checksum bytea,
    verification_failure text,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_started_at timestamp with time zone,
    snippet_project_id bigint,
    snippet_organization_id bigint,
    CONSTRAINT snippet_repositories_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255))
);

CREATE TABLE snippets (
    id bigint NOT NULL,
    title character varying,
    content text,
    author_id bigint NOT NULL,
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    file_name character varying,
    type character varying,
    visibility_level integer DEFAULT 0 NOT NULL,
    title_html text,
    content_html text,
    cached_markdown_version integer,
    description text,
    description_html text,
    encrypted_secret_token character varying(255),
    encrypted_secret_token_iv character varying(255),
    secret boolean DEFAULT false NOT NULL,
    repository_read_only boolean DEFAULT false NOT NULL,
    imported_from smallint DEFAULT 0 NOT NULL,
    organization_id bigint,
    CONSTRAINT check_82c1d40fab CHECK ((num_nonnulls(organization_id, project_id) = 1))
);

CREATE VIEW personal_snippets_view AS
 SELECT sn.id,
    sh.name AS repository_storage,
    sr.disk_path
   FROM ((snippets sn
     JOIN snippet_repositories sr ON (((sn.id = sr.snippet_id) AND ((sn.type)::text = 'PersonalSnippet'::text))))
     JOIN shards sh ON ((sr.shard_id = sh.id)));

CREATE TABLE pipl_users (
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    initial_email_sent_at timestamp with time zone,
    last_access_from_pipl_country_at timestamp with time zone NOT NULL,
    state smallint DEFAULT 0 NOT NULL
);

CREATE TABLE plan_limits (
    id bigint NOT NULL,
    plan_id bigint NOT NULL,
    ci_pipeline_size integer DEFAULT 0 NOT NULL,
    ci_active_jobs integer DEFAULT 0 NOT NULL,
    project_hooks integer DEFAULT 100 NOT NULL,
    group_hooks integer DEFAULT 50 NOT NULL,
    ci_project_subscriptions integer DEFAULT 2 NOT NULL,
    ci_pipeline_schedules integer DEFAULT 10 NOT NULL,
    offset_pagination_limit integer DEFAULT 50000 NOT NULL,
    ci_instance_level_variables integer DEFAULT 25 NOT NULL,
    storage_size_limit integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_lsif integer DEFAULT 200 NOT NULL,
    ci_max_artifact_size_archive integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_metadata integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_trace integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_junit integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_sast integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_dependency_scanning integer DEFAULT 350 NOT NULL,
    ci_max_artifact_size_container_scanning integer DEFAULT 150 NOT NULL,
    ci_max_artifact_size_dast integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_codequality integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_license_management integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_license_scanning integer DEFAULT 100 NOT NULL,
    ci_max_artifact_size_performance integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_metrics integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_metrics_referee integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_network_referee integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_dotenv integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_cobertura integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_terraform integer DEFAULT 5 NOT NULL,
    ci_max_artifact_size_accessibility integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_cluster_applications integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_secret_detection integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_requirements integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_coverage_fuzzing integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_browser_performance integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_load_performance integer DEFAULT 0 NOT NULL,
    ci_needs_size_limit integer DEFAULT 50 NOT NULL,
    conan_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
    maven_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
    npm_max_file_size bigint DEFAULT 524288000 NOT NULL,
    nuget_max_file_size bigint DEFAULT 524288000 NOT NULL,
    pypi_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
    generic_packages_max_file_size bigint DEFAULT '5368709120'::bigint NOT NULL,
    golang_max_file_size bigint DEFAULT 104857600 NOT NULL,
    debian_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
    project_feature_flags integer DEFAULT 200 NOT NULL,
    ci_max_artifact_size_api_fuzzing integer DEFAULT 0 NOT NULL,
    ci_pipeline_deployments integer DEFAULT 500 NOT NULL,
    pull_mirror_interval_seconds integer DEFAULT 300 NOT NULL,
    daily_invites integer DEFAULT 0 NOT NULL,
    rubygems_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
    terraform_module_max_file_size bigint DEFAULT 1073741824 NOT NULL,
    helm_max_file_size bigint DEFAULT 5242880 NOT NULL,
    ci_registered_group_runners integer DEFAULT 1000 NOT NULL,
    ci_registered_project_runners integer DEFAULT 1000 NOT NULL,
    ci_daily_pipeline_schedule_triggers integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_running_container_scanning integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_cluster_image_scanning integer DEFAULT 0 NOT NULL,
    ci_jobs_trace_size_limit integer DEFAULT 100 NOT NULL,
    pages_file_entries integer DEFAULT 200000 NOT NULL,
    dast_profile_schedules integer DEFAULT 1 NOT NULL,
    external_audit_event_destinations integer DEFAULT 5 NOT NULL,
    dotenv_variables integer DEFAULT 20 NOT NULL,
    dotenv_size integer DEFAULT 5120 NOT NULL,
    pipeline_triggers integer DEFAULT 25000 NOT NULL,
    project_ci_secure_files integer DEFAULT 100 NOT NULL,
    repository_size bigint,
    security_policy_scan_execution_schedules integer DEFAULT 0 NOT NULL,
    web_hook_calls_mid integer DEFAULT 0 NOT NULL,
    web_hook_calls_low integer DEFAULT 0 NOT NULL,
    project_ci_variables integer DEFAULT 8000 NOT NULL,
    group_ci_variables integer DEFAULT 30000 NOT NULL,
    ci_max_artifact_size_cyclonedx integer DEFAULT 1 NOT NULL,
    rpm_max_file_size bigint DEFAULT '5368709120'::bigint NOT NULL,
    ci_max_artifact_size_requirements_v2 integer DEFAULT 0 NOT NULL,
    pipeline_hierarchy_size integer DEFAULT 1000 NOT NULL,
    enforcement_limit integer DEFAULT 0 NOT NULL,
    notification_limit integer DEFAULT 0 NOT NULL,
    dashboard_limit_enabled_at timestamp with time zone,
    web_hook_calls integer DEFAULT 0 NOT NULL,
    project_access_token_limit integer DEFAULT 0 NOT NULL,
    google_cloud_logging_configurations integer DEFAULT 5 NOT NULL,
    ml_model_max_file_size bigint DEFAULT '10737418240'::bigint NOT NULL,
    limits_history jsonb DEFAULT '{}'::jsonb NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    ci_max_artifact_size_annotations integer DEFAULT 0 NOT NULL,
    ci_job_annotations_size integer DEFAULT 81920 NOT NULL,
    ci_job_annotations_num integer DEFAULT 20 NOT NULL,
    file_size_limit_mb double precision DEFAULT 100.0 NOT NULL,
    audit_events_amazon_s3_configurations integer DEFAULT 5 NOT NULL,
    ci_max_artifact_size_repository_xray bigint DEFAULT 1073741824 NOT NULL,
    active_versioned_pages_deployments_limit_by_namespace integer DEFAULT 1000 NOT NULL,
    ci_max_artifact_size_jacoco bigint DEFAULT 0 NOT NULL,
    import_placeholder_user_limit_tier_1 integer DEFAULT 0 NOT NULL,
    import_placeholder_user_limit_tier_2 integer DEFAULT 0 NOT NULL,
    import_placeholder_user_limit_tier_3 integer DEFAULT 0 NOT NULL,
    import_placeholder_user_limit_tier_4 integer DEFAULT 0 NOT NULL,
    ci_max_artifact_size_slsa_provenance_statement bigint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE plan_limits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE plan_limits_id_seq OWNED BY plan_limits.id;

CREATE TABLE plans (
    id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    name character varying,
    title character varying
);

CREATE SEQUENCE plans_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE plans_id_seq OWNED BY plans.id;

CREATE TABLE pm_advisories (
    id bigint NOT NULL,
    advisory_xid text NOT NULL,
    published_date date NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    source_xid smallint NOT NULL,
    title text,
    description text,
    cvss_v2 text,
    cvss_v3 text,
    urls text[] DEFAULT '{}'::text[],
    identifiers jsonb NOT NULL,
    cve text,
    CONSTRAINT check_152def3868 CHECK ((char_length(cvss_v2) <= 128)),
    CONSTRAINT check_19cbd06439 CHECK ((char_length(advisory_xid) <= 36)),
    CONSTRAINT check_b1c980b212 CHECK ((char_length(cve) <= 24)),
    CONSTRAINT check_bed97fa77a CHECK ((char_length(cvss_v3) <= 128)),
    CONSTRAINT check_e4bfd3ffbf CHECK ((char_length(title) <= 256)),
    CONSTRAINT check_fee880f7aa CHECK ((char_length(description) <= 8192)),
    CONSTRAINT chk_rails_e73af9de76 CHECK ((cardinality(urls) <= 20))
);

CREATE SEQUENCE pm_advisories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_advisories_id_seq OWNED BY pm_advisories.id;

CREATE TABLE pm_affected_packages (
    id bigint NOT NULL,
    pm_advisory_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    purl_type smallint NOT NULL,
    package_name text NOT NULL,
    distro_version text DEFAULT ''::text NOT NULL,
    solution text,
    affected_range text NOT NULL,
    fixed_versions text[] DEFAULT '{}'::text[],
    overridden_advisory_fields jsonb DEFAULT '{}'::jsonb NOT NULL,
    versions jsonb DEFAULT '[]'::jsonb NOT NULL,
    CONSTRAINT check_5dd528a2be CHECK ((char_length(package_name) <= 256)),
    CONSTRAINT check_80dea16c7b CHECK ((char_length(affected_range) <= 512)),
    CONSTRAINT check_d1d4646298 CHECK ((char_length(solution) <= 2048)),
    CONSTRAINT check_ec4c8efb5e CHECK ((char_length(distro_version) <= 256)),
    CONSTRAINT chk_rails_a0f80d74e0 CHECK ((cardinality(fixed_versions) <= 10))
);

CREATE SEQUENCE pm_affected_packages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_affected_packages_id_seq OWNED BY pm_affected_packages.id;

CREATE TABLE pm_checkpoints (
    sequence integer NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    purl_type smallint NOT NULL,
    chunk smallint NOT NULL,
    data_type smallint DEFAULT 1 NOT NULL,
    version_format smallint DEFAULT 1 NOT NULL,
    id bigint NOT NULL
);

CREATE SEQUENCE pm_checkpoints_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_checkpoints_id_seq OWNED BY pm_checkpoints.id;

CREATE TABLE pm_cve_enrichment (
    id bigint NOT NULL,
    epss_score double precision NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    cve text NOT NULL,
    is_known_exploit boolean DEFAULT false NOT NULL,
    CONSTRAINT check_16651e3ffb CHECK ((char_length(cve) <= 24))
);

CREATE SEQUENCE pm_cve_enrichment_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_cve_enrichment_id_seq OWNED BY pm_cve_enrichment.id;

CREATE TABLE pm_licenses (
    id bigint NOT NULL,
    spdx_identifier text NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT check_c1eb81d1ba CHECK ((char_length(spdx_identifier) <= 50))
);

CREATE SEQUENCE pm_licenses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_licenses_id_seq OWNED BY pm_licenses.id;

CREATE TABLE pm_package_version_licenses (
    pm_package_version_id bigint NOT NULL,
    pm_license_id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    id bigint NOT NULL
);

CREATE SEQUENCE pm_package_version_licenses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_package_version_licenses_id_seq OWNED BY pm_package_version_licenses.id;

CREATE TABLE pm_package_versions (
    id bigint NOT NULL,
    pm_package_id bigint NOT NULL,
    version text NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT check_2d8a88cfcc CHECK ((char_length(version) <= 255))
);

CREATE SEQUENCE pm_package_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_package_versions_id_seq OWNED BY pm_package_versions.id;

CREATE TABLE pm_packages (
    id bigint NOT NULL,
    purl_type smallint NOT NULL,
    name text NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    licenses jsonb,
    CONSTRAINT check_3a3aedb8ba CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE pm_packages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pm_packages_id_seq OWNED BY pm_packages.id;

CREATE TABLE pool_repositories (
    id bigint NOT NULL,
    shard_id bigint NOT NULL,
    disk_path character varying,
    state character varying,
    source_project_id bigint
);

CREATE SEQUENCE pool_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE pool_repositories_id_seq OWNED BY pool_repositories.id;

CREATE TABLE postgres_async_foreign_key_validations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    table_name text NOT NULL,
    last_error text,
    attempts integer DEFAULT 0 NOT NULL,
    constraint_type smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_536a40afbf CHECK ((char_length(last_error) <= 10000)),
    CONSTRAINT check_74fb7c8e57 CHECK ((char_length(name) <= 63)),
    CONSTRAINT check_cd435d6301 CHECK ((char_length(table_name) <= 63))
);

CREATE SEQUENCE postgres_async_foreign_key_validations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE postgres_async_foreign_key_validations_id_seq OWNED BY postgres_async_foreign_key_validations.id;

CREATE TABLE postgres_async_indexes (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    definition text NOT NULL,
    table_name text NOT NULL,
    attempts integer DEFAULT 0 NOT NULL,
    last_error text,
    CONSTRAINT check_083b21157b CHECK ((char_length(definition) <= 2048)),
    CONSTRAINT check_45dc23c315 CHECK ((char_length(last_error) <= 10000)),
    CONSTRAINT check_b732c6cd1d CHECK ((char_length(name) <= 63)),
    CONSTRAINT check_schema_and_name_length CHECK ((char_length(table_name) <= 127))
);

CREATE SEQUENCE postgres_async_indexes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE postgres_async_indexes_id_seq OWNED BY postgres_async_indexes.id;

CREATE VIEW postgres_autovacuum_activity AS
 WITH processes AS (
         SELECT postgres_pg_stat_activity_autovacuum.query,
            postgres_pg_stat_activity_autovacuum.query_start,
            regexp_matches(postgres_pg_stat_activity_autovacuum.query, '^autovacuum: VACUUM (\w+)\.(\w+)'::text) AS matches,
                CASE
                    WHEN (postgres_pg_stat_activity_autovacuum.query ~~* '%wraparound)'::text) THEN true
                    ELSE false
                END AS wraparound_prevention
           FROM postgres_pg_stat_activity_autovacuum() postgres_pg_stat_activity_autovacuum(query, query_start)
          WHERE (postgres_pg_stat_activity_autovacuum.query ~* '^autovacuum: VACUUM \w+\.\w+'::text)
        )
 SELECT ((matches[1] || '.'::text) || matches[2]) AS table_identifier,
    matches[1] AS schema,
    matches[2] AS "table",
    query_start AS vacuum_start,
    wraparound_prevention
   FROM processes;

COMMENT ON VIEW postgres_autovacuum_activity IS 'Contains information about PostgreSQL backends currently performing autovacuum operations on the tables indicated here.';

CREATE VIEW postgres_constraints AS
 SELECT pg_constraint.oid,
    pg_constraint.conname AS name,
    pg_constraint.contype AS constraint_type,
    pg_constraint.convalidated AS constraint_valid,
    ( SELECT array_agg(pg_attribute.attname ORDER BY attnums.ordering) AS array_agg
           FROM (unnest(pg_constraint.conkey) WITH ORDINALITY attnums(attnum, ordering)
             JOIN pg_attribute ON (((pg_attribute.attnum = attnums.attnum) AND (pg_attribute.attrelid = pg_class.oid))))) AS column_names,
    (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS table_identifier,
    NULLIF(pg_constraint.conparentid, (0)::oid) AS parent_constraint_oid,
    pg_get_constraintdef(pg_constraint.oid) AS definition
   FROM ((pg_constraint
     JOIN pg_class ON ((pg_constraint.conrelid = pg_class.oid)))
     JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid)));

CREATE VIEW postgres_foreign_keys AS
 SELECT pg_constraint.oid,
    pg_constraint.conname AS name,
    (((constrained_namespace.nspname)::text || '.'::text) || (constrained_table.relname)::text) AS constrained_table_identifier,
    (((referenced_namespace.nspname)::text || '.'::text) || (referenced_table.relname)::text) AS referenced_table_identifier,
    (constrained_table.relname)::text AS constrained_table_name,
    (referenced_table.relname)::text AS referenced_table_name,
    constrained_cols.constrained_columns,
    referenced_cols.referenced_columns,
    pg_constraint.confdeltype AS on_delete_action,
    pg_constraint.confupdtype AS on_update_action,
    (pg_constraint.coninhcount > 0) AS is_inherited,
    pg_constraint.convalidated AS is_valid,
    partitioned_parent_oids.parent_oid
   FROM (((((((pg_constraint
     JOIN pg_class constrained_table ON ((constrained_table.oid = pg_constraint.conrelid)))
     JOIN pg_class referenced_table ON ((referenced_table.oid = pg_constraint.confrelid)))
     JOIN pg_namespace constrained_namespace ON ((constrained_table.relnamespace = constrained_namespace.oid)))
     JOIN pg_namespace referenced_namespace ON ((referenced_table.relnamespace = referenced_namespace.oid)))
     CROSS JOIN LATERAL ( SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) AS array_agg
           FROM (unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)
             JOIN pg_attribute ON (((pg_attribute.attnum = conkey.attnum) AND (pg_attribute.attrelid = constrained_table.oid))))) constrained_cols(constrained_columns))
     CROSS JOIN LATERAL ( SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx) AS array_agg
           FROM (unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)
             JOIN pg_attribute ON (((pg_attribute.attnum = confkey.attnum) AND (pg_attribute.attrelid = referenced_table.oid))))) referenced_cols(referenced_columns))
     LEFT JOIN LATERAL ( SELECT pg_depend.refobjid AS parent_oid
           FROM pg_depend
          WHERE ((pg_depend.objid = pg_constraint.oid) AND (pg_depend.deptype = 'P'::"char") AND (pg_depend.refobjid IN ( SELECT pg_constraint_1.oid
                   FROM pg_constraint pg_constraint_1
                  WHERE (pg_constraint_1.contype = 'f'::"char"))))
         LIMIT 1) partitioned_parent_oids(parent_oid) ON (true))
  WHERE (pg_constraint.contype = 'f'::"char");

CREATE VIEW postgres_index_bloat_estimates AS
 SELECT (((nspname)::text || '.'::text) || (idxname)::text) AS identifier,
    (
        CASE
            WHEN ((relpages)::double precision > est_pages_ff) THEN ((bs)::double precision * ((relpages)::double precision - est_pages_ff))
            ELSE (0)::double precision
        END)::bigint AS bloat_size_bytes
   FROM ( SELECT COALESCE(((1)::double precision + ceil((rows_hdr_pdg_stats.reltuples / floor((((((rows_hdr_pdg_stats.bs - (rows_hdr_pdg_stats.pageopqdata)::numeric) - (rows_hdr_pdg_stats.pagehdr)::numeric) * (rows_hdr_pdg_stats.fillfactor)::numeric))::double precision / ((100)::double precision * (((4)::numeric + rows_hdr_pdg_stats.nulldatahdrwidth))::double precision)))))), (0)::double precision) AS est_pages_ff,
            rows_hdr_pdg_stats.bs,
            rows_hdr_pdg_stats.nspname,
            rows_hdr_pdg_stats.tblname,
            rows_hdr_pdg_stats.idxname,
            rows_hdr_pdg_stats.relpages,
            rows_hdr_pdg_stats.is_na
           FROM ( SELECT rows_data_stats.maxalign,
                    rows_data_stats.bs,
                    rows_data_stats.nspname,
                    rows_data_stats.tblname,
                    rows_data_stats.idxname,
                    rows_data_stats.reltuples,
                    rows_data_stats.relpages,
                    rows_data_stats.idxoid,
                    rows_data_stats.fillfactor,
                    (((((((rows_data_stats.index_tuple_hdr_bm + rows_data_stats.maxalign) -
                        CASE
                            WHEN ((rows_data_stats.index_tuple_hdr_bm % rows_data_stats.maxalign) = 0) THEN rows_data_stats.maxalign
                            ELSE (rows_data_stats.index_tuple_hdr_bm % rows_data_stats.maxalign)
                        END))::double precision + rows_data_stats.nulldatawidth) + (rows_data_stats.maxalign)::double precision) - (
                        CASE
                            WHEN (rows_data_stats.nulldatawidth = (0)::double precision) THEN 0
                            WHEN (((rows_data_stats.nulldatawidth)::integer % rows_data_stats.maxalign) = 0) THEN rows_data_stats.maxalign
                            ELSE ((rows_data_stats.nulldatawidth)::integer % rows_data_stats.maxalign)
                        END)::double precision))::numeric AS nulldatahdrwidth,
                    rows_data_stats.pagehdr,
                    rows_data_stats.pageopqdata,
                    rows_data_stats.is_na
                   FROM ( SELECT n.nspname,
                            i.tblname,
                            i.idxname,
                            i.reltuples,
                            i.relpages,
                            i.idxoid,
                            i.fillfactor,
                            (current_setting('block_size'::text))::numeric AS bs,
                                CASE
                                    WHEN ((version() ~ 'mingw32'::text) OR (version() ~ '64-bit|x86_64|ppc64|ia64|amd64'::text)) THEN 8
                                    ELSE 4
                                END AS maxalign,
                            24 AS pagehdr,
                            16 AS pageopqdata,
                                CASE
                                    WHEN (max(COALESCE(s.null_frac, (0)::real)) = (0)::double precision) THEN 2
                                    ELSE (2 + (((32 + 8) - 1) / 8))
                                END AS index_tuple_hdr_bm,
                            sum((((1)::double precision - COALESCE(s.null_frac, (0)::real)) * (COALESCE(s.avg_width, 1024))::double precision)) AS nulldatawidth,
                            (max(
                                CASE
                                    WHEN (i.atttypid = ('name'::regtype)::oid) THEN 1
                                    ELSE 0
                                END) > 0) AS is_na
                           FROM ((( SELECT ct.relname AS tblname,
                                    ct.relnamespace,
                                    ic.idxname,
                                    ic.attpos,
                                    ic.indkey,
                                    ic.indkey[ic.attpos] AS indkey,
                                    ic.reltuples,
                                    ic.relpages,
                                    ic.tbloid,
                                    ic.idxoid,
                                    ic.fillfactor,
                                    COALESCE(a1.attnum, a2.attnum) AS attnum,
                                    COALESCE(a1.attname, a2.attname) AS attname,
                                    COALESCE(a1.atttypid, a2.atttypid) AS atttypid,
CASE
 WHEN (a1.attnum IS NULL) THEN ic.idxname
 ELSE ct.relname
END AS attrelname
                                   FROM (((( SELECT idx_data.idxname,
    idx_data.reltuples,
    idx_data.relpages,
    idx_data.tbloid,
    idx_data.idxoid,
    idx_data.fillfactor,
    idx_data.indkey,
    generate_series(1, (idx_data.indnatts)::integer) AS attpos
   FROM ( SELECT ci.relname AS idxname,
      ci.reltuples,
      ci.relpages,
      i_1.indrelid AS tbloid,
      i_1.indexrelid AS idxoid,
      COALESCE((("substring"(array_to_string(ci.reloptions, ' '::text), 'fillfactor=([0-9]+)'::text))::smallint)::integer, 90) AS fillfactor,
      i_1.indnatts,
      (string_to_array(textin(int2vectorout(i_1.indkey)), ' '::text))::integer[] AS indkey
     FROM (pg_index i_1
       JOIN pg_class ci ON ((ci.oid = i_1.indexrelid)))
    WHERE ((ci.relam = ( SELECT pg_am.oid
       FROM pg_am
      WHERE (pg_am.amname = 'btree'::name))) AND (ci.relpages > 0))) idx_data) ic
                                     JOIN pg_class ct ON ((ct.oid = ic.tbloid)))
                                     LEFT JOIN pg_attribute a1 ON (((ic.indkey[ic.attpos] <> 0) AND (a1.attrelid = ic.tbloid) AND (a1.attnum = ic.indkey[ic.attpos]))))
                                     LEFT JOIN pg_attribute a2 ON (((ic.indkey[ic.attpos] = 0) AND (a2.attrelid = ic.idxoid) AND (a2.attnum = ic.attpos))))) i(tblname, relnamespace, idxname, attpos, indkey, indkey_1, reltuples, relpages, tbloid, idxoid, fillfactor, attnum, attname, atttypid, attrelname)
                             JOIN pg_namespace n ON ((n.oid = i.relnamespace)))
                             JOIN pg_stats s ON (((s.schemaname = n.nspname) AND (s.tablename = i.attrelname) AND (s.attname = i.attname))))
                          GROUP BY n.nspname, i.tblname, i.idxname, i.reltuples, i.relpages, i.idxoid, i.fillfactor, (current_setting('block_size'::text))::numeric,
                                CASE
                                    WHEN ((version() ~ 'mingw32'::text) OR (version() ~ '64-bit|x86_64|ppc64|ia64|amd64'::text)) THEN 8
                                    ELSE 4
                                END, 24::integer, 16::integer) rows_data_stats) rows_hdr_pdg_stats) relation_stats
  WHERE ((nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])) AND (NOT is_na))
  ORDER BY nspname, tblname, idxname;

CREATE VIEW postgres_indexes AS
 SELECT (((pg_namespace.nspname)::text || '.'::text) || (i.relname)::text) AS identifier,
    pg_index.indexrelid,
    pg_namespace.nspname AS schema,
    i.relname AS name,
    pg_indexes.tablename,
    a.amname AS type,
    pg_index.indisunique AS "unique",
    pg_index.indisvalid AS valid_index,
    i.relispartition AS partitioned,
    pg_index.indisexclusion AS exclusion,
    (pg_index.indexprs IS NOT NULL) AS expression,
    (pg_index.indpred IS NOT NULL) AS partial,
    pg_indexes.indexdef AS definition,
    pg_relation_size((i.oid)::regclass) AS ondisk_size_bytes
   FROM ((((pg_index
     JOIN pg_class i ON ((i.oid = pg_index.indexrelid)))
     JOIN pg_namespace ON ((i.relnamespace = pg_namespace.oid)))
     JOIN pg_indexes ON (((i.relname = pg_indexes.indexname) AND (pg_namespace.nspname = pg_indexes.schemaname))))
     JOIN pg_am a ON ((i.relam = a.oid)))
  WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])));

CREATE VIEW postgres_partitioned_tables AS
 SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier,
    pg_class.oid,
    pg_namespace.nspname AS schema,
    pg_class.relname AS name,
        CASE partitioned_tables.partstrat
            WHEN 'l'::"char" THEN 'list'::text
            WHEN 'r'::"char" THEN 'range'::text
            WHEN 'h'::"char" THEN 'hash'::text
            ELSE NULL::text
        END AS strategy,
    array_agg(pg_attribute.attname) AS key_columns
   FROM (((( SELECT pg_partitioned_table.partrelid,
            pg_partitioned_table.partstrat,
            unnest(pg_partitioned_table.partattrs) AS column_position
           FROM pg_partitioned_table) partitioned_tables
     JOIN pg_class ON ((partitioned_tables.partrelid = pg_class.oid)))
     JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid)))
     JOIN pg_attribute ON (((pg_attribute.attrelid = pg_class.oid) AND (pg_attribute.attnum = partitioned_tables.column_position))))
  WHERE (pg_namespace.nspname = "current_schema"())
  GROUP BY (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text), pg_class.oid, pg_namespace.nspname, pg_class.relname,
        CASE partitioned_tables.partstrat
            WHEN 'l'::"char" THEN 'list'::text
            WHEN 'r'::"char" THEN 'range'::text
            WHEN 'h'::"char" THEN 'hash'::text
            ELSE NULL::text
        END;

CREATE VIEW postgres_partitions AS
 SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier,
    pg_class.oid,
    pg_namespace.nspname AS schema,
    pg_class.relname AS name,
    (((parent_namespace.nspname)::text || '.'::text) || (parent_class.relname)::text) AS parent_identifier,
    pg_get_expr(pg_class.relpartbound, pg_inherits.inhrelid) AS condition
   FROM ((((pg_class
     JOIN pg_namespace ON ((pg_namespace.oid = pg_class.relnamespace)))
     JOIN pg_inherits ON ((pg_class.oid = pg_inherits.inhrelid)))
     JOIN pg_class parent_class ON ((pg_inherits.inhparent = parent_class.oid)))
     JOIN pg_namespace parent_namespace ON ((parent_class.relnamespace = parent_namespace.oid)))
  WHERE (pg_class.relispartition AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])));

CREATE TABLE postgres_reindex_actions (
    id bigint NOT NULL,
    action_start timestamp with time zone NOT NULL,
    action_end timestamp with time zone,
    ondisk_size_bytes_start bigint NOT NULL,
    ondisk_size_bytes_end bigint,
    state smallint DEFAULT 0 NOT NULL,
    index_identifier text NOT NULL,
    bloat_estimate_bytes_start bigint,
    CONSTRAINT check_f12527622c CHECK ((char_length(index_identifier) <= 255))
);

CREATE SEQUENCE postgres_reindex_actions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE postgres_reindex_actions_id_seq OWNED BY postgres_reindex_actions.id;

CREATE TABLE postgres_reindex_queued_actions (
    id bigint NOT NULL,
    index_identifier text NOT NULL,
    state smallint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT check_e4b01395c0 CHECK ((char_length(index_identifier) <= 255))
);

CREATE SEQUENCE postgres_reindex_queued_actions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE postgres_reindex_queued_actions_id_seq OWNED BY postgres_reindex_queued_actions.id;

CREATE VIEW postgres_sequences AS
 SELECT seq_pg_class.relname AS seq_name,
    dep_pg_class.relname AS table_name,
    pg_attribute.attname AS col_name,
    pg_sequence.seqmax AS seq_max,
    pg_sequence.seqmin AS seq_min,
    pg_sequence.seqstart AS seq_start,
    pg_sequence_last_value((pg_sequence.seqrelid)::regclass) AS last_value
   FROM ((((pg_class seq_pg_class
     JOIN pg_sequence ON ((seq_pg_class.oid = pg_sequence.seqrelid)))
     LEFT JOIN pg_depend ON (((seq_pg_class.oid = pg_depend.objid) AND (pg_depend.classid = ('pg_class'::regclass)::oid) AND (pg_depend.refclassid = ('pg_class'::regclass)::oid))))
     LEFT JOIN pg_class dep_pg_class ON ((pg_depend.refobjid = dep_pg_class.oid)))
     LEFT JOIN pg_attribute ON (((dep_pg_class.oid = pg_attribute.attrelid) AND (pg_depend.refobjsubid = pg_attribute.attnum))))
  WHERE (seq_pg_class.relkind = 'S'::"char");

CREATE VIEW postgres_table_sizes AS
 SELECT (((schemaname)::text || '.'::text) || (relname)::text) AS identifier,
    schemaname AS schema_name,
    relname AS table_name,
    pg_size_pretty(pg_total_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass)) AS total_size,
    pg_size_pretty(pg_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass)) AS table_size,
    pg_size_pretty((pg_total_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass) - pg_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass))) AS index_size,
    pg_total_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass) AS size_in_bytes
   FROM pg_stat_user_tables
  WHERE (pg_total_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass) IS NOT NULL)
  ORDER BY (pg_total_relation_size((((quote_ident((schemaname)::text) || '.'::text) || quote_ident((relname)::text)))::regclass)) DESC;

CREATE TABLE programming_languages (
    id bigint NOT NULL,
    name character varying NOT NULL,
    color character varying NOT NULL,
    created_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE programming_languages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE programming_languages_id_seq OWNED BY programming_languages.id;

CREATE TABLE project_access_tokens (
    personal_access_token_id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE TABLE project_alerting_settings (
    project_id bigint NOT NULL,
    encrypted_token character varying NOT NULL,
    encrypted_token_iv character varying NOT NULL
);

CREATE TABLE project_aliases (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name character varying NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE project_aliases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_aliases_id_seq OWNED BY project_aliases.id;

CREATE TABLE project_authorizations (
    user_id bigint NOT NULL,
    project_id bigint NOT NULL,
    access_level integer NOT NULL,
    is_unique boolean
);

CREATE TABLE project_authorizations_for_migration (
    user_id bigint NOT NULL,
    project_id bigint NOT NULL,
    access_level smallint NOT NULL
);

CREATE TABLE project_auto_devops (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    enabled boolean,
    deploy_strategy integer DEFAULT 0 NOT NULL
);

CREATE SEQUENCE project_auto_devops_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_auto_devops_id_seq OWNED BY project_auto_devops.id;

CREATE TABLE project_build_artifacts_size_refreshes (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    last_job_artifact_id bigint,
    state smallint DEFAULT 1 NOT NULL,
    refresh_started_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    last_job_artifact_id_on_refresh_start bigint DEFAULT 0
);

CREATE SEQUENCE project_build_artifacts_size_refreshes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_build_artifacts_size_refreshes_id_seq OWNED BY project_build_artifacts_size_refreshes.id;

CREATE TABLE project_ci_cd_settings (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    group_runners_enabled boolean DEFAULT true NOT NULL,
    merge_pipelines_enabled boolean,
    default_git_depth integer,
    forward_deployment_enabled boolean,
    merge_trains_enabled boolean DEFAULT false,
    auto_rollback_enabled boolean DEFAULT false NOT NULL,
    keep_latest_artifact boolean DEFAULT true NOT NULL,
    restrict_user_defined_variables boolean DEFAULT false NOT NULL,
    job_token_scope_enabled boolean DEFAULT false NOT NULL,
    runner_token_expiration_interval integer,
    separated_caches boolean DEFAULT true NOT NULL,
    allow_fork_pipelines_to_run_in_parent_project boolean DEFAULT true NOT NULL,
    inbound_job_token_scope_enabled boolean DEFAULT true NOT NULL,
    forward_deployment_rollback_allowed boolean DEFAULT true NOT NULL,
    merge_trains_skip_train_allowed boolean DEFAULT false NOT NULL,
    restrict_pipeline_cancellation_role smallint DEFAULT 0 NOT NULL,
    pipeline_variables_minimum_override_role smallint DEFAULT 3 NOT NULL,
    push_repository_for_job_token_allowed boolean DEFAULT false NOT NULL,
    id_token_sub_claim_components character varying[] DEFAULT '{project_path,ref_type,ref}'::character varying[] NOT NULL,
    delete_pipelines_in_seconds integer,
    allow_composite_identities_to_run_pipelines boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE project_ci_cd_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id;

CREATE TABLE project_ci_feature_usages (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    feature smallint NOT NULL,
    default_branch boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE project_ci_feature_usages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_ci_feature_usages_id_seq OWNED BY project_ci_feature_usages.id;

CREATE TABLE project_compliance_framework_settings (
    project_id bigint NOT NULL,
    framework_id bigint,
    id bigint NOT NULL,
    created_at timestamp with time zone,
    CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL))
);

CREATE SEQUENCE project_compliance_framework_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_compliance_framework_settings_id_seq OWNED BY project_compliance_framework_settings.id;

CREATE TABLE project_compliance_standards_adherence (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    namespace_id bigint,
    status smallint NOT NULL,
    check_name smallint NOT NULL,
    standard smallint NOT NULL
);

CREATE SEQUENCE project_compliance_standards_adherence_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_compliance_standards_adherence_id_seq OWNED BY project_compliance_standards_adherence.id;

CREATE TABLE project_compliance_violations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    project_id bigint NOT NULL,
    audit_event_id bigint NOT NULL,
    compliance_requirements_control_id bigint NOT NULL,
    status smallint NOT NULL,
    audit_event_table_name smallint NOT NULL
);

CREATE SEQUENCE project_compliance_violations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_compliance_violations_id_seq OWNED BY project_compliance_violations.id;

CREATE TABLE project_compliance_violations_issues (
    id bigint NOT NULL,
    project_compliance_violation_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE SEQUENCE project_compliance_violations_issues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_compliance_violations_issues_id_seq OWNED BY project_compliance_violations_issues.id;

CREATE TABLE project_control_compliance_statuses (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    compliance_requirements_control_id bigint NOT NULL,
    project_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    compliance_requirement_id bigint NOT NULL,
    status smallint NOT NULL,
    requirement_status_id bigint
);

CREATE SEQUENCE project_control_compliance_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_control_compliance_statuses_id_seq OWNED BY project_control_compliance_statuses.id;

CREATE TABLE project_custom_attributes (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    key character varying NOT NULL,
    value character varying NOT NULL
);

CREATE SEQUENCE project_custom_attributes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_custom_attributes_id_seq OWNED BY project_custom_attributes.id;

CREATE TABLE project_daily_statistics (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    fetch_count integer NOT NULL,
    date date
);

CREATE SEQUENCE project_daily_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_daily_statistics_id_seq OWNED BY project_daily_statistics.id;

CREATE TABLE project_data_transfers (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    repository_egress bigint DEFAULT 0 NOT NULL,
    artifacts_egress bigint DEFAULT 0 NOT NULL,
    packages_egress bigint DEFAULT 0 NOT NULL,
    registry_egress bigint DEFAULT 0 NOT NULL,
    date date NOT NULL,
    created_at timestamp with time zone NOT NULL,
    CONSTRAINT project_data_transfers_project_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
);

CREATE SEQUENCE project_data_transfers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_data_transfers_id_seq OWNED BY project_data_transfers.id;

CREATE TABLE project_deploy_tokens (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    deploy_token_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE project_deploy_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_deploy_tokens_id_seq OWNED BY project_deploy_tokens.id;

CREATE VIEW project_design_management_routes_view AS
 SELECT p.id,
    p.repository_storage,
    r.path AS path_with_namespace,
    r.name AS name_with_namespace
   FROM ((design_management_repositories dr
     JOIN projects p ON ((dr.project_id = p.id)))
     JOIN routes r ON (((p.id = r.source_id) AND ((r.source_type)::text = 'Project'::text))));

CREATE TABLE project_error_tracking_settings (
    project_id bigint NOT NULL,
    enabled boolean DEFAULT false NOT NULL,
    api_url character varying,
    encrypted_token character varying,
    encrypted_token_iv character varying,
    project_name character varying,
    organization_name character varying,
    integrated boolean DEFAULT true NOT NULL,
    sentry_project_id bigint
);

CREATE TABLE project_export_jobs (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    jid character varying(100) NOT NULL,
    user_id bigint,
    exported_by_admin boolean DEFAULT false
);

CREATE SEQUENCE project_export_jobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_export_jobs_id_seq OWNED BY project_export_jobs.id;

CREATE TABLE project_feature_usages (
    project_id bigint NOT NULL,
    jira_dvcs_cloud_last_sync_at timestamp without time zone,
    jira_dvcs_server_last_sync_at timestamp without time zone
);

CREATE TABLE project_features (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    merge_requests_access_level integer,
    issues_access_level integer,
    wiki_access_level integer,
    snippets_access_level integer DEFAULT 20 NOT NULL,
    builds_access_level integer,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    repository_access_level integer DEFAULT 20 NOT NULL,
    pages_access_level integer NOT NULL,
    forking_access_level integer,
    metrics_dashboard_access_level integer,
    requirements_access_level integer DEFAULT 20 NOT NULL,
    operations_access_level integer DEFAULT 20 NOT NULL,
    analytics_access_level integer DEFAULT 20 NOT NULL,
    security_and_compliance_access_level integer DEFAULT 10 NOT NULL,
    container_registry_access_level integer DEFAULT 0 NOT NULL,
    package_registry_access_level integer DEFAULT 0 NOT NULL,
    monitor_access_level integer DEFAULT 20 NOT NULL,
    infrastructure_access_level integer DEFAULT 20 NOT NULL,
    feature_flags_access_level integer DEFAULT 20 NOT NULL,
    environments_access_level integer DEFAULT 20 NOT NULL,
    releases_access_level integer DEFAULT 20 NOT NULL,
    model_experiments_access_level integer DEFAULT 20 NOT NULL,
    model_registry_access_level integer DEFAULT 20 NOT NULL
);

CREATE SEQUENCE project_features_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_features_id_seq OWNED BY project_features.id;

CREATE TABLE project_group_links (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    group_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    group_access integer DEFAULT 30 NOT NULL,
    expires_at date,
    member_role_id bigint
);

CREATE SEQUENCE project_group_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_group_links_id_seq OWNED BY project_group_links.id;

CREATE TABLE project_import_data (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    data text,
    encrypted_credentials text,
    encrypted_credentials_iv character varying,
    encrypted_credentials_salt character varying
);

CREATE SEQUENCE project_import_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_import_data_id_seq OWNED BY project_import_data.id;

CREATE TABLE project_import_export_relation_export_upload_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE project_incident_management_settings (
    project_id bigint NOT NULL,
    create_issue boolean DEFAULT false NOT NULL,
    send_email boolean DEFAULT false NOT NULL,
    issue_template_key text,
    pagerduty_active boolean DEFAULT false NOT NULL,
    encrypted_pagerduty_token bytea,
    encrypted_pagerduty_token_iv bytea,
    auto_close_incident boolean DEFAULT true NOT NULL,
    sla_timer boolean DEFAULT false,
    sla_timer_minutes integer,
    CONSTRAINT pagerduty_token_iv_length_constraint CHECK ((octet_length(encrypted_pagerduty_token_iv) <= 12)),
    CONSTRAINT pagerduty_token_length_constraint CHECK ((octet_length(encrypted_pagerduty_token) <= 255))
);

CREATE SEQUENCE project_incident_management_settings_project_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_incident_management_settings_project_id_seq OWNED BY project_incident_management_settings.project_id;

CREATE TABLE project_metrics_settings (
    project_id bigint NOT NULL,
    external_dashboard_url character varying,
    dashboard_timezone smallint DEFAULT 0 NOT NULL
);

CREATE TABLE project_mirror_data (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    retry_count integer DEFAULT 0 NOT NULL,
    last_update_started_at timestamp without time zone,
    last_update_scheduled_at timestamp without time zone,
    next_execution_timestamp timestamp without time zone,
    status character varying,
    jid character varying,
    last_error text,
    last_update_at timestamp with time zone,
    last_successful_update_at timestamp with time zone,
    correlation_id_value character varying(128),
    checksums jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE project_mirror_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_mirror_data_id_seq OWNED BY project_mirror_data.id;

CREATE TABLE project_pages_metadata (
    project_id bigint NOT NULL,
    onboarding_complete boolean DEFAULT false NOT NULL
);

CREATE TABLE project_relation_export_uploads (
    id bigint NOT NULL,
    project_relation_export_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    export_file text NOT NULL,
    project_id bigint,
    CONSTRAINT check_d8ee243e9e CHECK ((char_length(export_file) <= 255)),
    CONSTRAINT check_f8d6cd1562 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE project_relation_export_uploads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_relation_export_uploads_id_seq OWNED BY project_relation_export_uploads.id;

CREATE TABLE project_relation_exports (
    id bigint NOT NULL,
    project_export_job_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    relation text NOT NULL,
    jid text,
    export_error text,
    project_id bigint,
    CONSTRAINT check_15e644d856 CHECK ((char_length(jid) <= 255)),
    CONSTRAINT check_4b5880b795 CHECK ((char_length(relation) <= 255)),
    CONSTRAINT check_dbd1cf73d0 CHECK ((char_length(export_error) <= 300)),
    CONSTRAINT check_f461e3537f CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE project_relation_exports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_relation_exports_id_seq OWNED BY project_relation_exports.id;

CREATE TABLE project_repositories (
    id bigint NOT NULL,
    shard_id bigint NOT NULL,
    disk_path character varying NOT NULL,
    project_id bigint NOT NULL,
    object_format smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE project_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_repositories_id_seq OWNED BY project_repositories.id;

CREATE TABLE project_repository_storage_moves (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    state smallint DEFAULT 1 NOT NULL,
    source_storage_name text NOT NULL,
    destination_storage_name text NOT NULL,
    error_message text,
    CONSTRAINT check_85854380db CHECK ((char_length(error_message) <= 256)),
    CONSTRAINT project_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)),
    CONSTRAINT project_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255))
);

CREATE SEQUENCE project_repository_storage_moves_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_repository_storage_moves_id_seq OWNED BY project_repository_storage_moves.id;

CREATE TABLE project_requirement_compliance_statuses (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    compliance_requirement_id bigint NOT NULL,
    compliance_framework_id bigint NOT NULL,
    pass_count integer DEFAULT 0 NOT NULL,
    fail_count integer DEFAULT 0 NOT NULL,
    pending_count integer DEFAULT 0 NOT NULL
);

CREATE SEQUENCE project_requirement_compliance_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_requirement_compliance_statuses_id_seq OWNED BY project_requirement_compliance_statuses.id;

CREATE VIEW project_routes_view AS
 SELECT p.id,
    p.repository_storage,
    r.path AS path_with_namespace,
    r.name AS name_with_namespace
   FROM (projects p
     JOIN routes r ON (((p.id = r.source_id) AND ((r.source_type)::text = 'Project'::text))));

CREATE TABLE project_saved_replies (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    content text NOT NULL,
    CONSTRAINT check_5569cfc14e CHECK ((char_length(content) <= 10000)),
    CONSTRAINT check_a3993908da CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE project_saved_replies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_saved_replies_id_seq OWNED BY project_saved_replies.id;

CREATE TABLE project_secrets_managers (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    status smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE project_secrets_managers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_secrets_managers_id_seq OWNED BY project_secrets_managers.id;

CREATE TABLE project_security_exclusions (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    scanner smallint NOT NULL,
    type smallint NOT NULL,
    active boolean DEFAULT true NOT NULL,
    description text,
    value text NOT NULL,
    CONSTRAINT check_3c70ee8804 CHECK ((char_length(description) <= 255)),
    CONSTRAINT check_3e918b71ed CHECK ((char_length(value) <= 255))
);

CREATE SEQUENCE project_security_exclusions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_security_exclusions_id_seq OWNED BY project_security_exclusions.id;

CREATE TABLE project_security_settings (
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    auto_fix_container_scanning boolean DEFAULT true NOT NULL,
    auto_fix_dast boolean DEFAULT true NOT NULL,
    auto_fix_dependency_scanning boolean DEFAULT true NOT NULL,
    auto_fix_sast boolean DEFAULT true NOT NULL,
    continuous_vulnerability_scans_enabled boolean DEFAULT false NOT NULL,
    container_scanning_for_registry_enabled boolean DEFAULT false NOT NULL,
    pre_receive_secret_detection_enabled boolean DEFAULT false NOT NULL,
    secret_push_protection_enabled boolean DEFAULT false,
    validity_checks_enabled boolean DEFAULT false NOT NULL,
    license_configuration_source smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_20a23efdb6 CHECK ((secret_push_protection_enabled IS NOT NULL))
);

CREATE SEQUENCE project_security_settings_project_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_security_settings_project_id_seq OWNED BY project_security_settings.project_id;

CREATE TABLE project_security_statistics (
    project_id bigint NOT NULL,
    vulnerability_count integer DEFAULT 0 NOT NULL
);

CREATE TABLE project_settings (
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    push_rule_id bigint,
    show_default_award_emojis boolean DEFAULT true,
    allow_merge_on_skipped_pipeline boolean,
    squash_option smallint DEFAULT 3,
    has_confluence boolean DEFAULT false NOT NULL,
    has_vulnerabilities boolean DEFAULT false NOT NULL,
    prevent_merge_without_jira_issue boolean DEFAULT false NOT NULL,
    cve_id_request_enabled boolean DEFAULT true NOT NULL,
    mr_default_target_self boolean DEFAULT false NOT NULL,
    previous_default_branch text,
    warn_about_potentially_unwanted_characters boolean DEFAULT true NOT NULL,
    merge_commit_template text,
    has_shimo boolean DEFAULT false NOT NULL,
    squash_commit_template text,
    legacy_open_source_license_available boolean DEFAULT true NOT NULL,
    target_platforms character varying[] DEFAULT '{}'::character varying[] NOT NULL,
    enforce_auth_checks_on_uploads boolean DEFAULT true NOT NULL,
    selective_code_owner_removals boolean DEFAULT false NOT NULL,
    issue_branch_template text,
    show_diff_preview_in_email boolean DEFAULT true NOT NULL,
    suggested_reviewers_enabled boolean DEFAULT false NOT NULL,
    only_allow_merge_if_all_status_checks_passed boolean DEFAULT false NOT NULL,
    mirror_branch_regex text,
    allow_pipeline_trigger_approve_deployment boolean DEFAULT false NOT NULL,
    emails_enabled boolean DEFAULT true NOT NULL,
    pages_unique_domain_enabled boolean DEFAULT false NOT NULL,
    pages_unique_domain text,
    runner_registration_enabled boolean DEFAULT true,
    product_analytics_instrumentation_key text,
    product_analytics_data_collector_host text,
    cube_api_base_url text,
    encrypted_cube_api_key bytea,
    encrypted_cube_api_key_iv bytea,
    encrypted_product_analytics_configurator_connection_string bytea,
    encrypted_product_analytics_configurator_connection_string_iv bytea,
    pages_multiple_versions_enabled boolean DEFAULT false NOT NULL,
    allow_merge_without_pipeline boolean DEFAULT false NOT NULL,
    duo_features_enabled boolean DEFAULT true NOT NULL,
    require_reauthentication_to_approve boolean,
    observability_alerts_enabled boolean DEFAULT true NOT NULL,
    spp_repository_pipeline_access boolean DEFAULT true,
    max_number_of_vulnerabilities integer,
    pages_primary_domain text,
    extended_prat_expiry_webhooks_execute boolean DEFAULT false NOT NULL,
    merge_request_title_regex text,
    protect_merge_request_pipelines boolean DEFAULT true NOT NULL,
    auto_duo_code_review_enabled boolean DEFAULT false NOT NULL,
    model_prompt_cache_enabled boolean,
    web_based_commit_signing_enabled boolean DEFAULT false NOT NULL,
    duo_context_exclusion_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    merge_request_title_regex_description text,
    CONSTRAINT check_1a30456322 CHECK ((char_length(pages_unique_domain) <= 63)),
    CONSTRAINT check_237486989c CHECK ((char_length(merge_request_title_regex_description) <= 255)),
    CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)),
    CONSTRAINT check_3ca5cbffe6 CHECK ((char_length(issue_branch_template) <= 255)),
    CONSTRAINT check_4b142e71f3 CHECK ((char_length(product_analytics_data_collector_host) <= 255)),
    CONSTRAINT check_67292e4b99 CHECK ((char_length(mirror_branch_regex) <= 255)),
    CONSTRAINT check_999e5f0aaa CHECK ((char_length(pages_primary_domain) <= 255)),
    CONSTRAINT check_acb7fad2f9 CHECK ((char_length(product_analytics_instrumentation_key) <= 255)),
    CONSTRAINT check_b09644994b CHECK ((char_length(squash_commit_template) <= 500)),
    CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)),
    CONSTRAINT check_eaf7cfb6a7 CHECK ((char_length(merge_commit_template) <= 500)),
    CONSTRAINT check_ee0d751d5c CHECK ((char_length(merge_request_title_regex) <= 255)),
    CONSTRAINT check_f9df7bcee2 CHECK ((char_length(cube_api_base_url) <= 512))
);

CREATE VIEW project_snippets_routes_view AS
 SELECT sn.id,
    sh.name AS repository_storage,
    sr.disk_path,
    r.path AS path_with_namespace,
    r.name AS name_with_namespace
   FROM (((snippets sn
     JOIN snippet_repositories sr ON (((sn.id = sr.snippet_id) AND ((sn.type)::text = 'ProjectSnippet'::text))))
     JOIN shards sh ON ((sr.shard_id = sh.id)))
     JOIN routes r ON (((r.source_id = sn.project_id) AND ((r.source_type)::text = 'Project'::text))));

CREATE TABLE project_states (
    id bigint NOT NULL,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    project_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    CONSTRAINT check_0d5a9e7bde CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE project_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_states_id_seq OWNED BY project_states.id;

CREATE TABLE project_statistics (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    commit_count bigint DEFAULT 0 NOT NULL,
    storage_size bigint DEFAULT 0 NOT NULL,
    repository_size bigint DEFAULT 0 NOT NULL,
    lfs_objects_size bigint DEFAULT 0 NOT NULL,
    build_artifacts_size bigint DEFAULT 0 NOT NULL,
    shared_runners_seconds bigint DEFAULT 0 NOT NULL,
    shared_runners_seconds_last_reset timestamp without time zone,
    packages_size bigint DEFAULT 0 NOT NULL,
    wiki_size bigint,
    snippets_size bigint,
    pipeline_artifacts_size bigint DEFAULT 0 NOT NULL,
    uploads_size bigint DEFAULT 0 NOT NULL,
    container_registry_size bigint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    root_namespace_id bigint
);

CREATE SEQUENCE project_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_statistics_id_seq OWNED BY project_statistics.id;

CREATE TABLE project_topic_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE project_topics (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    topic_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE project_topics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_topics_id_seq OWNED BY project_topics.id;

CREATE TABLE project_type_ci_runner_machines (
    id bigint NOT NULL,
    runner_id bigint NOT NULL,
    sharding_key_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    contacted_at timestamp with time zone,
    creation_state smallint DEFAULT 0 NOT NULL,
    executor_type smallint,
    runner_type smallint NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    system_xid text NOT NULL,
    platform text,
    architecture text,
    revision text,
    ip_address text,
    version text,
    runtime_features jsonb DEFAULT '{}'::jsonb NOT NULL,
    organization_id bigint,
    CONSTRAINT check_3d8736b3af CHECK ((char_length(system_xid) <= 64)),
    CONSTRAINT check_5bad2a6944 CHECK ((char_length(revision) <= 255)),
    CONSTRAINT check_7dc4eee8a5 CHECK ((char_length(version) <= 2048)),
    CONSTRAINT check_b1e456641b CHECK ((char_length(ip_address) <= 1024)),
    CONSTRAINT check_c788f4b18a CHECK ((char_length(platform) <= 255)),
    CONSTRAINT check_f3d25ab844 CHECK ((char_length(architecture) <= 255)),
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NOT NULL))
);

CREATE TABLE project_type_ci_runners (
    id bigint NOT NULL,
    creator_id bigint,
    sharding_key_id bigint,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    contacted_at timestamp with time zone,
    token_expires_at timestamp with time zone,
    public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
    access_level integer DEFAULT 0 NOT NULL,
    maximum_timeout integer,
    runner_type smallint NOT NULL,
    registration_type smallint DEFAULT 0 NOT NULL,
    creation_state smallint DEFAULT 0 NOT NULL,
    active boolean DEFAULT true NOT NULL,
    run_untagged boolean DEFAULT true NOT NULL,
    locked boolean DEFAULT false NOT NULL,
    name text,
    token_encrypted text,
    token text,
    description text,
    maintainer_note text,
    allowed_plans text[] DEFAULT '{}'::text[] NOT NULL,
    allowed_plan_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    organization_id bigint,
    CONSTRAINT check_030ad0773d CHECK ((char_length(token_encrypted) <= 512)),
    CONSTRAINT check_1f8618ab23 CHECK ((char_length(name) <= 256)),
    CONSTRAINT check_24b281f5bf CHECK ((char_length(maintainer_note) <= 1024)),
    CONSTRAINT check_5db8ae9d30 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_af25130d5a CHECK ((char_length(token) <= 128)),
    CONSTRAINT check_sharding_key_id_nullness CHECK ((sharding_key_id IS NOT NULL))
);

CREATE TABLE project_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE project_wiki_repositories (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE project_wiki_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE project_wiki_repositories_id_seq OWNED BY project_wiki_repositories.id;

CREATE TABLE projects_branch_rules_merge_request_approval_settings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    protected_branch_id bigint NOT NULL,
    project_id bigint NOT NULL,
    prevent_author_approval boolean DEFAULT false NOT NULL,
    prevent_committer_approval boolean DEFAULT false NOT NULL,
    prevent_editing_approval_rules boolean DEFAULT false NOT NULL,
    require_reauthentication_to_approve boolean DEFAULT false NOT NULL,
    approval_removals smallint DEFAULT 1 NOT NULL
);

CREATE SEQUENCE projects_branch_rules_merge_request_approval_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE projects_branch_rules_merge_request_approval_settings_id_seq OWNED BY projects_branch_rules_merge_request_approval_settings.id;

CREATE TABLE projects_branch_rules_squash_options (
    id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    squash_option smallint DEFAULT 3 NOT NULL
);

CREATE SEQUENCE projects_branch_rules_squash_options_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE projects_branch_rules_squash_options_id_seq OWNED BY projects_branch_rules_squash_options.id;

CREATE SEQUENCE projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE projects_id_seq OWNED BY projects.id;

CREATE TABLE projects_sync_events (
    id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE SEQUENCE projects_sync_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE projects_sync_events_id_seq OWNED BY projects_sync_events.id;

CREATE SEQUENCE projects_visits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE projects_visits_id_seq OWNED BY projects_visits.id;

CREATE TABLE projects_with_pipeline_variables (
    project_id bigint NOT NULL
);

CREATE TABLE protected_branch_merge_access_levels (
    id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    access_level integer DEFAULT 40,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    user_id bigint,
    group_id bigint,
    protected_branch_project_id bigint,
    protected_branch_namespace_id bigint,
    CONSTRAINT check_66e95f5ee9 CHECK ((num_nonnulls(protected_branch_namespace_id, protected_branch_project_id) = 1))
);

CREATE SEQUENCE protected_branch_merge_access_levels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_branch_merge_access_levels_id_seq OWNED BY protected_branch_merge_access_levels.id;

CREATE TABLE protected_branch_push_access_levels (
    id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    access_level integer DEFAULT 40,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    user_id bigint,
    group_id bigint,
    deploy_key_id bigint,
    protected_branch_project_id bigint,
    protected_branch_namespace_id bigint
);

CREATE SEQUENCE protected_branch_push_access_levels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_branch_push_access_levels_id_seq OWNED BY protected_branch_push_access_levels.id;

CREATE TABLE protected_branch_unprotect_access_levels (
    id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    access_level integer DEFAULT 40,
    user_id bigint,
    group_id bigint,
    protected_branch_project_id bigint,
    protected_branch_namespace_id bigint,
    CONSTRAINT check_a5a558921b CHECK ((num_nonnulls(protected_branch_namespace_id, protected_branch_project_id) = 1))
);

CREATE SEQUENCE protected_branch_unprotect_access_levels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_branch_unprotect_access_levels_id_seq OWNED BY protected_branch_unprotect_access_levels.id;

CREATE TABLE protected_branches (
    id bigint NOT NULL,
    project_id bigint,
    name character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    code_owner_approval_required boolean DEFAULT false NOT NULL,
    allow_force_push boolean DEFAULT false NOT NULL,
    namespace_id bigint,
    CONSTRAINT protected_branches_project_id_namespace_id_any_not_null CHECK (((project_id IS NULL) <> (namespace_id IS NULL)))
);

CREATE SEQUENCE protected_branches_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_branches_id_seq OWNED BY protected_branches.id;

CREATE TABLE protected_environment_approval_rules (
    id bigint NOT NULL,
    protected_environment_id bigint NOT NULL,
    user_id bigint,
    group_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    access_level smallint,
    required_approvals smallint NOT NULL,
    group_inheritance_type smallint DEFAULT 0 NOT NULL,
    protected_environment_project_id bigint,
    protected_environment_group_id bigint,
    CONSTRAINT check_e853acbde6 CHECK ((num_nonnulls(protected_environment_group_id, protected_environment_project_id) = 1)),
    CONSTRAINT chk_rails_bed75249bc CHECK ((((access_level IS NOT NULL) AND (group_id IS NULL) AND (user_id IS NULL)) OR ((user_id IS NOT NULL) AND (access_level IS NULL) AND (group_id IS NULL)) OR ((group_id IS NOT NULL) AND (user_id IS NULL) AND (access_level IS NULL)))),
    CONSTRAINT chk_rails_cfa90ae3b5 CHECK ((required_approvals > 0))
);

CREATE SEQUENCE protected_environment_approval_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_environment_approval_rules_id_seq OWNED BY protected_environment_approval_rules.id;

CREATE TABLE protected_environment_deploy_access_levels (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    access_level integer,
    protected_environment_id bigint NOT NULL,
    user_id bigint,
    group_id bigint,
    group_inheritance_type smallint DEFAULT 0 NOT NULL,
    protected_environment_project_id bigint,
    protected_environment_group_id bigint,
    CONSTRAINT check_cee712b465 CHECK ((num_nonnulls(protected_environment_group_id, protected_environment_project_id) = 1)),
    CONSTRAINT check_deploy_access_levels_user_group_access_level_any_not_null CHECK ((num_nonnulls(user_id, group_id, access_level) = 1))
);

CREATE SEQUENCE protected_environment_deploy_access_levels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_environment_deploy_access_levels_id_seq OWNED BY protected_environment_deploy_access_levels.id;

CREATE TABLE protected_environments (
    id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name character varying NOT NULL,
    group_id bigint,
    required_approval_count integer DEFAULT 0 NOT NULL,
    CONSTRAINT protected_environments_project_or_group_existence CHECK (((project_id IS NULL) <> (group_id IS NULL))),
    CONSTRAINT protected_environments_required_approval_count_positive CHECK ((required_approval_count >= 0))
);

CREATE SEQUENCE protected_environments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_environments_id_seq OWNED BY protected_environments.id;

CREATE TABLE protected_tag_create_access_levels (
    id bigint NOT NULL,
    protected_tag_id bigint NOT NULL,
    access_level integer DEFAULT 40,
    user_id bigint,
    group_id bigint,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    deploy_key_id bigint,
    project_id bigint,
    CONSTRAINT check_e56dc4b33a CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE protected_tag_create_access_levels_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_tag_create_access_levels_id_seq OWNED BY protected_tag_create_access_levels.id;

CREATE TABLE protected_tags (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    name character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE protected_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE protected_tags_id_seq OWNED BY protected_tags.id;

CREATE TABLE push_event_payloads (
    commit_count bigint NOT NULL,
    action smallint NOT NULL,
    ref_type smallint NOT NULL,
    commit_from bytea,
    commit_to bytea,
    ref text,
    commit_title character varying(70),
    ref_count integer,
    event_id bigint NOT NULL,
    project_id bigint
);

CREATE TABLE push_rules (
    id bigint NOT NULL,
    commit_message_regex character varying,
    deny_delete_tag boolean,
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    author_email_regex character varying,
    member_check boolean DEFAULT false NOT NULL,
    file_name_regex character varying,
    is_sample boolean DEFAULT false,
    max_file_size integer DEFAULT 0 NOT NULL,
    prevent_secrets boolean DEFAULT false NOT NULL,
    branch_name_regex character varying,
    reject_unsigned_commits boolean,
    commit_committer_check boolean,
    regexp_uses_re2 boolean DEFAULT true,
    commit_message_negative_regex character varying,
    reject_non_dco_commits boolean,
    commit_committer_name_check boolean DEFAULT false NOT NULL,
    organization_id bigint,
    CONSTRAINT author_email_regex_size_constraint CHECK ((char_length((author_email_regex)::text) <= 511)),
    CONSTRAINT branch_name_regex_size_constraint CHECK ((char_length((branch_name_regex)::text) <= 511)),
    CONSTRAINT commit_message_negative_regex_size_constraint CHECK ((char_length((commit_message_negative_regex)::text) <= 2047)),
    CONSTRAINT commit_message_regex_size_constraint CHECK ((char_length((commit_message_regex)::text) <= 511)),
    CONSTRAINT file_name_regex_size_constraint CHECK ((char_length((file_name_regex)::text) <= 511))
);

CREATE SEQUENCE push_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE push_rules_id_seq OWNED BY push_rules.id;

CREATE TABLE queries_service_pings (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    recorded_at timestamp with time zone NOT NULL,
    payload jsonb NOT NULL,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE queries_service_pings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE queries_service_pings_id_seq OWNED BY queries_service_pings.id;

CREATE TABLE raw_usage_data (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    recorded_at timestamp with time zone NOT NULL,
    sent_at timestamp with time zone,
    payload jsonb NOT NULL,
    version_usage_data_id_value bigint,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE raw_usage_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE raw_usage_data_id_seq OWNED BY raw_usage_data.id;

CREATE TABLE redirect_routes (
    id bigint NOT NULL,
    source_id bigint NOT NULL,
    source_type character varying NOT NULL,
    path character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    namespace_id bigint
);

CREATE SEQUENCE redirect_routes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE redirect_routes_id_seq OWNED BY redirect_routes.id;

CREATE TABLE related_epic_links (
    id bigint NOT NULL,
    source_id bigint NOT NULL,
    target_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    link_type smallint DEFAULT 0 NOT NULL,
    group_id bigint,
    issue_link_id bigint,
    CONSTRAINT check_9c7bbef67d CHECK ((group_id IS NOT NULL))
);

CREATE SEQUENCE related_epic_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE related_epic_links_id_seq OWNED BY related_epic_links.id;

CREATE TABLE relation_import_trackers (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    relation smallint NOT NULL,
    status smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE relation_import_trackers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE relation_import_trackers_id_seq OWNED BY relation_import_trackers.id;

CREATE TABLE release_links (
    id bigint NOT NULL,
    release_id bigint NOT NULL,
    url character varying NOT NULL,
    name character varying NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    filepath character varying(128),
    link_type smallint DEFAULT 0,
    project_id bigint,
    CONSTRAINT check_959e7fdd89 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE release_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE release_links_id_seq OWNED BY release_links.id;

CREATE TABLE releases (
    id bigint NOT NULL,
    tag character varying,
    description text,
    project_id bigint,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    description_html text,
    cached_markdown_version integer,
    author_id bigint,
    name character varying,
    sha character varying,
    released_at timestamp with time zone NOT NULL,
    release_published_at timestamp with time zone,
    CONSTRAINT check_6bb9ce4925 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE releases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE releases_id_seq OWNED BY releases.id;

CREATE TABLE remote_mirrors (
    id bigint NOT NULL,
    project_id bigint,
    url character varying,
    enabled boolean DEFAULT false,
    update_status character varying,
    last_update_at timestamp without time zone,
    last_successful_update_at timestamp without time zone,
    last_error character varying,
    encrypted_credentials text,
    encrypted_credentials_iv character varying,
    encrypted_credentials_salt character varying,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    last_update_started_at timestamp without time zone,
    only_protected_branches boolean DEFAULT false NOT NULL,
    remote_name character varying,
    error_notification_sent boolean,
    keep_divergent_refs boolean,
    mirror_branch_regex text,
    CONSTRAINT check_7547191afa CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_aa6b497785 CHECK ((char_length(mirror_branch_regex) <= 255))
);

CREATE SEQUENCE remote_mirrors_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE remote_mirrors_id_seq OWNED BY remote_mirrors.id;

CREATE TABLE repository_languages (
    project_id bigint NOT NULL,
    programming_language_id bigint NOT NULL,
    share double precision NOT NULL
);

CREATE TABLE required_code_owners_sections (
    id bigint NOT NULL,
    protected_branch_id bigint NOT NULL,
    name text NOT NULL,
    protected_branch_project_id bigint,
    protected_branch_namespace_id bigint,
    CONSTRAINT check_e58d53741e CHECK ((char_length(name) <= 1024)),
    CONSTRAINT check_e7c067043a CHECK ((num_nonnulls(protected_branch_namespace_id, protected_branch_project_id) = 1))
);

CREATE SEQUENCE required_code_owners_sections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE required_code_owners_sections_id_seq OWNED BY required_code_owners_sections.id;

CREATE TABLE requirements (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    iid integer NOT NULL,
    issue_id bigint,
    CONSTRAINT check_requirement_issue_not_null CHECK ((issue_id IS NOT NULL))
);

CREATE SEQUENCE requirements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE requirements_id_seq OWNED BY requirements.id;

CREATE TABLE requirements_management_test_reports (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    author_id bigint,
    state smallint NOT NULL,
    build_id bigint,
    issue_id bigint,
    uses_legacy_iid boolean DEFAULT true NOT NULL,
    project_id bigint,
    CONSTRAINT check_715b56da9a CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE requirements_management_test_reports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE requirements_management_test_reports_id_seq OWNED BY requirements_management_test_reports.id;

CREATE TABLE resource_iteration_events (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    issue_id bigint,
    merge_request_id bigint,
    iteration_id bigint,
    created_at timestamp with time zone NOT NULL,
    action smallint NOT NULL,
    automated boolean DEFAULT false NOT NULL,
    triggered_by_id bigint,
    namespace_id bigint NOT NULL,
    CONSTRAINT check_52cee5f824 CHECK ((iteration_id IS NOT NULL))
);

CREATE SEQUENCE resource_iteration_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE resource_iteration_events_id_seq OWNED BY resource_iteration_events.id;

CREATE TABLE resource_label_events (
    id bigint NOT NULL,
    action integer NOT NULL,
    issue_id bigint,
    merge_request_id bigint,
    epic_id bigint,
    label_id bigint,
    user_id bigint,
    created_at timestamp with time zone NOT NULL,
    reference text,
    imported_from smallint DEFAULT 0 NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE resource_label_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE resource_label_events_id_seq OWNED BY resource_label_events.id;

CREATE TABLE resource_link_events (
    id bigint NOT NULL,
    action smallint NOT NULL,
    user_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    child_work_item_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    system_note_metadata_id bigint,
    namespace_id bigint,
    CONSTRAINT check_47e459b05e CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE resource_link_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE resource_link_events_id_seq OWNED BY resource_link_events.id;

CREATE TABLE resource_milestone_events (
    id bigint NOT NULL,
    user_id bigint,
    issue_id bigint,
    merge_request_id bigint,
    milestone_id bigint,
    action smallint NOT NULL,
    state smallint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    imported_from smallint DEFAULT 0 NOT NULL,
    namespace_id bigint NOT NULL,
    CONSTRAINT check_fa0260b82e CHECK ((num_nonnulls(issue_id, merge_request_id) = 1))
);

CREATE SEQUENCE resource_milestone_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE resource_milestone_events_id_seq OWNED BY resource_milestone_events.id;

CREATE TABLE resource_state_events (
    id bigint NOT NULL,
    user_id bigint,
    issue_id bigint,
    merge_request_id bigint,
    created_at timestamp with time zone NOT NULL,
    state smallint NOT NULL,
    epic_id bigint,
    source_commit text,
    close_after_error_tracking_resolve boolean DEFAULT false NOT NULL,
    close_auto_resolve_prometheus_alert boolean DEFAULT false NOT NULL,
    source_merge_request_id bigint,
    imported_from smallint DEFAULT 0 NOT NULL,
    namespace_id bigint NOT NULL,
    CONSTRAINT check_465d337634 CHECK ((num_nonnulls(epic_id, issue_id, merge_request_id) = 1)),
    CONSTRAINT check_f0bcfaa3a2 CHECK ((char_length(source_commit) <= 40))
);

CREATE SEQUENCE resource_state_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE resource_state_events_id_seq OWNED BY resource_state_events.id;

CREATE TABLE resource_weight_events (
    id bigint NOT NULL,
    user_id bigint,
    issue_id bigint NOT NULL,
    weight integer,
    created_at timestamp with time zone NOT NULL,
    previous_weight integer,
    namespace_id bigint,
    CONSTRAINT check_30317d1ce0 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE resource_weight_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE resource_weight_events_id_seq OWNED BY resource_weight_events.id;

CREATE TABLE reviews (
    id bigint NOT NULL,
    author_id bigint,
    merge_request_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE reviews_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE reviews_id_seq OWNED BY reviews.id;

CREATE SEQUENCE routes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE routes_id_seq OWNED BY routes.id;

CREATE TABLE saml_group_links (
    id bigint NOT NULL,
    access_level smallint NOT NULL,
    group_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    saml_group_name text NOT NULL,
    member_role_id bigint,
    assign_duo_seats boolean DEFAULT false NOT NULL,
    scim_group_uid uuid,
    provider text,
    CONSTRAINT check_1b3fc49d1e CHECK ((char_length(saml_group_name) <= 255)),
    CONSTRAINT check_59e993f34e CHECK ((char_length(provider) <= 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 bigint NOT NULL,
    group_id bigint NOT NULL,
    enabled boolean NOT NULL,
    certificate_fingerprint character varying NOT NULL,
    sso_url character varying NOT NULL,
    enforced_sso boolean DEFAULT false NOT NULL,
    enforced_group_managed_accounts boolean DEFAULT false NOT NULL,
    prohibited_outer_forks boolean DEFAULT true NOT NULL,
    default_membership_role smallint DEFAULT 10 NOT NULL,
    git_check_enforced boolean DEFAULT false NOT NULL,
    member_role_id bigint,
    disable_password_authentication_for_enterprise_users boolean DEFAULT false
);

CREATE SEQUENCE saml_providers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE saml_providers_id_seq OWNED BY saml_providers.id;

CREATE TABLE saved_replies (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    content text NOT NULL,
    CONSTRAINT check_0cb57dc22a CHECK ((char_length(content) <= 10000)),
    CONSTRAINT check_2eb3366d7f CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE saved_replies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE saved_replies_id_seq OWNED BY saved_replies.id;

CREATE TABLE sbom_component_versions (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    component_id bigint NOT NULL,
    version text NOT NULL,
    source_package_name text,
    organization_id bigint NOT NULL,
    CONSTRAINT check_39636b9a8a CHECK ((char_length(source_package_name) <= 255)),
    CONSTRAINT check_e71cad08d3 CHECK ((char_length(version) <= 255))
);

CREATE SEQUENCE sbom_component_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_component_versions_id_seq OWNED BY sbom_component_versions.id;

CREATE TABLE sbom_components (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    component_type smallint NOT NULL,
    name text NOT NULL,
    purl_type smallint,
    organization_id bigint NOT NULL,
    CONSTRAINT check_91a8f6ad53 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE sbom_components_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_components_id_seq OWNED BY sbom_components.id;

CREATE TABLE sbom_graph_paths (
    id bigint NOT NULL,
    ancestor_id bigint NOT NULL,
    descendant_id bigint NOT NULL,
    project_id bigint NOT NULL,
    path_length integer NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    top_level_ancestor boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE sbom_graph_paths_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_graph_paths_id_seq OWNED BY sbom_graph_paths.id;

CREATE TABLE sbom_occurrences (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    component_version_id bigint,
    project_id bigint NOT NULL,
    pipeline_id bigint,
    source_id bigint,
    commit_sha bytea NOT NULL,
    component_id bigint NOT NULL,
    uuid uuid NOT NULL,
    package_manager text,
    component_name text,
    input_file_path text,
    licenses jsonb DEFAULT '[]'::jsonb,
    highest_severity smallint,
    vulnerability_count integer DEFAULT 0 NOT NULL,
    source_package_id bigint,
    archived boolean DEFAULT false NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    ancestors jsonb DEFAULT '[]'::jsonb NOT NULL,
    reachability smallint DEFAULT 0,
    CONSTRAINT check_3f2d2c7ffc CHECK ((char_length(package_manager) <= 255)),
    CONSTRAINT check_9b29021fa8 CHECK ((char_length(component_name) <= 255)),
    CONSTRAINT check_e6b8437cfe CHECK ((char_length(input_file_path) <= 1024))
);

CREATE SEQUENCE sbom_occurrences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_occurrences_id_seq OWNED BY sbom_occurrences.id;

CREATE TABLE sbom_occurrences_vulnerabilities (
    id bigint NOT NULL,
    sbom_occurrence_id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_a02e48df9c CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE sbom_occurrences_vulnerabilities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_occurrences_vulnerabilities_id_seq OWNED BY sbom_occurrences_vulnerabilities.id;

CREATE TABLE sbom_source_packages (
    id bigint NOT NULL,
    name text NOT NULL,
    purl_type smallint NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    organization_id bigint NOT NULL,
    CONSTRAINT check_8fba79abed CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE sbom_source_packages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_source_packages_id_seq OWNED BY sbom_source_packages.id;

CREATE TABLE sbom_sources (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    source_type smallint NOT NULL,
    source jsonb DEFAULT '{}'::jsonb NOT NULL,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE sbom_sources_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sbom_sources_id_seq OWNED BY sbom_sources.id;

CREATE TABLE scan_execution_policy_rules (
    id bigint NOT NULL,
    security_policy_id bigint NOT NULL,
    security_policy_management_project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    rule_index smallint NOT NULL,
    type smallint NOT NULL,
    content jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE scan_execution_policy_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE scan_execution_policy_rules_id_seq OWNED BY scan_execution_policy_rules.id;

CREATE TABLE scan_result_policies (
    id bigint NOT NULL,
    security_orchestration_policy_configuration_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    orchestration_policy_idx smallint NOT NULL,
    license_states text[] DEFAULT '{}'::text[],
    match_on_inclusion boolean,
    role_approvers integer[] DEFAULT '{}'::integer[],
    age_value integer,
    age_operator smallint,
    age_interval smallint,
    vulnerability_attributes jsonb DEFAULT '{}'::jsonb,
    project_id bigint,
    rule_idx smallint,
    project_approval_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    commits smallint,
    send_bot_message jsonb DEFAULT '{}'::jsonb NOT NULL,
    fallback_behavior jsonb DEFAULT '{}'::jsonb NOT NULL,
    policy_tuning jsonb DEFAULT '{}'::jsonb NOT NULL,
    action_idx smallint DEFAULT 0 NOT NULL,
    custom_roles bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    licenses jsonb DEFAULT '{}'::jsonb NOT NULL,
    namespace_id bigint,
    approval_policy_rule_id bigint,
    CONSTRAINT age_value_null_or_positive CHECK (((age_value IS NULL) OR (age_value >= 0))),
    CONSTRAINT check_scan_result_policies_rule_idx_positive CHECK (((rule_idx IS NULL) OR (rule_idx >= 0))),
    CONSTRAINT custom_roles_array_check CHECK ((array_position(custom_roles, NULL::bigint) IS NULL))
);

CREATE SEQUENCE scan_result_policies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE scan_result_policies_id_seq OWNED BY scan_result_policies.id;

CREATE TABLE scan_result_policy_violations (
    id bigint NOT NULL,
    scan_result_policy_id bigint,
    merge_request_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    violation_data jsonb,
    approval_policy_rule_id bigint,
    status smallint DEFAULT 1 NOT NULL,
    CONSTRAINT chk_policy_violations_rule_id_or_policy_id_not_null CHECK (((approval_policy_rule_id IS NOT NULL) OR (scan_result_policy_id IS NOT NULL)))
);

CREATE SEQUENCE scan_result_policy_violations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE scan_result_policy_violations_id_seq OWNED BY scan_result_policy_violations.id;

CREATE TABLE schema_migrations (
    version character varying NOT NULL,
    finished_at timestamp with time zone DEFAULT now()
);

CREATE TABLE scim_group_memberships (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    scim_group_uid uuid NOT NULL
);

CREATE SEQUENCE scim_group_memberships_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE scim_group_memberships_id_seq OWNED BY scim_group_memberships.id;

CREATE TABLE scim_identities (
    id bigint NOT NULL,
    group_id bigint,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    active boolean DEFAULT false,
    extern_uid character varying(255) NOT NULL
);

CREATE SEQUENCE scim_identities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE scim_identities_id_seq OWNED BY scim_identities.id;

CREATE TABLE scim_oauth_access_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint,
    token_encrypted character varying NOT NULL
);

CREATE SEQUENCE scim_oauth_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE scim_oauth_access_tokens_id_seq OWNED BY scim_oauth_access_tokens.id;

CREATE TABLE secret_detection_token_statuses (
    vulnerability_occurrence_id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    status smallint DEFAULT 0 NOT NULL
);

CREATE TABLE security_categories (
    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,
    editable_state smallint DEFAULT 0 NOT NULL,
    template_type smallint,
    multiple_selection boolean DEFAULT false NOT NULL,
    name text NOT NULL,
    description text,
    CONSTRAINT check_6a761c4c9f CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_d643dfc44b CHECK ((char_length(description) <= 255))
);

CREATE SEQUENCE security_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_categories_id_seq OWNED BY security_categories.id;

CREATE SEQUENCE security_findings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_findings_id_seq OWNED BY security_findings.id;

CREATE TABLE security_orchestration_policy_configurations (
    id bigint NOT NULL,
    project_id bigint,
    security_policy_management_project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    configured_at timestamp with time zone,
    namespace_id bigint,
    experiments jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT cop_configs_project_or_namespace_existence CHECK (((project_id IS NULL) <> (namespace_id IS NULL)))
);

COMMENT ON TABLE security_orchestration_policy_configurations IS '{"owner":"group::container security","description":"Configuration used to store relationship between project and security policy repository"}';

CREATE SEQUENCE security_orchestration_policy_configurations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_orchestration_policy_configurations_id_seq OWNED BY security_orchestration_policy_configurations.id;

CREATE TABLE security_orchestration_policy_rule_schedules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    next_run_at timestamp with time zone,
    security_orchestration_policy_configuration_id bigint NOT NULL,
    user_id bigint NOT NULL,
    policy_index integer NOT NULL,
    cron text NOT NULL,
    rule_index integer DEFAULT 0 NOT NULL,
    project_id bigint,
    namespace_id bigint,
    policy_type smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_915825a76e CHECK ((char_length(cron) <= 255)),
    CONSTRAINT check_b2b0883c5c CHECK ((num_nonnulls(namespace_id, project_id) = 1))
);

COMMENT ON TABLE security_orchestration_policy_rule_schedules IS '{"owner":"group::container security","description":"Schedules used to store relationship between project and security policy repository"}';

CREATE SEQUENCE security_orchestration_policy_rule_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_orchestration_policy_rule_schedules_id_seq OWNED BY security_orchestration_policy_rule_schedules.id;

CREATE TABLE security_pipeline_execution_policy_config_links (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    security_policy_id bigint NOT NULL
);

CREATE SEQUENCE security_pipeline_execution_policy_config_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_pipeline_execution_policy_config_links_id_seq OWNED BY security_pipeline_execution_policy_config_links.id;

CREATE TABLE security_pipeline_execution_project_schedules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    next_run_at timestamp with time zone NOT NULL,
    security_policy_id bigint NOT NULL,
    project_id bigint NOT NULL,
    time_window_seconds integer NOT NULL,
    cron text NOT NULL,
    cron_timezone text NOT NULL,
    snoozed_until timestamp with time zone,
    CONSTRAINT check_b93315bfbb CHECK ((char_length(cron_timezone) <= 255)),
    CONSTRAINT check_bbbe4b1b8d CHECK ((char_length(cron) <= 128)),
    CONSTRAINT check_c440017377 CHECK ((time_window_seconds > 0))
);

CREATE SEQUENCE security_pipeline_execution_project_schedules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_pipeline_execution_project_schedules_id_seq OWNED BY security_pipeline_execution_project_schedules.id;

CREATE TABLE security_policies (
    id bigint NOT NULL,
    security_orchestration_policy_configuration_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    policy_index smallint NOT NULL,
    type smallint NOT NULL,
    enabled boolean DEFAULT true NOT NULL,
    name text NOT NULL,
    description text,
    checksum text NOT NULL,
    scope jsonb DEFAULT '{}'::jsonb NOT NULL,
    security_policy_management_project_id bigint NOT NULL,
    content jsonb DEFAULT '{}'::jsonb NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT check_3fa0f29e4b CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_966e08b242 CHECK ((char_length(checksum) <= 255))
);

CREATE SEQUENCE security_policies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_policies_id_seq OWNED BY security_policies.id;

CREATE TABLE security_policy_project_links (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    security_policy_id bigint NOT NULL
);

CREATE SEQUENCE security_policy_project_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_policy_project_links_id_seq OWNED BY security_policy_project_links.id;

CREATE TABLE security_policy_requirements (
    id bigint NOT NULL,
    compliance_framework_security_policy_id bigint NOT NULL,
    compliance_requirement_id bigint NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE security_policy_requirements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_policy_requirements_id_seq OWNED BY security_policy_requirements.id;

CREATE TABLE security_policy_settings (
    id bigint NOT NULL,
    csp_namespace_id bigint,
    singleton boolean DEFAULT true NOT NULL,
    organization_id bigint NOT NULL
);

COMMENT ON COLUMN security_policy_settings.singleton IS 'Always true, used for singleton enforcement';

CREATE SEQUENCE security_policy_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_policy_settings_id_seq OWNED BY security_policy_settings.id;

CREATE TABLE security_scans (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    build_id bigint NOT NULL,
    scan_type smallint NOT NULL,
    info jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    pipeline_id bigint,
    latest boolean DEFAULT true NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    findings_partition_number integer DEFAULT 1 NOT NULL
);

CREATE SEQUENCE security_scans_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_scans_id_seq OWNED BY security_scans.id;

CREATE TABLE security_training_providers (
    id bigint NOT NULL,
    name text NOT NULL,
    description text,
    url text NOT NULL,
    logo_url text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_544b3dc935 CHECK ((char_length(url) <= 512)),
    CONSTRAINT check_6fe222f071 CHECK ((char_length(logo_url) <= 512)),
    CONSTRAINT check_a8ff21ced5 CHECK ((char_length(description) <= 512)),
    CONSTRAINT check_dae433eed6 CHECK ((char_length(name) <= 256))
);

CREATE SEQUENCE security_training_providers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_training_providers_id_seq OWNED BY security_training_providers.id;

CREATE TABLE security_trainings (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    provider_id bigint NOT NULL,
    is_primary boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE security_trainings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE security_trainings_id_seq OWNED BY security_trainings.id;

CREATE TABLE sent_notifications (
    project_id bigint,
    noteable_id bigint,
    noteable_type character varying,
    recipient_id bigint,
    commit_id character varying,
    reply_key character varying NOT NULL,
    in_reply_to_discussion_id character varying,
    id bigint NOT NULL,
    issue_email_participant_id bigint,
    created_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL
);

CREATE SEQUENCE sent_notifications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sent_notifications_id_seq OWNED BY sent_notifications.id;

CREATE TABLE sentry_issues (
    id bigint NOT NULL,
    issue_id bigint NOT NULL,
    sentry_issue_identifier bigint NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_7c50ed861c CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE sentry_issues_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sentry_issues_id_seq OWNED BY sentry_issues.id;

CREATE TABLE service_access_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    encrypted_token bytea NOT NULL,
    encrypted_token_iv bytea NOT NULL,
    expires_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE service_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE service_access_tokens_id_seq OWNED BY service_access_tokens.id;

CREATE TABLE service_desk_custom_email_credentials (
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    smtp_port integer,
    smtp_address text,
    encrypted_smtp_username bytea,
    encrypted_smtp_username_iv bytea,
    encrypted_smtp_password bytea,
    encrypted_smtp_password_iv bytea,
    smtp_authentication smallint,
    CONSTRAINT check_6dd11e956a CHECK ((char_length(smtp_address) <= 255))
);

CREATE TABLE service_desk_custom_email_verifications (
    project_id bigint NOT NULL,
    triggerer_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    triggered_at timestamp with time zone,
    state smallint DEFAULT 0 NOT NULL,
    error smallint,
    encrypted_token bytea,
    encrypted_token_iv bytea
);

CREATE TABLE service_desk_settings (
    project_id bigint NOT NULL,
    issue_template_key character varying(255),
    outgoing_name character varying(255),
    project_key character varying(255),
    file_template_project_id bigint,
    custom_email_enabled boolean DEFAULT false NOT NULL,
    custom_email text,
    service_desk_enabled boolean DEFAULT true NOT NULL,
    add_external_participants_from_cc boolean DEFAULT false NOT NULL,
    reopen_issue_on_external_participant_note boolean DEFAULT false NOT NULL,
    tickets_confidential_by_default boolean DEFAULT true NOT NULL,
    CONSTRAINT check_57a79552e1 CHECK ((char_length(custom_email) <= 255))
);

CREATE SEQUENCE shards_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE shards_id_seq OWNED BY shards.id;

CREATE TABLE slack_api_scopes (
    id bigint NOT NULL,
    name text NOT NULL,
    CONSTRAINT check_738678187a CHECK ((char_length(name) <= 100))
);

CREATE SEQUENCE slack_api_scopes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE slack_api_scopes_id_seq OWNED BY slack_api_scopes.id;

CREATE TABLE slack_integrations (
    id bigint NOT NULL,
    team_id character varying NOT NULL,
    team_name character varying NOT NULL,
    alias character varying NOT NULL,
    user_id character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    bot_user_id text,
    encrypted_bot_access_token bytea,
    encrypted_bot_access_token_iv bytea,
    integration_id bigint,
    CONSTRAINT check_bc553aea8a CHECK ((char_length(bot_user_id) <= 255)),
    CONSTRAINT check_c9ca9ae80d CHECK ((integration_id IS NOT NULL))
);

CREATE SEQUENCE slack_integrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE slack_integrations_id_seq OWNED BY slack_integrations.id;

CREATE TABLE slack_integrations_scopes (
    id bigint NOT NULL,
    slack_api_scope_id bigint NOT NULL,
    slack_integration_id bigint NOT NULL
);

CREATE SEQUENCE slack_integrations_scopes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE slack_integrations_scopes_id_seq OWNED BY slack_integrations_scopes.id;

CREATE TABLE smartcard_identities (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    subject character varying NOT NULL,
    issuer character varying NOT NULL
);

CREATE SEQUENCE smartcard_identities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE smartcard_identities_id_seq OWNED BY smartcard_identities.id;

CREATE TABLE snippet_repository_states (
    id bigint NOT NULL,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    snippet_repository_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0,
    verification_checksum bytea,
    verification_failure text,
    CONSTRAINT check_0dabaefb7f CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE snippet_repository_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE snippet_repository_states_id_seq OWNED BY snippet_repository_states.id;

CREATE TABLE snippet_repository_storage_moves (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    snippet_id bigint NOT NULL,
    state smallint DEFAULT 1 NOT NULL,
    source_storage_name text NOT NULL,
    destination_storage_name text NOT NULL,
    error_message text,
    snippet_project_id bigint,
    snippet_organization_id bigint,
    CONSTRAINT check_4b127f0a5d CHECK ((num_nonnulls(snippet_organization_id, snippet_project_id) = 1)),
    CONSTRAINT check_a42ab83060 CHECK ((char_length(error_message) <= 256)),
    CONSTRAINT snippet_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)),
    CONSTRAINT snippet_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255))
);

CREATE SEQUENCE snippet_repository_storage_moves_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE snippet_repository_storage_moves_id_seq OWNED BY snippet_repository_storage_moves.id;

CREATE TABLE snippet_statistics (
    snippet_id bigint NOT NULL,
    repository_size bigint DEFAULT 0 NOT NULL,
    file_count bigint DEFAULT 0 NOT NULL,
    commit_count bigint DEFAULT 0 NOT NULL,
    snippet_project_id bigint,
    snippet_organization_id bigint
);

CREATE TABLE snippet_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE snippet_user_mentions (
    id bigint NOT NULL,
    snippet_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    note_id bigint,
    snippet_project_id bigint,
    snippet_organization_id bigint,
    CONSTRAINT check_25b8666c20 CHECK ((num_nonnulls(snippet_organization_id, snippet_project_id) = 1))
);

CREATE SEQUENCE snippet_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE snippet_user_mentions_id_seq OWNED BY snippet_user_mentions.id;

CREATE SEQUENCE snippets_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE snippets_id_seq OWNED BY snippets.id;

CREATE TABLE software_license_policies (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    software_license_id bigint,
    classification integer DEFAULT 0 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    scan_result_policy_id bigint,
    custom_software_license_id bigint,
    approval_policy_rule_id bigint,
    software_license_spdx_identifier text,
    CONSTRAINT check_986c4e5c59 CHECK ((char_length(software_license_spdx_identifier) <= 255))
);

CREATE SEQUENCE software_license_policies_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE software_license_policies_id_seq OWNED BY software_license_policies.id;

CREATE TABLE software_licenses (
    id bigint NOT NULL,
    name character varying NOT NULL,
    spdx_identifier character varying(255)
);

CREATE SEQUENCE software_licenses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE software_licenses_id_seq OWNED BY software_licenses.id;

CREATE TABLE spam_logs (
    id bigint NOT NULL,
    user_id bigint,
    source_ip character varying,
    user_agent character varying,
    via_api boolean,
    noteable_type character varying,
    title character varying,
    description text,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    submitted_as_ham boolean DEFAULT false NOT NULL,
    recaptcha_verified boolean DEFAULT false NOT NULL,
    target_id bigint
);

CREATE SEQUENCE spam_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE spam_logs_id_seq OWNED BY spam_logs.id;

CREATE TABLE sprints (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    start_date date,
    due_date date,
    group_id bigint,
    iid integer NOT NULL,
    cached_markdown_version integer,
    title text,
    title_html text,
    description text,
    description_html text,
    state_enum smallint DEFAULT 1 NOT NULL,
    iterations_cadence_id bigint,
    sequence integer,
    CONSTRAINT check_73910a3b6c CHECK ((group_id IS NOT NULL)),
    CONSTRAINT sprints_title CHECK ((char_length(title) <= 255))
);

CREATE SEQUENCE sprints_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE sprints_id_seq OWNED BY sprints.id;

CREATE TABLE ssh_signatures (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    key_id bigint,
    verification_status smallint DEFAULT 0 NOT NULL,
    commit_sha bytea NOT NULL,
    user_id bigint,
    key_fingerprint_sha256 bytea,
    author_email text,
    CONSTRAINT check_5ff707c7f9 CHECK ((char_length(author_email) <= 255))
);

CREATE SEQUENCE ssh_signatures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE ssh_signatures_id_seq OWNED BY ssh_signatures.id;

CREATE TABLE status_check_responses (
    id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    external_approval_rule_id bigint,
    sha bytea NOT NULL,
    external_status_check_id bigint NOT NULL,
    status smallint DEFAULT 0 NOT NULL,
    retried_at timestamp with time zone,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    project_id bigint,
    CONSTRAINT check_29114cce9c CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE status_check_responses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE status_check_responses_id_seq OWNED BY status_check_responses.id;

CREATE TABLE status_page_published_incidents (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_id bigint NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_8ab6fb2f34 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE status_page_published_incidents_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE status_page_published_incidents_id_seq OWNED BY status_page_published_incidents.id;

CREATE TABLE status_page_settings (
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    enabled boolean DEFAULT false NOT NULL,
    aws_s3_bucket_name character varying(63) NOT NULL,
    aws_region character varying(255) NOT NULL,
    aws_access_key character varying(255) NOT NULL,
    encrypted_aws_secret_key character varying(255) NOT NULL,
    encrypted_aws_secret_key_iv character varying(255) NOT NULL,
    status_page_url text,
    CONSTRAINT check_75a79cd992 CHECK ((char_length(status_page_url) <= 1024))
);

CREATE SEQUENCE status_page_settings_project_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE status_page_settings_project_id_seq OWNED BY status_page_settings.project_id;

CREATE TABLE subscription_add_on_purchases (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    subscription_add_on_id bigint NOT NULL,
    namespace_id bigint,
    quantity integer NOT NULL,
    expires_on date NOT NULL,
    purchase_xid text NOT NULL,
    last_assigned_users_refreshed_at timestamp with time zone,
    trial boolean DEFAULT false NOT NULL,
    started_at date,
    organization_id bigint NOT NULL,
    CONSTRAINT check_3313c4d200 CHECK ((char_length(purchase_xid) <= 255)),
    CONSTRAINT check_d79ce199b3 CHECK ((started_at IS NOT NULL))
);

CREATE SEQUENCE subscription_add_on_purchases_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE subscription_add_on_purchases_id_seq OWNED BY subscription_add_on_purchases.id;

CREATE TABLE subscription_add_ons (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name smallint NOT NULL,
    description text NOT NULL,
    CONSTRAINT check_4c39d15ada CHECK ((char_length(description) <= 512))
);

CREATE SEQUENCE subscription_add_ons_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE subscription_add_ons_id_seq OWNED BY subscription_add_ons.id;

CREATE TABLE subscription_seat_assignments (
    id bigint NOT NULL,
    namespace_id bigint,
    user_id bigint NOT NULL,
    last_activity_on timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    organization_id bigint NOT NULL,
    seat_type smallint
);

CREATE SEQUENCE subscription_seat_assignments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE subscription_seat_assignments_id_seq OWNED BY subscription_seat_assignments.id;

CREATE TABLE subscription_user_add_on_assignment_versions (
    id bigint NOT NULL,
    organization_id bigint NOT NULL,
    item_id bigint,
    purchase_id bigint,
    user_id bigint,
    created_at timestamp with time zone,
    item_type text NOT NULL,
    event text NOT NULL,
    namespace_path text,
    add_on_name text,
    whodunnit text,
    object jsonb,
    CONSTRAINT check_211bad6d65 CHECK ((char_length(item_type) <= 255)),
    CONSTRAINT check_34ca72be24 CHECK ((char_length(event) <= 255)),
    CONSTRAINT check_839913a25d CHECK ((char_length(namespace_path) <= 255)),
    CONSTRAINT check_9ceaa5668c CHECK ((char_length(add_on_name) <= 255)),
    CONSTRAINT check_e185bf0c82 CHECK ((char_length(whodunnit) <= 255))
);

CREATE SEQUENCE subscription_user_add_on_assignment_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE subscription_user_add_on_assignment_versions_id_seq OWNED BY subscription_user_add_on_assignment_versions.id;

CREATE TABLE subscription_user_add_on_assignments (
    id bigint NOT NULL,
    add_on_purchase_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    organization_id bigint,
    CONSTRAINT check_7d21f9cebf CHECK ((organization_id IS NOT NULL))
);

CREATE SEQUENCE subscription_user_add_on_assignments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE subscription_user_add_on_assignments_id_seq OWNED BY subscription_user_add_on_assignments.id;

CREATE TABLE subscriptions (
    id bigint NOT NULL,
    user_id bigint,
    subscribable_id bigint,
    subscribable_type character varying,
    subscribed boolean,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    project_id bigint
);

CREATE SEQUENCE subscriptions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE subscriptions_id_seq OWNED BY subscriptions.id;

CREATE TABLE suggestions (
    id bigint NOT NULL,
    relative_order smallint NOT NULL,
    applied boolean DEFAULT false NOT NULL,
    commit_id character varying,
    from_content text NOT NULL,
    to_content text NOT NULL,
    lines_above integer DEFAULT 0 NOT NULL,
    lines_below integer DEFAULT 0 NOT NULL,
    outdated boolean DEFAULT false NOT NULL,
    note_id bigint NOT NULL
);

CREATE SEQUENCE suggestions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE suggestions_id_seq OWNED BY suggestions.id;

CREATE TABLE system_access_group_microsoft_applications (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    group_id bigint NOT NULL,
    temp_source_id bigint,
    enabled boolean DEFAULT false NOT NULL,
    tenant_xid text NOT NULL,
    client_xid text NOT NULL,
    login_endpoint text DEFAULT 'https://login.microsoftonline.com'::text NOT NULL,
    graph_endpoint text DEFAULT 'https://graph.microsoft.com'::text NOT NULL,
    encrypted_client_secret bytea NOT NULL,
    encrypted_client_secret_iv bytea NOT NULL,
    CONSTRAINT check_027535e932 CHECK ((char_length(graph_endpoint) <= 255)),
    CONSTRAINT check_350406e92e CHECK ((char_length(login_endpoint) <= 255)),
    CONSTRAINT check_92ce93bc07 CHECK ((char_length(tenant_xid) <= 255)),
    CONSTRAINT check_f4c8cf8195 CHECK ((char_length(client_xid) <= 255))
);

COMMENT ON COLUMN system_access_group_microsoft_applications.temp_source_id IS 'Temporary column to store graph access tokens id';

CREATE SEQUENCE system_access_group_microsoft_applications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_access_group_microsoft_applications_id_seq OWNED BY system_access_group_microsoft_applications.id;

CREATE TABLE system_access_group_microsoft_graph_access_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    system_access_group_microsoft_application_id bigint,
    group_id bigint NOT NULL,
    temp_source_id bigint,
    expires_in integer NOT NULL,
    encrypted_token bytea NOT NULL,
    encrypted_token_iv bytea NOT NULL
);

COMMENT ON COLUMN system_access_group_microsoft_graph_access_tokens.temp_source_id IS 'Temporary column to store graph access tokens id';

CREATE SEQUENCE system_access_group_microsoft_graph_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_access_group_microsoft_graph_access_tokens_id_seq OWNED BY system_access_group_microsoft_graph_access_tokens.id;

CREATE TABLE system_access_instance_microsoft_applications (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    enabled boolean DEFAULT false NOT NULL,
    tenant_xid text NOT NULL,
    client_xid text NOT NULL,
    login_endpoint text DEFAULT 'https://login.microsoftonline.com'::text NOT NULL,
    graph_endpoint text DEFAULT 'https://graph.microsoft.com'::text NOT NULL,
    encrypted_client_secret bytea NOT NULL,
    encrypted_client_secret_iv bytea NOT NULL,
    CONSTRAINT check_75bf46c253 CHECK ((char_length(login_endpoint) <= 255)),
    CONSTRAINT check_80a40c5b74 CHECK ((char_length(client_xid) <= 255)),
    CONSTRAINT check_e00a5d3a61 CHECK ((char_length(graph_endpoint) <= 255)),
    CONSTRAINT check_e63bb275fa CHECK ((char_length(tenant_xid) <= 255))
);

CREATE SEQUENCE system_access_instance_microsoft_applications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_access_instance_microsoft_applications_id_seq OWNED BY system_access_instance_microsoft_applications.id;

CREATE TABLE system_access_instance_microsoft_graph_access_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    system_access_instance_microsoft_application_id bigint,
    expires_in integer NOT NULL,
    encrypted_token bytea NOT NULL,
    encrypted_token_iv bytea NOT NULL
);

CREATE SEQUENCE system_access_instance_microsoft_graph_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_access_instance_microsoft_graph_access_tokens_id_seq OWNED BY system_access_instance_microsoft_graph_access_tokens.id;

CREATE TABLE system_access_microsoft_applications (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    enabled boolean DEFAULT false NOT NULL,
    tenant_xid text NOT NULL,
    client_xid text NOT NULL,
    login_endpoint text DEFAULT 'https://login.microsoftonline.com'::text NOT NULL,
    graph_endpoint text DEFAULT 'https://graph.microsoft.com'::text NOT NULL,
    encrypted_client_secret bytea NOT NULL,
    encrypted_client_secret_iv bytea NOT NULL,
    CONSTRAINT check_042f6b21aa CHECK ((char_length(login_endpoint) <= 255)),
    CONSTRAINT check_1e8b2d405f CHECK ((char_length(tenant_xid) <= 255)),
    CONSTRAINT check_339c3ffca8 CHECK ((char_length(graph_endpoint) <= 255)),
    CONSTRAINT check_ee72fb5459 CHECK ((char_length(client_xid) <= 255))
);

CREATE SEQUENCE system_access_microsoft_applications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_access_microsoft_applications_id_seq OWNED BY system_access_microsoft_applications.id;

CREATE TABLE system_access_microsoft_graph_access_tokens (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    system_access_microsoft_application_id bigint,
    expires_in integer NOT NULL,
    encrypted_token bytea NOT NULL,
    encrypted_token_iv bytea NOT NULL
);

CREATE SEQUENCE system_access_microsoft_graph_access_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_access_microsoft_graph_access_tokens_id_seq OWNED BY system_access_microsoft_graph_access_tokens.id;

CREATE TABLE system_note_metadata (
    commit_count integer,
    action character varying,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    description_version_id bigint,
    note_id bigint NOT NULL,
    id bigint NOT NULL
);

CREATE SEQUENCE system_note_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE system_note_metadata_id_seq OWNED BY system_note_metadata.id;

CREATE TABLE tags (
    id bigint NOT NULL,
    name character varying,
    taggings_count integer DEFAULT 0
);

CREATE SEQUENCE tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE tags_id_seq OWNED BY tags.id;

CREATE TABLE target_branch_rules (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    name text NOT NULL,
    target_branch text NOT NULL,
    CONSTRAINT check_3a0b12cf8c CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE target_branch_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE target_branch_rules_id_seq OWNED BY target_branch_rules.id;

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
);

CREATE SEQUENCE targeted_message_dismissals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE targeted_message_dismissals_id_seq OWNED BY targeted_message_dismissals.id;

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
);

CREATE SEQUENCE targeted_message_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE targeted_message_namespaces_id_seq OWNED BY targeted_message_namespaces.id;

CREATE TABLE targeted_messages (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    target_type smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE targeted_messages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE targeted_messages_id_seq OWNED BY targeted_messages.id;

CREATE TABLE term_agreements (
    id bigint NOT NULL,
    term_id bigint NOT NULL,
    user_id bigint NOT NULL,
    accepted boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE term_agreements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE term_agreements_id_seq OWNED BY term_agreements.id;

CREATE TABLE terraform_state_version_states (
    id bigint NOT NULL,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    terraform_state_version_id bigint NOT NULL,
    project_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint DEFAULT 0 NOT NULL,
    verification_checksum bytea,
    verification_failure text,
    CONSTRAINT check_dc0c9c9162 CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE terraform_state_version_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE terraform_state_version_states_id_seq OWNED BY terraform_state_version_states.id;

CREATE TABLE terraform_state_versions (
    id bigint NOT NULL,
    terraform_state_id bigint NOT NULL,
    created_by_user_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    version integer NOT NULL,
    file_store smallint NOT NULL,
    file text NOT NULL,
    verification_retry_count smallint,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    verification_checksum bytea,
    verification_failure text,
    ci_build_id bigint,
    verification_started_at timestamp with time zone,
    verification_state smallint DEFAULT 0 NOT NULL,
    project_id bigint,
    CONSTRAINT check_0824bb7bbd CHECK ((char_length(file) <= 255)),
    CONSTRAINT check_84142902f6 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT tf_state_versions_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE terraform_state_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE terraform_state_versions_id_seq OWNED BY terraform_state_versions.id;

CREATE TABLE terraform_states (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store smallint,
    file character varying(255),
    lock_xid character varying(255),
    locked_at timestamp with time zone,
    locked_by_user_id bigint,
    uuid character varying(32) NOT NULL,
    name character varying(255) NOT NULL,
    versioning_enabled boolean DEFAULT true NOT NULL,
    deleted_at timestamp with time zone,
    activerecord_lock_version integer DEFAULT 0 NOT NULL
);

CREATE SEQUENCE terraform_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE terraform_states_id_seq OWNED BY terraform_states.id;

CREATE TABLE timelog_categories (
    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,
    billing_rate numeric(18,4) DEFAULT 0.0,
    billable boolean DEFAULT false NOT NULL,
    name text NOT NULL,
    description text,
    color text DEFAULT '#6699cc'::text NOT NULL,
    CONSTRAINT check_37ad5f23d7 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_4ba862ba3e CHECK ((char_length(color) <= 7)),
    CONSTRAINT check_c4b8aec13a CHECK ((char_length(description) <= 1024))
);

CREATE SEQUENCE timelog_categories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE timelog_categories_id_seq OWNED BY timelog_categories.id;

CREATE TABLE timelogs (
    id bigint NOT NULL,
    time_spent integer NOT NULL,
    user_id bigint,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    issue_id bigint,
    merge_request_id bigint,
    spent_at timestamp without time zone DEFAULT now(),
    project_id bigint,
    summary text,
    note_id bigint,
    timelog_category_id bigint,
    CONSTRAINT check_271d321699 CHECK ((char_length(summary) <= 255))
);

CREATE SEQUENCE timelogs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE timelogs_id_seq OWNED BY timelogs.id;

CREATE TABLE todos (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint,
    target_id bigint,
    target_type character varying NOT NULL,
    author_id bigint NOT NULL,
    action integer NOT NULL,
    state character varying NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    commit_id character varying,
    group_id bigint,
    resolved_by_action smallint,
    note_id bigint,
    snoozed_until timestamp with time zone
);

CREATE SEQUENCE todos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE todos_id_seq OWNED BY todos.id;

CREATE TABLE topics (
    id bigint NOT NULL,
    name text NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    avatar text,
    description text,
    total_projects_count bigint DEFAULT 0 NOT NULL,
    non_private_projects_count bigint DEFAULT 0 NOT NULL,
    title text,
    slug text,
    organization_id bigint NOT NULL,
    cached_markdown_version integer DEFAULT 0 NOT NULL,
    description_html text,
    CONSTRAINT check_0eda72aeb0 CHECK ((char_length(slug) <= 255)),
    CONSTRAINT check_223b50f9be CHECK ((char_length(title) <= 255)),
    CONSTRAINT check_26753fb43a CHECK ((char_length(avatar) <= 255)),
    CONSTRAINT check_5d1a07c8c8 CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_7a90d4c757 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_7c7a7b2c84 CHECK ((char_length(description_html) <= 50000))
);

CREATE SEQUENCE topics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE topics_id_seq OWNED BY topics.id;

CREATE TABLE trending_projects (
    id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE SEQUENCE trending_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE trending_projects_id_seq OWNED BY trending_projects.id;

CREATE TABLE upcoming_reconciliations (
    id bigint NOT NULL,
    namespace_id bigint,
    next_reconciliation_date date NOT NULL,
    display_alert_from date NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    organization_id bigint NOT NULL
);

CREATE SEQUENCE upcoming_reconciliations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE upcoming_reconciliations_id_seq OWNED BY upcoming_reconciliations.id;

CREATE TABLE upload_states (
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    upload_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    CONSTRAINT check_7396dc8591 CHECK ((char_length(verification_failure) <= 255))
);

CREATE SEQUENCE upload_states_upload_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE upload_states_upload_id_seq OWNED BY upload_states.upload_id;

CREATE TABLE uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    path character varying(511) NOT NULL,
    checksum character varying(64),
    model_id bigint,
    model_type character varying,
    uploader character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    store integer DEFAULT 1,
    mount_point character varying,
    secret character varying,
    version integer DEFAULT 1 NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    CONSTRAINT check_5e9547379c CHECK ((store IS NOT NULL))
);

CREATE SEQUENCE uploads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE uploads_id_seq OWNED BY uploads.id;

CREATE TABLE user_achievements (
    id bigint NOT NULL,
    achievement_id bigint NOT NULL,
    user_id bigint NOT NULL,
    awarded_by_user_id bigint,
    revoked_by_user_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    revoked_at timestamp with time zone,
    priority integer,
    namespace_id bigint,
    show_on_profile boolean DEFAULT true NOT NULL,
    CONSTRAINT check_2236a10887 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE user_achievements_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_achievements_id_seq OWNED BY user_achievements.id;

CREATE TABLE user_admin_roles (
    user_id bigint NOT NULL,
    admin_role_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    ldap boolean DEFAULT false NOT NULL
);

CREATE TABLE user_agent_details (
    id bigint NOT NULL,
    user_agent character varying NOT NULL,
    ip_address character varying NOT NULL,
    subject_id bigint NOT NULL,
    subject_type character varying NOT NULL,
    submitted boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);

CREATE SEQUENCE user_agent_details_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_agent_details_id_seq OWNED BY user_agent_details.id;

CREATE TABLE user_broadcast_message_dismissals (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    broadcast_message_id bigint NOT NULL,
    expires_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE user_broadcast_message_dismissals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_broadcast_message_dismissals_id_seq OWNED BY user_broadcast_message_dismissals.id;

CREATE TABLE user_callouts (
    id bigint NOT NULL,
    feature_name integer NOT NULL,
    user_id bigint NOT NULL,
    dismissed_at timestamp with time zone
);

CREATE SEQUENCE user_callouts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_callouts_id_seq OWNED BY user_callouts.id;

CREATE TABLE user_credit_card_validations (
    user_id bigint NOT NULL,
    credit_card_validated_at timestamp with time zone NOT NULL,
    last_digits_hash text,
    holder_name_hash text,
    expiration_date_hash text,
    network_hash text,
    zuora_payment_method_xid text,
    stripe_setup_intent_xid text,
    stripe_payment_method_xid text,
    stripe_card_fingerprint text,
    CONSTRAINT check_126615a57d CHECK ((char_length(stripe_payment_method_xid) <= 255)),
    CONSTRAINT check_209503e313 CHECK ((char_length(stripe_card_fingerprint) <= 255)),
    CONSTRAINT check_5d9e69ede5 CHECK ((char_length(stripe_setup_intent_xid) <= 255)),
    CONSTRAINT check_7721e1961a CHECK ((char_length(network_hash) <= 44)),
    CONSTRAINT check_83f1e2ace3 CHECK ((char_length(expiration_date_hash) <= 44)),
    CONSTRAINT check_9a15d14e37 CHECK ((char_length(zuora_payment_method_xid) <= 50)),
    CONSTRAINT check_aca7c2607c CHECK ((char_length(holder_name_hash) <= 44)),
    CONSTRAINT check_f5c35b1a6e CHECK ((char_length(last_digits_hash) <= 44))
);

CREATE TABLE user_custom_attributes (
    id bigint NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    user_id bigint NOT NULL,
    key character varying NOT NULL,
    value character varying NOT NULL
);

CREATE SEQUENCE user_custom_attributes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_custom_attributes_id_seq OWNED BY user_custom_attributes.id;

CREATE TABLE user_details (
    user_id bigint NOT NULL,
    job_title character varying(200) DEFAULT ''::character varying NOT NULL,
    bio character varying(255) DEFAULT ''::character varying NOT NULL,
    webauthn_xid text,
    provisioned_by_group_id bigint,
    pronouns text,
    pronunciation text,
    registration_objective smallint,
    phone text,
    linkedin text DEFAULT ''::text NOT NULL,
    twitter text DEFAULT ''::text NOT NULL,
    skype text DEFAULT ''::text NOT NULL,
    website_url text DEFAULT ''::text NOT NULL,
    location text DEFAULT ''::text NOT NULL,
    organization text DEFAULT ''::text NOT NULL,
    password_last_changed_at timestamp with time zone DEFAULT now() NOT NULL,
    discord text DEFAULT ''::text NOT NULL,
    enterprise_group_id bigint,
    enterprise_group_associated_at timestamp with time zone,
    email_reset_offered_at timestamp with time zone,
    mastodon text DEFAULT ''::text NOT NULL,
    project_authorizations_recalculated_at timestamp with time zone DEFAULT '2010-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
    onboarding_status jsonb DEFAULT '{}'::jsonb NOT NULL,
    bluesky text DEFAULT ''::text NOT NULL,
    bot_namespace_id bigint,
    orcid text DEFAULT ''::text NOT NULL,
    github text DEFAULT ''::text NOT NULL,
    email_otp text,
    email_otp_last_sent_to text,
    email_otp_last_sent_at timestamp with time zone,
    email_otp_required_after timestamp with time zone,
    CONSTRAINT check_18a53381cd CHECK ((char_length(bluesky) <= 256)),
    CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)),
    CONSTRAINT check_444573ee52 CHECK ((char_length(skype) <= 500)),
    CONSTRAINT check_466a25be35 CHECK ((char_length(twitter) <= 500)),
    CONSTRAINT check_4925cf9fd2 CHECK ((char_length(email_otp_last_sent_to) <= 511)),
    CONSTRAINT check_4ef1de1a15 CHECK ((char_length(discord) <= 500)),
    CONSTRAINT check_7b246dad73 CHECK ((char_length(organization) <= 500)),
    CONSTRAINT check_7d6489f8f3 CHECK ((char_length(linkedin) <= 500)),
    CONSTRAINT check_7fe2044093 CHECK ((char_length(website_url) <= 500)),
    CONSTRAINT check_8a7fcf8a60 CHECK ((char_length(location) <= 500)),
    CONSTRAINT check_99b0365865 CHECK ((char_length(orcid) <= 256)),
    CONSTRAINT check_a73b398c60 CHECK ((char_length(phone) <= 50)),
    CONSTRAINT check_bbe110f371 CHECK ((char_length(github) <= 500)),
    CONSTRAINT check_ec514a06ad CHECK ((char_length(email_otp) <= 64)),
    CONSTRAINT check_eeeaf8d4f0 CHECK ((char_length(pronouns) <= 50)),
    CONSTRAINT check_f1a8a05b9a CHECK ((char_length(mastodon) <= 500)),
    CONSTRAINT check_f932ed37db CHECK ((char_length(pronunciation) <= 255))
);

COMMENT ON COLUMN user_details.phone IS 'JiHu-specific column';

COMMENT ON COLUMN user_details.password_last_changed_at IS 'JiHu-specific column';

COMMENT ON COLUMN user_details.email_otp IS 'SHA256 hash (64 hex characters)';

CREATE SEQUENCE user_details_user_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_details_user_id_seq OWNED BY user_details.user_id;

CREATE TABLE user_follow_users (
    follower_id bigint NOT NULL,
    followee_id bigint NOT NULL
);

CREATE TABLE user_group_callouts (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    group_id bigint NOT NULL,
    feature_name smallint NOT NULL,
    dismissed_at timestamp with time zone
);

CREATE SEQUENCE user_group_callouts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_group_callouts_id_seq OWNED BY user_group_callouts.id;

CREATE TABLE user_group_member_roles (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    group_id bigint NOT NULL,
    shared_with_group_id bigint,
    member_role_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE user_group_member_roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_group_member_roles_id_seq OWNED BY user_group_member_roles.id;

CREATE TABLE user_highest_roles (
    user_id bigint NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    highest_access_level integer
);

CREATE TABLE user_member_roles (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    member_role_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    ldap boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE user_member_roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_member_roles_id_seq OWNED BY user_member_roles.id;

CREATE TABLE user_namespace_callouts (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    dismissed_at timestamp with time zone,
    feature_name smallint NOT NULL
);

CREATE SEQUENCE user_namespace_callouts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_namespace_callouts_id_seq OWNED BY user_namespace_callouts.id;

CREATE TABLE user_permission_export_upload_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE user_permission_export_uploads (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    file_store integer,
    status smallint DEFAULT 0 NOT NULL,
    file text,
    CONSTRAINT check_1956806648 CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE user_permission_export_uploads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_permission_export_uploads_id_seq OWNED BY user_permission_export_uploads.id;

CREATE TABLE user_phone_number_validations (
    user_id bigint NOT NULL,
    validated_at timestamp with time zone,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    international_dial_code smallint NOT NULL,
    verification_attempts smallint DEFAULT 0 NOT NULL,
    risk_score smallint DEFAULT 0 NOT NULL,
    country text NOT NULL,
    phone_number text NOT NULL,
    telesign_reference_xid text,
    sms_sent_at timestamp with time zone,
    sms_send_count smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_193736da9f CHECK ((char_length(country) <= 3)),
    CONSTRAINT check_d2f31fc815 CHECK ((char_length(phone_number) <= 12)),
    CONSTRAINT check_d7af4d3eb5 CHECK ((char_length(telesign_reference_xid) <= 255))
);

CREATE TABLE user_preferences (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    issue_notes_filter smallint DEFAULT 0 NOT NULL,
    merge_request_notes_filter smallint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    epics_sort character varying,
    roadmap_epics_state integer,
    epic_notes_filter smallint DEFAULT 0 NOT NULL,
    issues_sort character varying,
    merge_requests_sort character varying,
    roadmaps_sort character varying,
    first_day_of_week integer,
    timezone character varying,
    time_display_relative boolean DEFAULT true,
    projects_sort character varying(64),
    show_whitespace_in_diffs boolean DEFAULT true NOT NULL,
    sourcegraph_enabled boolean,
    setup_for_company boolean,
    render_whitespace_in_code boolean DEFAULT false,
    tab_width smallint DEFAULT 8,
    view_diffs_file_by_file boolean DEFAULT false NOT NULL,
    gitpod_enabled boolean DEFAULT false NOT NULL,
    markdown_surround_selection boolean DEFAULT true NOT NULL,
    diffs_deletion_color text,
    diffs_addition_color text,
    markdown_automatic_lists boolean DEFAULT true NOT NULL,
    use_new_navigation boolean,
    achievements_enabled boolean DEFAULT true NOT NULL,
    pinned_nav_items jsonb DEFAULT '{}'::jsonb NOT NULL,
    pass_user_identities_to_ci_jwt boolean DEFAULT false NOT NULL,
    enabled_following boolean DEFAULT true NOT NULL,
    visibility_pipeline_id_type smallint DEFAULT 0 NOT NULL,
    project_shortcut_buttons boolean DEFAULT true NOT NULL,
    enabled_zoekt boolean DEFAULT true NOT NULL,
    keyboard_shortcuts_enabled boolean DEFAULT true NOT NULL,
    time_display_format smallint DEFAULT 0 NOT NULL,
    home_organization_id bigint,
    early_access_program_participant boolean DEFAULT false NOT NULL,
    early_access_program_tracking boolean DEFAULT false NOT NULL,
    extensions_marketplace_opt_in_status smallint DEFAULT 0 NOT NULL,
    organization_groups_projects_sort text,
    organization_groups_projects_display smallint DEFAULT 1 NOT NULL,
    dpop_enabled boolean DEFAULT false NOT NULL,
    use_work_items_view boolean DEFAULT false NOT NULL,
    text_editor_type smallint DEFAULT 0 NOT NULL,
    merge_request_dashboard_list_type smallint DEFAULT 0 NOT NULL,
    extensions_marketplace_opt_in_url text,
    dark_color_scheme_id smallint,
    work_items_display_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    default_duo_add_on_assignment_id bigint,
    markdown_maintain_indentation boolean DEFAULT false NOT NULL,
    CONSTRAINT check_1d670edc68 CHECK ((time_display_relative IS NOT NULL)),
    CONSTRAINT check_89bf269f41 CHECK ((char_length(diffs_deletion_color) <= 7)),
    CONSTRAINT check_9b50d9f942 CHECK ((char_length(extensions_marketplace_opt_in_url) <= 512)),
    CONSTRAINT check_b1306f8875 CHECK ((char_length(organization_groups_projects_sort) <= 64)),
    CONSTRAINT check_b22446f91a CHECK ((render_whitespace_in_code IS NOT NULL)),
    CONSTRAINT check_d07ccd35f7 CHECK ((char_length(diffs_addition_color) <= 7)),
    CONSTRAINT check_d3248b1b9c CHECK ((tab_width IS NOT NULL))
);

CREATE SEQUENCE user_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_preferences_id_seq OWNED BY user_preferences.id;

CREATE TABLE user_project_callouts (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint NOT NULL,
    feature_name smallint NOT NULL,
    dismissed_at timestamp with time zone
);

CREATE SEQUENCE user_project_callouts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_project_callouts_id_seq OWNED BY user_project_callouts.id;

CREATE TABLE user_statuses (
    user_id bigint NOT NULL,
    cached_markdown_version integer,
    emoji character varying DEFAULT 'speech_balloon'::character varying NOT NULL,
    message character varying(100),
    message_html character varying,
    availability smallint DEFAULT 0 NOT NULL,
    clear_status_at timestamp with time zone
);

CREATE SEQUENCE user_statuses_user_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_statuses_user_id_seq OWNED BY user_statuses.user_id;

CREATE TABLE user_synced_attributes_metadata (
    id bigint NOT NULL,
    name_synced boolean DEFAULT false,
    email_synced boolean DEFAULT false,
    location_synced boolean DEFAULT false,
    user_id bigint NOT NULL,
    provider character varying,
    organization_synced boolean DEFAULT false,
    job_title_synced boolean DEFAULT false
);

CREATE SEQUENCE user_synced_attributes_metadata_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE user_synced_attributes_metadata_id_seq OWNED BY user_synced_attributes_metadata.id;

CREATE TABLE user_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE users_id_seq OWNED BY users.id;

CREATE TABLE users_ops_dashboard_projects (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE SEQUENCE users_ops_dashboard_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE users_ops_dashboard_projects_id_seq OWNED BY users_ops_dashboard_projects.id;

CREATE TABLE users_security_dashboard_projects (
    user_id bigint NOT NULL,
    project_id bigint NOT NULL
);

CREATE TABLE users_star_projects (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);

CREATE SEQUENCE users_star_projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE users_star_projects_id_seq OWNED BY users_star_projects.id;

CREATE TABLE users_statistics (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    without_groups_and_projects integer DEFAULT 0 NOT NULL,
    with_highest_role_guest integer DEFAULT 0 NOT NULL,
    with_highest_role_reporter integer DEFAULT 0 NOT NULL,
    with_highest_role_developer integer DEFAULT 0 NOT NULL,
    with_highest_role_maintainer integer DEFAULT 0 NOT NULL,
    with_highest_role_owner integer DEFAULT 0 NOT NULL,
    bots integer DEFAULT 0 NOT NULL,
    blocked integer DEFAULT 0 NOT NULL,
    with_highest_role_minimal_access integer DEFAULT 0 NOT NULL,
    with_highest_role_guest_with_custom_role integer DEFAULT 0 NOT NULL,
    with_highest_role_planner integer DEFAULT 0 NOT NULL
);

CREATE SEQUENCE users_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE users_statistics_id_seq OWNED BY users_statistics.id;

CREATE TABLE value_stream_dashboard_aggregations (
    namespace_id bigint NOT NULL,
    last_run_at timestamp with time zone,
    enabled boolean DEFAULT true NOT NULL
);

CREATE SEQUENCE value_stream_dashboard_counts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE value_stream_dashboard_counts_id_seq OWNED BY value_stream_dashboard_counts.id;

CREATE TABLE virtual_registries_packages_maven_registries (
    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,
    name text DEFAULT ''::text NOT NULL,
    description text,
    CONSTRAINT check_1c00ac80ea CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_ee44adc558 CHECK ((char_length(description) <= 1024))
);

CREATE SEQUENCE virtual_registries_packages_maven_registries_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE virtual_registries_packages_maven_registries_id_seq OWNED BY virtual_registries_packages_maven_registries.id;

CREATE TABLE virtual_registries_packages_maven_registry_upstreams (
    id bigint NOT NULL,
    group_id bigint NOT NULL,
    registry_id bigint NOT NULL,
    upstream_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    "position" smallint DEFAULT 1 NOT NULL,
    CONSTRAINT check_8e8de60b63 CHECK (((1 <= "position") AND ("position" <= 20)))
);

CREATE SEQUENCE virtual_registries_packages_maven_registry_upstreams_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE virtual_registries_packages_maven_registry_upstreams_id_seq OWNED BY virtual_registries_packages_maven_registry_upstreams.id;

CREATE TABLE virtual_registries_packages_maven_upstreams (
    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,
    url text NOT NULL,
    cache_validity_hours smallint DEFAULT 24 NOT NULL,
    username jsonb,
    password jsonb,
    name text DEFAULT ''::text NOT NULL,
    description text,
    CONSTRAINT check_26c0572777 CHECK ((char_length(url) <= 255)),
    CONSTRAINT check_4db365ecc9 CHECK (((num_nonnulls(username, password) = 2) OR (num_nulls(username, password) = 2))),
    CONSTRAINT check_a3593dca3a CHECK ((cache_validity_hours >= 0)),
    CONSTRAINT check_c827be970e CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_f92d4b3613 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE virtual_registries_packages_maven_upstreams_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE virtual_registries_packages_maven_upstreams_id_seq OWNED BY virtual_registries_packages_maven_upstreams.id;

CREATE TABLE vs_code_settings (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    setting_type text NOT NULL,
    content text NOT NULL,
    uuid uuid,
    version integer DEFAULT 0,
    settings_context_hash text,
    CONSTRAINT check_2082c35541 CHECK ((version IS NOT NULL)),
    CONSTRAINT check_4680ca265d CHECK ((uuid IS NOT NULL)),
    CONSTRAINT check_5da3b2910b CHECK ((char_length(content) <= 524288)),
    CONSTRAINT check_6d5f15039b CHECK ((char_length(settings_context_hash) <= 255)),
    CONSTRAINT check_994c503fc4 CHECK ((char_length(setting_type) <= 256)),
    CONSTRAINT check_vs_code_settings_settings_context_hash_nullable CHECK ((((setting_type = 'extensions'::text) AND (settings_context_hash IS NOT NULL)) OR ((setting_type <> 'extensions'::text) AND (settings_context_hash IS NULL))))
);

CREATE SEQUENCE vs_code_settings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vs_code_settings_id_seq OWNED BY vs_code_settings.id;

CREATE TABLE vulnerabilities (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    author_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    title character varying(255) NOT NULL,
    title_html text,
    description text,
    description_html text,
    state smallint DEFAULT 1 NOT NULL,
    severity smallint NOT NULL,
    severity_overridden boolean DEFAULT false,
    resolved_by_id bigint,
    resolved_at timestamp with time zone,
    report_type smallint NOT NULL,
    cached_markdown_version integer,
    confirmed_by_id bigint,
    confirmed_at timestamp with time zone,
    dismissed_at timestamp with time zone,
    dismissed_by_id bigint,
    resolved_on_default_branch boolean DEFAULT false NOT NULL,
    present_on_default_branch boolean DEFAULT true NOT NULL,
    detected_at timestamp with time zone DEFAULT now(),
    finding_id bigint,
    cvss jsonb DEFAULT '[]'::jsonb,
    auto_resolved boolean DEFAULT false NOT NULL,
    CONSTRAINT check_4d8a873f1f CHECK ((finding_id IS NOT NULL))
);

CREATE SEQUENCE vulnerabilities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerabilities_id_seq OWNED BY vulnerabilities.id;

CREATE TABLE vulnerability_archive_export_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE SEQUENCE vulnerability_archive_exports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_archive_exports_id_seq OWNED BY vulnerability_archive_exports.id;

CREATE SEQUENCE vulnerability_archived_records_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_archived_records_id_seq OWNED BY vulnerability_archived_records.id;

CREATE SEQUENCE vulnerability_archives_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_archives_id_seq OWNED BY vulnerability_archives.id;

CREATE TABLE vulnerability_export_part_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE vulnerability_export_parts (
    id bigint NOT NULL,
    vulnerability_export_id bigint NOT NULL,
    start_id bigint NOT NULL,
    end_id bigint NOT NULL,
    organization_id bigint NOT NULL,
    file_store integer,
    file text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_baded21d39 CHECK ((char_length(file) <= 255))
);

CREATE SEQUENCE vulnerability_export_parts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_export_parts_id_seq OWNED BY vulnerability_export_parts.id;

CREATE TABLE vulnerability_export_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE vulnerability_exports (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    started_at timestamp with time zone,
    finished_at timestamp with time zone,
    status character varying(255) NOT NULL,
    file character varying(255),
    project_id bigint,
    author_id bigint NOT NULL,
    file_store integer,
    format smallint DEFAULT 0 NOT NULL,
    group_id bigint,
    organization_id bigint NOT NULL,
    expires_at timestamp with time zone,
    send_email boolean DEFAULT false NOT NULL,
    report_data jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE vulnerability_exports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_exports_id_seq OWNED BY vulnerability_exports.id;

CREATE TABLE vulnerability_external_issue_links (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    author_id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    link_type smallint DEFAULT 1 NOT NULL,
    external_type smallint DEFAULT 1 NOT NULL,
    external_project_key text NOT NULL,
    external_issue_key text NOT NULL,
    project_id bigint,
    CONSTRAINT check_3200604f5e CHECK ((char_length(external_issue_key) <= 255)),
    CONSTRAINT check_68cffd19b0 CHECK ((char_length(external_project_key) <= 255)),
    CONSTRAINT check_9bbcf5afdd CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_external_issue_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_external_issue_links_id_seq OWNED BY vulnerability_external_issue_links.id;

CREATE TABLE vulnerability_feedback (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    feedback_type smallint NOT NULL,
    category smallint NOT NULL,
    project_id bigint NOT NULL,
    author_id bigint NOT NULL,
    issue_id bigint,
    merge_request_id bigint,
    comment_author_id bigint,
    comment text,
    comment_timestamp timestamp with time zone,
    finding_uuid uuid,
    dismissal_reason smallint,
    migrated_to_state_transition boolean DEFAULT false,
    pipeline_id bigint
);

CREATE SEQUENCE vulnerability_feedback_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id;

CREATE TABLE vulnerability_finding_evidences (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    vulnerability_occurrence_id bigint NOT NULL,
    data jsonb DEFAULT '{}'::jsonb NOT NULL,
    project_id bigint,
    CONSTRAINT check_e8f37f70eb CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_finding_evidences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_finding_evidences_id_seq OWNED BY vulnerability_finding_evidences.id;

CREATE TABLE vulnerability_finding_links (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    vulnerability_occurrence_id bigint NOT NULL,
    name text,
    url text NOT NULL,
    project_id bigint,
    CONSTRAINT check_3dd0293472 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_55f0a95439 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_b7fe886df6 CHECK ((char_length(url) <= 2048))
);

CREATE SEQUENCE vulnerability_finding_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_finding_links_id_seq OWNED BY vulnerability_finding_links.id;

CREATE TABLE vulnerability_finding_signatures (
    id bigint NOT NULL,
    finding_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    algorithm_type smallint NOT NULL,
    signature_sha bytea NOT NULL,
    project_id bigint,
    CONSTRAINT check_f4ab9ffc5a CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_finding_signatures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_finding_signatures_id_seq OWNED BY vulnerability_finding_signatures.id;

CREATE TABLE vulnerability_findings_remediations (
    id bigint NOT NULL,
    vulnerability_occurrence_id bigint,
    vulnerability_remediation_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_65e61a488a CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_findings_remediations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_findings_remediations_id_seq OWNED BY vulnerability_findings_remediations.id;

CREATE TABLE vulnerability_flags (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    vulnerability_occurrence_id bigint NOT NULL,
    flag_type smallint DEFAULT 0 NOT NULL,
    origin text NOT NULL,
    description text NOT NULL,
    project_id bigint,
    CONSTRAINT check_36177ddefa CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_45e743349f CHECK ((char_length(description) <= 1024)),
    CONSTRAINT check_49c1d00032 CHECK ((char_length(origin) <= 255))
);

CREATE SEQUENCE vulnerability_flags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_flags_id_seq OWNED BY vulnerability_flags.id;

CREATE TABLE vulnerability_historical_statistics (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    total integer DEFAULT 0 NOT NULL,
    critical integer DEFAULT 0 NOT NULL,
    high integer DEFAULT 0 NOT NULL,
    medium integer DEFAULT 0 NOT NULL,
    low integer DEFAULT 0 NOT NULL,
    unknown integer DEFAULT 0 NOT NULL,
    info integer DEFAULT 0 NOT NULL,
    date date NOT NULL,
    letter_grade smallint NOT NULL
);

CREATE SEQUENCE vulnerability_historical_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_historical_statistics_id_seq OWNED BY vulnerability_historical_statistics.id;

CREATE TABLE vulnerability_identifiers (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    fingerprint bytea NOT NULL,
    external_type character varying NOT NULL,
    external_id character varying NOT NULL,
    name character varying NOT NULL,
    url text
);

CREATE SEQUENCE vulnerability_identifiers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_identifiers_id_seq OWNED BY vulnerability_identifiers.id;

CREATE TABLE vulnerability_issue_links (
    id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    link_type smallint DEFAULT 1 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_55acc7b923 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_issue_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_issue_links_id_seq OWNED BY vulnerability_issue_links.id;

CREATE TABLE vulnerability_management_policy_rules (
    id bigint NOT NULL,
    security_policy_id bigint NOT NULL,
    security_policy_management_project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    rule_index smallint NOT NULL,
    type smallint NOT NULL,
    content jsonb DEFAULT '{}'::jsonb NOT NULL
);

CREATE SEQUENCE vulnerability_management_policy_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_management_policy_rules_id_seq OWNED BY vulnerability_management_policy_rules.id;

CREATE TABLE vulnerability_merge_request_links (
    id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    merge_request_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint,
    CONSTRAINT check_341035683b CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_merge_request_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_merge_request_links_id_seq OWNED BY vulnerability_merge_request_links.id;

CREATE TABLE vulnerability_namespace_historical_statistics (
    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,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
    total integer DEFAULT 0 NOT NULL,
    critical integer DEFAULT 0 NOT NULL,
    high integer DEFAULT 0 NOT NULL,
    medium integer DEFAULT 0 NOT NULL,
    low integer DEFAULT 0 NOT NULL,
    unknown integer DEFAULT 0 NOT NULL,
    info integer DEFAULT 0 NOT NULL,
    date date NOT NULL,
    letter_grade smallint NOT NULL,
    migrating boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE vulnerability_namespace_historical_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_namespace_historical_statistics_id_seq OWNED BY vulnerability_namespace_historical_statistics.id;

CREATE TABLE vulnerability_namespace_statistics (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint NOT NULL,
    total integer DEFAULT 0 NOT NULL,
    critical integer DEFAULT 0 NOT NULL,
    high integer DEFAULT 0 NOT NULL,
    medium integer DEFAULT 0 NOT NULL,
    low integer DEFAULT 0 NOT NULL,
    unknown integer DEFAULT 0 NOT NULL,
    info integer DEFAULT 0 NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL
);

CREATE SEQUENCE vulnerability_namespace_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_namespace_statistics_id_seq OWNED BY vulnerability_namespace_statistics.id;

CREATE TABLE vulnerability_occurrence_identifiers (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    occurrence_id bigint NOT NULL,
    identifier_id bigint NOT NULL,
    project_id bigint,
    CONSTRAINT check_67fe772bae CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_occurrence_identifiers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_occurrence_identifiers_id_seq OWNED BY vulnerability_occurrence_identifiers.id;

CREATE TABLE vulnerability_occurrences (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    severity smallint NOT NULL,
    report_type smallint NOT NULL,
    project_id bigint NOT NULL,
    scanner_id bigint NOT NULL,
    primary_identifier_id bigint NOT NULL,
    location_fingerprint bytea NOT NULL,
    name character varying NOT NULL,
    metadata_version character varying NOT NULL,
    raw_metadata text NOT NULL,
    vulnerability_id bigint,
    details jsonb DEFAULT '{}'::jsonb NOT NULL,
    description text,
    solution text,
    cve text,
    location jsonb,
    detection_method smallint DEFAULT 0 NOT NULL,
    uuid uuid DEFAULT '00000000-0000-0000-0000-000000000000'::uuid NOT NULL,
    initial_pipeline_id bigint,
    latest_pipeline_id bigint,
    CONSTRAINT check_4a3a60f2ba CHECK ((char_length(solution) <= 7000)),
    CONSTRAINT check_ade261da6b CHECK ((char_length(description) <= 15000)),
    CONSTRAINT check_f602da68dd CHECK ((char_length(cve) <= 48400))
);

CREATE SEQUENCE vulnerability_occurrences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_occurrences_id_seq OWNED BY vulnerability_occurrences.id;

CREATE TABLE vulnerability_partial_scans (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    scan_id bigint NOT NULL,
    project_id bigint NOT NULL,
    mode smallint NOT NULL
);

CREATE TABLE vulnerability_reads (
    id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    project_id bigint NOT NULL,
    scanner_id bigint NOT NULL,
    report_type smallint NOT NULL,
    severity smallint NOT NULL,
    state smallint NOT NULL,
    has_issues boolean DEFAULT false NOT NULL,
    resolved_on_default_branch boolean DEFAULT false NOT NULL,
    uuid uuid NOT NULL,
    location_image text,
    cluster_agent_id text,
    casted_cluster_agent_id bigint,
    dismissal_reason smallint,
    has_merge_request boolean DEFAULT false,
    has_remediations boolean DEFAULT false NOT NULL,
    owasp_top_10 smallint DEFAULT '-1'::integer,
    traversal_ids bigint[] DEFAULT '{}'::bigint[],
    archived boolean DEFAULT false NOT NULL,
    identifier_names text[] DEFAULT '{}'::text[] NOT NULL,
    has_vulnerability_resolution boolean DEFAULT false,
    auto_resolved boolean DEFAULT false NOT NULL,
    CONSTRAINT check_380451bdbe CHECK ((char_length(location_image) <= 2048)),
    CONSTRAINT check_4b1a1bf5ea CHECK ((has_merge_request IS NOT NULL)),
    CONSTRAINT check_a105eb825a CHECK ((char_length(cluster_agent_id) <= 10)),
    CONSTRAINT check_f5ba7c2496 CHECK ((traversal_ids IS NOT NULL))
);

CREATE SEQUENCE vulnerability_reads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_reads_id_seq OWNED BY vulnerability_reads.id;

CREATE TABLE vulnerability_remediation_uploads (
    id bigint NOT NULL,
    size bigint NOT NULL,
    model_id bigint NOT NULL,
    uploaded_by_user_id bigint,
    organization_id bigint,
    namespace_id bigint,
    project_id bigint,
    created_at timestamp without time zone,
    store integer DEFAULT 1 NOT NULL,
    version integer DEFAULT 1,
    path text NOT NULL,
    checksum text,
    model_type text NOT NULL,
    uploader text NOT NULL,
    mount_point text,
    secret text,
    CONSTRAINT check_2849dedce7 CHECK ((char_length(path) <= 511)),
    CONSTRAINT check_b888b1df14 CHECK ((char_length(checksum) <= 64))
);

CREATE TABLE vulnerability_remediations (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    file_store smallint,
    summary text NOT NULL,
    file text NOT NULL,
    checksum bytea NOT NULL,
    project_id bigint NOT NULL,
    CONSTRAINT check_ac0ccabff3 CHECK ((char_length(summary) <= 200)),
    CONSTRAINT check_fe3325e3ba CHECK ((char_length(file) <= 255))
);

COMMENT ON COLUMN vulnerability_remediations.checksum IS 'Stores the SHA256 checksum of the attached diff file';

CREATE SEQUENCE vulnerability_remediations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_remediations_id_seq OWNED BY vulnerability_remediations.id;

CREATE TABLE vulnerability_representation_information (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    vulnerability_id bigint NOT NULL,
    project_id bigint NOT NULL,
    resolved_in_commit_sha bytea
);

CREATE TABLE vulnerability_scanners (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    external_id character varying NOT NULL,
    name character varying NOT NULL,
    vendor text DEFAULT 'GitLab'::text NOT NULL
);

CREATE SEQUENCE vulnerability_scanners_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_scanners_id_seq OWNED BY vulnerability_scanners.id;

CREATE TABLE vulnerability_severity_overrides (
    id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    author_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    original_severity smallint NOT NULL,
    new_severity smallint NOT NULL
);

CREATE SEQUENCE vulnerability_severity_overrides_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_severity_overrides_id_seq OWNED BY vulnerability_severity_overrides.id;

CREATE TABLE vulnerability_state_transitions (
    id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    to_state smallint NOT NULL,
    from_state smallint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    author_id bigint,
    comment text,
    dismissal_reason smallint,
    project_id bigint,
    CONSTRAINT check_b6338547d4 CHECK ((project_id IS NOT NULL)),
    CONSTRAINT check_fe2eb6a0f3 CHECK ((char_length(comment) <= 50000))
);

CREATE SEQUENCE vulnerability_state_transitions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_state_transitions_id_seq OWNED BY vulnerability_state_transitions.id;

CREATE TABLE vulnerability_statistics (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    total integer DEFAULT 0 NOT NULL,
    critical integer DEFAULT 0 NOT NULL,
    high integer DEFAULT 0 NOT NULL,
    medium integer DEFAULT 0 NOT NULL,
    low integer DEFAULT 0 NOT NULL,
    unknown integer DEFAULT 0 NOT NULL,
    info integer DEFAULT 0 NOT NULL,
    letter_grade smallint NOT NULL,
    latest_pipeline_id bigint,
    archived boolean DEFAULT false NOT NULL,
    traversal_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL
);

CREATE SEQUENCE vulnerability_statistics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_statistics_id_seq OWNED BY vulnerability_statistics.id;

CREATE TABLE vulnerability_user_mentions (
    id bigint NOT NULL,
    vulnerability_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[],
    note_id bigint,
    project_id bigint,
    CONSTRAINT check_0105942303 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE vulnerability_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE vulnerability_user_mentions_id_seq OWNED BY vulnerability_user_mentions.id;

CREATE SEQUENCE web_hook_logs_daily_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE web_hook_logs_daily_id_seq OWNED BY web_hook_logs_daily.id;

CREATE TABLE web_hooks (
    id bigint NOT NULL,
    project_id bigint,
    created_at timestamp without time zone,
    updated_at timestamp without time zone,
    type character varying DEFAULT 'ProjectHook'::character varying,
    push_events boolean DEFAULT true NOT NULL,
    issues_events boolean DEFAULT false NOT NULL,
    merge_requests_events boolean DEFAULT false NOT NULL,
    tag_push_events boolean DEFAULT false,
    group_id bigint,
    note_events boolean DEFAULT false NOT NULL,
    enable_ssl_verification boolean DEFAULT true,
    wiki_page_events boolean DEFAULT false NOT NULL,
    pipeline_events boolean DEFAULT false NOT NULL,
    confidential_issues_events boolean DEFAULT false NOT NULL,
    repository_update_events boolean DEFAULT false NOT NULL,
    job_events boolean DEFAULT false NOT NULL,
    confidential_note_events boolean,
    push_events_branch_filter text,
    encrypted_token character varying,
    encrypted_token_iv character varying,
    encrypted_url character varying,
    encrypted_url_iv character varying,
    deployment_events boolean DEFAULT false NOT NULL,
    releases_events boolean DEFAULT false NOT NULL,
    feature_flag_events boolean DEFAULT false NOT NULL,
    member_events boolean DEFAULT false NOT NULL,
    subgroup_events boolean DEFAULT false NOT NULL,
    recent_failures smallint DEFAULT 0 NOT NULL,
    disabled_until timestamp with time zone,
    encrypted_url_variables bytea,
    encrypted_url_variables_iv bytea,
    integration_id bigint,
    branch_filter_strategy smallint DEFAULT 0 NOT NULL,
    emoji_events boolean DEFAULT false NOT NULL,
    name text,
    description text,
    custom_webhook_template text,
    resource_access_token_events boolean DEFAULT false NOT NULL,
    encrypted_custom_headers bytea,
    encrypted_custom_headers_iv bytea,
    project_events boolean DEFAULT false NOT NULL,
    vulnerability_events boolean DEFAULT false NOT NULL,
    member_approval_events boolean DEFAULT false NOT NULL,
    milestone_events boolean DEFAULT false NOT NULL,
    CONSTRAINT check_1e4d5cbdc5 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_23a96ad211 CHECK ((char_length(description) <= 2048)),
    CONSTRAINT check_69ef76ee0c CHECK ((char_length(custom_webhook_template) <= 4096))
);

CREATE SEQUENCE web_hooks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE web_hooks_id_seq OWNED BY web_hooks.id;

CREATE TABLE webauthn_registrations (
    id bigint NOT NULL,
    user_id bigint NOT NULL,
    counter bigint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    credential_xid text NOT NULL,
    name text NOT NULL,
    public_key text NOT NULL,
    CONSTRAINT check_2f02e74321 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_f5ab2b551a CHECK ((char_length(credential_xid) <= 1364))
);

CREATE SEQUENCE webauthn_registrations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE webauthn_registrations_id_seq OWNED BY webauthn_registrations.id;

CREATE TABLE wiki_page_meta (
    id bigint NOT NULL,
    project_id bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    title character varying(255) NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_d858755109 CHECK ((num_nonnulls(namespace_id, project_id) = 1))
);

CREATE SEQUENCE wiki_page_meta_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE wiki_page_meta_id_seq OWNED BY wiki_page_meta.id;

CREATE TABLE wiki_page_meta_user_mentions (
    id bigint NOT NULL,
    wiki_page_meta_id bigint NOT NULL,
    note_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    mentioned_users_ids bigint[],
    mentioned_projects_ids bigint[],
    mentioned_groups_ids bigint[]
);

CREATE SEQUENCE wiki_page_meta_user_mentions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE wiki_page_meta_user_mentions_id_seq OWNED BY wiki_page_meta_user_mentions.id;

CREATE TABLE wiki_page_slugs (
    id bigint NOT NULL,
    canonical boolean DEFAULT false NOT NULL,
    wiki_page_meta_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    slug character varying(2048) NOT NULL,
    project_id bigint,
    namespace_id bigint,
    CONSTRAINT check_df824eea0a CHECK ((num_nonnulls(namespace_id, project_id) = 1))
);

CREATE SEQUENCE wiki_page_slugs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE wiki_page_slugs_id_seq OWNED BY wiki_page_slugs.id;

CREATE TABLE wiki_repository_states (
    id bigint NOT NULL,
    verification_started_at timestamp with time zone,
    verification_retry_at timestamp with time zone,
    verified_at timestamp with time zone,
    project_wiki_repository_id bigint NOT NULL,
    verification_state smallint DEFAULT 0 NOT NULL,
    verification_retry_count smallint,
    verification_checksum bytea,
    verification_failure text,
    project_id bigint,
    CONSTRAINT check_2933ff60dc CHECK ((char_length(verification_failure) <= 255)),
    CONSTRAINT check_69aed91301 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE wiki_repository_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE wiki_repository_states_id_seq OWNED BY wiki_repository_states.id;

CREATE TABLE work_item_colors (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    color text NOT NULL,
    CONSTRAINT check_485e19ad7b CHECK ((char_length(color) <= 7))
);

CREATE TABLE work_item_current_statuses (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    work_item_id bigint NOT NULL,
    system_defined_status_id bigint,
    custom_status_id bigint,
    updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_0734284d2c CHECK ((num_nonnulls(custom_status_id, system_defined_status_id) > 0))
);

CREATE SEQUENCE work_item_current_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_current_statuses_id_seq OWNED BY work_item_current_statuses.id;

CREATE TABLE work_item_custom_lifecycle_statuses (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    lifecycle_id bigint NOT NULL,
    status_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    "position" integer DEFAULT 0 NOT NULL,
    CONSTRAINT check_91172799d3 CHECK (("position" >= 0))
);

CREATE SEQUENCE work_item_custom_lifecycle_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_custom_lifecycle_statuses_id_seq OWNED BY work_item_custom_lifecycle_statuses.id;

CREATE TABLE work_item_custom_lifecycles (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    default_open_status_id bigint NOT NULL,
    default_closed_status_id bigint NOT NULL,
    default_duplicate_status_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    name text NOT NULL,
    created_by_id bigint,
    updated_by_id bigint,
    CONSTRAINT check_1feff2de99 CHECK ((char_length(name) <= 64))
);

CREATE SEQUENCE work_item_custom_lifecycles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_custom_lifecycles_id_seq OWNED BY work_item_custom_lifecycles.id;

CREATE TABLE work_item_custom_statuses (
    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,
    category smallint DEFAULT 1 NOT NULL,
    name text NOT NULL,
    description text,
    color text NOT NULL,
    created_by_id bigint,
    updated_by_id bigint,
    converted_from_system_defined_status_identifier smallint,
    CONSTRAINT check_4789467800 CHECK ((char_length(color) <= 7)),
    CONSTRAINT check_720a7c4d24 CHECK ((char_length(name) <= 32)),
    CONSTRAINT check_8ea8b3c991 CHECK ((char_length(description) <= 128)),
    CONSTRAINT check_ff2bac1606 CHECK ((category > 0))
);

CREATE SEQUENCE work_item_custom_statuses_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_custom_statuses_id_seq OWNED BY work_item_custom_statuses.id;

CREATE TABLE work_item_dates_sources (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    start_date_is_fixed boolean DEFAULT false NOT NULL,
    due_date_is_fixed boolean DEFAULT false NOT NULL,
    start_date date,
    due_date date,
    start_date_sourcing_work_item_id bigint,
    start_date_sourcing_milestone_id bigint,
    due_date_sourcing_work_item_id bigint,
    due_date_sourcing_milestone_id bigint,
    start_date_fixed date,
    due_date_fixed date
);

CREATE TABLE work_item_hierarchy_restrictions (
    id bigint NOT NULL,
    parent_type_id bigint NOT NULL,
    child_type_id bigint NOT NULL,
    maximum_depth smallint,
    cross_hierarchy_enabled boolean DEFAULT false NOT NULL
);

CREATE SEQUENCE work_item_hierarchy_restrictions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_hierarchy_restrictions_id_seq OWNED BY work_item_hierarchy_restrictions.id;

CREATE TABLE work_item_number_field_values (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    work_item_id bigint NOT NULL,
    custom_field_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    value numeric NOT NULL
);

CREATE SEQUENCE work_item_number_field_values_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_number_field_values_id_seq OWNED BY work_item_number_field_values.id;

CREATE TABLE work_item_parent_links (
    id bigint NOT NULL,
    work_item_id bigint NOT NULL,
    work_item_parent_id bigint NOT NULL,
    relative_position integer,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    namespace_id bigint,
    CONSTRAINT check_e9c0111985 CHECK ((namespace_id IS NOT NULL))
);

CREATE SEQUENCE work_item_parent_links_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_parent_links_id_seq OWNED BY work_item_parent_links.id;

CREATE TABLE work_item_progresses (
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_id bigint NOT NULL,
    progress smallint DEFAULT 0 NOT NULL,
    start_value double precision DEFAULT 0.0 NOT NULL,
    end_value double precision DEFAULT 100.0 NOT NULL,
    current_value double precision DEFAULT 0.0 NOT NULL,
    rollup_progress boolean DEFAULT true NOT NULL,
    reminder_frequency smallint DEFAULT 0 NOT NULL,
    last_reminder_sent_at timestamp with time zone,
    namespace_id bigint,
    CONSTRAINT check_60f0b9e790 CHECK ((namespace_id IS NOT NULL))
);

CREATE TABLE work_item_related_link_restrictions (
    id bigint NOT NULL,
    source_type_id bigint NOT NULL,
    target_type_id bigint NOT NULL,
    link_type smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE work_item_related_link_restrictions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_related_link_restrictions_id_seq OWNED BY work_item_related_link_restrictions.id;

CREATE TABLE work_item_select_field_values (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    work_item_id bigint NOT NULL,
    custom_field_id bigint NOT NULL,
    custom_field_select_option_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE work_item_select_field_values_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_select_field_values_id_seq OWNED BY work_item_select_field_values.id;

CREATE TABLE work_item_text_field_values (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    work_item_id bigint NOT NULL,
    custom_field_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    value text NOT NULL,
    CONSTRAINT check_1013631b9d CHECK ((char_length(value) <= 1024))
);

CREATE SEQUENCE work_item_text_field_values_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_text_field_values_id_seq OWNED BY work_item_text_field_values.id;

CREATE TABLE work_item_type_custom_fields (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    custom_field_id bigint NOT NULL,
    work_item_type_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE work_item_type_custom_fields_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_type_custom_fields_id_seq OWNED BY work_item_type_custom_fields.id;

CREATE TABLE work_item_type_custom_lifecycles (
    id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    work_item_type_id bigint NOT NULL,
    lifecycle_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE SEQUENCE work_item_type_custom_lifecycles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_type_custom_lifecycles_id_seq OWNED BY work_item_type_custom_lifecycles.id;

CREATE TABLE work_item_type_user_preferences (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    work_item_type_id bigint,
    sort text,
    display_settings jsonb DEFAULT '{}'::jsonb NOT NULL,
    CONSTRAINT check_7f4a25cee7 CHECK ((char_length(sort) <= 255)),
    CONSTRAINT check_display_settings_is_hash CHECK ((jsonb_typeof(display_settings) = 'object'::text))
);

CREATE SEQUENCE work_item_type_user_preferences_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_type_user_preferences_id_seq OWNED BY work_item_type_user_preferences.id;

CREATE TABLE work_item_types (
    id bigint NOT NULL,
    base_type smallint DEFAULT 0 NOT NULL,
    cached_markdown_version integer,
    name text NOT NULL,
    description text,
    description_html text,
    icon_name text,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    correct_id bigint DEFAULT 0 NOT NULL,
    old_id bigint,
    CONSTRAINT check_104d2410f6 CHECK ((char_length(name) <= 255)),
    CONSTRAINT check_fecb3a98d1 CHECK ((char_length(icon_name) <= 255))
);

CREATE TABLE work_item_weights_sources (
    work_item_id bigint NOT NULL,
    namespace_id bigint NOT NULL,
    rolled_up_weight bigint,
    rolled_up_completed_weight bigint,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL
);

CREATE TABLE work_item_widget_definitions (
    id bigint NOT NULL,
    work_item_type_id bigint NOT NULL,
    widget_type smallint NOT NULL,
    disabled boolean DEFAULT false,
    name text,
    widget_options jsonb,
    CONSTRAINT check_050f2e2328 CHECK ((char_length(name) <= 255))
);

CREATE SEQUENCE work_item_widget_definitions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE work_item_widget_definitions_id_seq OWNED BY work_item_widget_definitions.id;

CREATE TABLE workspace_agentk_states (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    workspace_id bigint NOT NULL,
    project_id bigint NOT NULL,
    desired_config jsonb NOT NULL
);

CREATE SEQUENCE workspace_agentk_states_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE workspace_agentk_states_id_seq OWNED BY workspace_agentk_states.id;

CREATE TABLE workspace_tokens (
    id bigint NOT NULL,
    workspace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    token_encrypted text NOT NULL,
    CONSTRAINT check_35b32b26d3 CHECK ((char_length(token_encrypted) <= 512)),
    CONSTRAINT chk_rails_78f4622c4e CHECK ((char_length(token_encrypted) <= 512))
);

CREATE SEQUENCE workspace_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE workspace_tokens_id_seq OWNED BY workspace_tokens.id;

CREATE TABLE workspace_variables (
    id bigint NOT NULL,
    workspace_id bigint NOT NULL,
    variable_type smallint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    key text NOT NULL,
    encrypted_value bytea NOT NULL,
    encrypted_value_iv bytea NOT NULL,
    project_id bigint,
    user_provided boolean DEFAULT false NOT NULL,
    CONSTRAINT check_5545042100 CHECK ((char_length(key) <= 255)),
    CONSTRAINT check_ed95da8691 CHECK ((project_id IS NOT NULL))
);

CREATE SEQUENCE workspace_variables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE workspace_variables_id_seq OWNED BY workspace_variables.id;

CREATE TABLE workspaces (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    user_id bigint NOT NULL,
    project_id bigint NOT NULL,
    cluster_agent_id bigint NOT NULL,
    desired_state_updated_at timestamp with time zone NOT NULL,
    responded_to_agent_at timestamp with time zone,
    name text NOT NULL,
    namespace text NOT NULL,
    desired_state text NOT NULL,
    actual_state text NOT NULL,
    devfile_path text,
    devfile text,
    processed_devfile text,
    url text,
    deployment_resource_version text,
    personal_access_token_id bigint,
    force_include_all_resources boolean DEFAULT true NOT NULL,
    url_prefix text,
    url_query_string text,
    workspaces_agent_config_version integer NOT NULL,
    desired_config_generator_version integer,
    project_ref text,
    actual_state_updated_at timestamp with time zone NOT NULL,
    CONSTRAINT check_15543fb0fa CHECK ((char_length(name) <= 64)),
    CONSTRAINT check_157d5f955c CHECK ((char_length(namespace) <= 64)),
    CONSTRAINT check_2b401b0034 CHECK ((char_length(deployment_resource_version) <= 64)),
    CONSTRAINT check_35e31ca320 CHECK ((desired_config_generator_version IS NOT NULL)),
    CONSTRAINT check_72fee08424 CHECK ((char_length(project_ref) <= 256)),
    CONSTRAINT check_77d1a2ff50 CHECK ((char_length(processed_devfile) <= 65535)),
    CONSTRAINT check_8a0ab61b6b CHECK ((char_length(url_query_string) <= 256)),
    CONSTRAINT check_8e4db5ffc2 CHECK ((char_length(actual_state) <= 32)),
    CONSTRAINT check_9e42558c35 CHECK ((char_length(url) <= 1024)),
    CONSTRAINT check_a758efdc89 CHECK ((project_ref IS NOT NULL)),
    CONSTRAINT check_b70eddcbc1 CHECK ((char_length(desired_state) <= 32)),
    CONSTRAINT check_dc58d56169 CHECK ((char_length(devfile_path) <= 2048)),
    CONSTRAINT check_eb32879a3d CHECK ((char_length(devfile) <= 65535)),
    CONSTRAINT check_ffa8cad434 CHECK ((char_length(url_prefix) <= 256))
);

CREATE TABLE workspaces_agent_config_versions (
    id bigint NOT NULL,
    created_at timestamp with time zone,
    project_id bigint NOT NULL,
    item_id bigint NOT NULL,
    event text NOT NULL,
    whodunnit text,
    item_type text NOT NULL,
    object jsonb,
    object_changes jsonb,
    CONSTRAINT check_1ad0ae8926 CHECK ((char_length(whodunnit) <= 255)),
    CONSTRAINT check_a7055791ff CHECK ((char_length(event) <= 20)),
    CONSTRAINT check_ed1b796ddc CHECK ((char_length(item_type) <= 255))
);

CREATE SEQUENCE workspaces_agent_config_versions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE workspaces_agent_config_versions_id_seq OWNED BY workspaces_agent_config_versions.id;

CREATE TABLE workspaces_agent_configs (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    cluster_agent_id bigint NOT NULL,
    workspaces_quota bigint DEFAULT '-1'::integer NOT NULL,
    workspaces_per_user_quota bigint DEFAULT '-1'::integer NOT NULL,
    project_id bigint NOT NULL,
    enabled boolean NOT NULL,
    network_policy_enabled boolean DEFAULT true NOT NULL,
    dns_zone text NOT NULL,
    gitlab_workspaces_proxy_namespace text DEFAULT 'gitlab-workspaces'::text NOT NULL,
    network_policy_egress jsonb DEFAULT '[{"allow": "0.0.0.0/0", "except": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]}]'::jsonb NOT NULL,
    default_resources_per_workspace_container jsonb DEFAULT '{}'::jsonb NOT NULL,
    max_resources_per_workspace jsonb DEFAULT '{}'::jsonb NOT NULL,
    allow_privilege_escalation boolean DEFAULT false NOT NULL,
    use_kubernetes_user_namespaces boolean DEFAULT false NOT NULL,
    default_runtime_class text DEFAULT ''::text NOT NULL,
    annotations jsonb DEFAULT '{}'::jsonb NOT NULL,
    labels jsonb DEFAULT '{}'::jsonb NOT NULL,
    image_pull_secrets jsonb DEFAULT '[]'::jsonb NOT NULL,
    max_active_hours_before_stop smallint DEFAULT 36 NOT NULL,
    max_stopped_hours_before_termination smallint DEFAULT 744 NOT NULL,
    shared_namespace text DEFAULT ''::text NOT NULL,
    CONSTRAINT check_2de67a7a76 CHECK ((char_length(shared_namespace) <= 63)),
    CONSTRAINT check_557e75a230 CHECK ((max_stopped_hours_before_termination > 0)),
    CONSTRAINT check_58759a890a CHECK ((char_length(dns_zone) <= 256)),
    CONSTRAINT check_6d7baef494 CHECK (((max_active_hours_before_stop + max_stopped_hours_before_termination) <= 8760)),
    CONSTRAINT check_720388a28c CHECK ((char_length(default_runtime_class) <= 253)),
    CONSTRAINT check_df26c047a9 CHECK ((max_active_hours_before_stop > 0)),
    CONSTRAINT check_ee2464835c CHECK ((char_length(gitlab_workspaces_proxy_namespace) <= 63))
);

CREATE SEQUENCE workspaces_agent_configs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE workspaces_agent_configs_id_seq OWNED BY workspaces_agent_configs.id;

CREATE SEQUENCE workspaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE workspaces_id_seq OWNED BY workspaces.id;

CREATE TABLE x509_certificates (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    subject_key_identifier character varying(255) NOT NULL,
    subject character varying(512),
    email character varying(255) NOT NULL,
    serial_number bytea NOT NULL,
    certificate_status smallint DEFAULT 0 NOT NULL,
    x509_issuer_id bigint NOT NULL,
    emails character varying[] DEFAULT '{}'::character varying[] NOT NULL
);

CREATE SEQUENCE x509_certificates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE x509_certificates_id_seq OWNED BY x509_certificates.id;

CREATE TABLE x509_commit_signatures (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    project_id bigint NOT NULL,
    x509_certificate_id bigint NOT NULL,
    commit_sha bytea NOT NULL,
    verification_status smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE x509_commit_signatures_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE x509_commit_signatures_id_seq OWNED BY x509_commit_signatures.id;

CREATE TABLE x509_issuers (
    id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    subject_key_identifier character varying(255) NOT NULL,
    subject character varying(255),
    crl_url character varying(255)
);

CREATE SEQUENCE x509_issuers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE x509_issuers_id_seq OWNED BY x509_issuers.id;

CREATE TABLE xray_reports (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    lang text NOT NULL,
    payload jsonb NOT NULL,
    CONSTRAINT check_6da5a3b473 CHECK ((char_length(lang) <= 255))
);

CREATE SEQUENCE xray_reports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE xray_reports_id_seq OWNED BY xray_reports.id;

CREATE TABLE zentao_tracker_data (
    id bigint NOT NULL,
    integration_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    encrypted_url bytea,
    encrypted_url_iv bytea,
    encrypted_api_url bytea,
    encrypted_api_url_iv bytea,
    encrypted_zentao_product_xid bytea,
    encrypted_zentao_product_xid_iv bytea,
    encrypted_api_token bytea,
    encrypted_api_token_iv bytea,
    instance_integration_id bigint,
    project_id bigint,
    group_id bigint,
    organization_id bigint,
    CONSTRAINT check_500f588095 CHECK ((num_nonnulls(instance_integration_id, integration_id) = 1))
);

CREATE SEQUENCE zentao_tracker_data_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zentao_tracker_data_id_seq OWNED BY zentao_tracker_data.id;

CREATE TABLE zoekt_enabled_namespaces (
    id bigint NOT NULL,
    root_namespace_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    search boolean DEFAULT true NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    last_rollout_failed_at timestamp with time zone
);

CREATE SEQUENCE zoekt_enabled_namespaces_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoekt_enabled_namespaces_id_seq OWNED BY zoekt_enabled_namespaces.id;

CREATE TABLE zoekt_indices (
    id bigint NOT NULL,
    zoekt_enabled_namespace_id bigint,
    zoekt_node_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,
    state smallint DEFAULT 0 NOT NULL,
    zoekt_replica_id bigint,
    reserved_storage_bytes bigint DEFAULT '10737418240'::bigint,
    used_storage_bytes bigint DEFAULT 0 NOT NULL,
    watermark_level smallint DEFAULT 0 NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    used_storage_bytes_updated_at timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
    last_indexed_at timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL
);

CREATE SEQUENCE zoekt_indices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoekt_indices_id_seq OWNED BY zoekt_indices.id;

CREATE TABLE zoekt_nodes (
    id bigint NOT NULL,
    uuid uuid NOT NULL,
    used_bytes bigint DEFAULT 0 NOT NULL,
    total_bytes bigint DEFAULT 0 NOT NULL,
    last_seen_at timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    index_base_url text NOT NULL,
    search_base_url text NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    indexed_bytes bigint DEFAULT 0 NOT NULL,
    usable_storage_bytes bigint DEFAULT 0 NOT NULL,
    usable_storage_bytes_locked_until timestamp with time zone,
    schema_version smallint DEFAULT 0 NOT NULL,
    services smallint[] DEFAULT '{0}'::smallint[] NOT NULL,
    knowledge_graph_schema_version smallint DEFAULT 0 NOT NULL,
    CONSTRAINT check_32f39efba3 CHECK ((char_length(search_base_url) <= 1024)),
    CONSTRAINT check_38c354a3c2 CHECK ((char_length(index_base_url) <= 1024))
);

CREATE SEQUENCE zoekt_nodes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoekt_nodes_id_seq OWNED BY zoekt_nodes.id;

CREATE TABLE zoekt_replicas (
    id bigint NOT NULL,
    zoekt_enabled_namespace_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,
    state smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE zoekt_replicas_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoekt_replicas_id_seq OWNED BY zoekt_replicas.id;

CREATE TABLE zoekt_repositories (
    id bigint NOT NULL,
    zoekt_index_id bigint NOT NULL,
    project_id bigint,
    project_identifier bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    indexed_at timestamp with time zone,
    state smallint DEFAULT 0 NOT NULL,
    size_bytes bigint DEFAULT 0 NOT NULL,
    index_file_count integer DEFAULT 0 NOT NULL,
    retries_left smallint DEFAULT 10 NOT NULL,
    schema_version smallint DEFAULT 0 NOT NULL,
    CONSTRAINT c_zoekt_repositories_on_project_id_and_project_identifier CHECK (((project_id IS NULL) OR (project_identifier = project_id))),
    CONSTRAINT c_zoekt_repositories_on_retries_left CHECK (((retries_left > 0) OR ((retries_left = 0) AND (state >= 200))))
);

CREATE SEQUENCE zoekt_repositories_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoekt_repositories_id_seq OWNED BY zoekt_repositories.id;

CREATE SEQUENCE zoekt_tasks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoekt_tasks_id_seq OWNED BY zoekt_tasks.id;

CREATE TABLE zoom_meetings (
    id bigint NOT NULL,
    project_id bigint NOT NULL,
    issue_id bigint NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    issue_status smallint DEFAULT 1 NOT NULL,
    url character varying(255)
);

CREATE SEQUENCE zoom_meetings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER SEQUENCE zoom_meetings_id_seq OWNED BY zoom_meetings.id;

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 FOR VALUES WITH (modulus 32, remainder 0);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 FOR VALUES WITH (modulus 32, remainder 1);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 FOR VALUES WITH (modulus 32, remainder 2);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 FOR VALUES WITH (modulus 32, remainder 3);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 FOR VALUES WITH (modulus 32, remainder 4);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 FOR VALUES WITH (modulus 32, remainder 5);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 FOR VALUES WITH (modulus 32, remainder 6);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 FOR VALUES WITH (modulus 32, remainder 7);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 FOR VALUES WITH (modulus 32, remainder 8);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 FOR VALUES WITH (modulus 32, remainder 9);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 FOR VALUES WITH (modulus 32, remainder 10);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 FOR VALUES WITH (modulus 32, remainder 11);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 FOR VALUES WITH (modulus 32, remainder 12);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 FOR VALUES WITH (modulus 32, remainder 13);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 FOR VALUES WITH (modulus 32, remainder 14);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 FOR VALUES WITH (modulus 32, remainder 15);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 FOR VALUES WITH (modulus 32, remainder 16);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 FOR VALUES WITH (modulus 32, remainder 17);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 FOR VALUES WITH (modulus 32, remainder 18);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 FOR VALUES WITH (modulus 32, remainder 19);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 FOR VALUES WITH (modulus 32, remainder 20);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 FOR VALUES WITH (modulus 32, remainder 21);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 FOR VALUES WITH (modulus 32, remainder 22);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 FOR VALUES WITH (modulus 32, remainder 23);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 FOR VALUES WITH (modulus 32, remainder 24);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 FOR VALUES WITH (modulus 32, remainder 25);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 FOR VALUES WITH (modulus 32, remainder 26);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 FOR VALUES WITH (modulus 32, remainder 27);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 FOR VALUES WITH (modulus 32, remainder 28);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 FOR VALUES WITH (modulus 32, remainder 29);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 FOR VALUES WITH (modulus 32, remainder 30);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 FOR VALUES WITH (modulus 32, remainder 31);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 FOR VALUES WITH (modulus 32, remainder 0);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 FOR VALUES WITH (modulus 32, remainder 1);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 FOR VALUES WITH (modulus 32, remainder 2);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 FOR VALUES WITH (modulus 32, remainder 3);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 FOR VALUES WITH (modulus 32, remainder 4);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 FOR VALUES WITH (modulus 32, remainder 5);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 FOR VALUES WITH (modulus 32, remainder 6);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 FOR VALUES WITH (modulus 32, remainder 7);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 FOR VALUES WITH (modulus 32, remainder 8);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 FOR VALUES WITH (modulus 32, remainder 9);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 FOR VALUES WITH (modulus 32, remainder 10);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 FOR VALUES WITH (modulus 32, remainder 11);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 FOR VALUES WITH (modulus 32, remainder 12);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 FOR VALUES WITH (modulus 32, remainder 13);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 FOR VALUES WITH (modulus 32, remainder 14);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 FOR VALUES WITH (modulus 32, remainder 15);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 FOR VALUES WITH (modulus 32, remainder 16);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 FOR VALUES WITH (modulus 32, remainder 17);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 FOR VALUES WITH (modulus 32, remainder 18);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 FOR VALUES WITH (modulus 32, remainder 19);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 FOR VALUES WITH (modulus 32, remainder 20);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 FOR VALUES WITH (modulus 32, remainder 21);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 FOR VALUES WITH (modulus 32, remainder 22);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 FOR VALUES WITH (modulus 32, remainder 23);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 FOR VALUES WITH (modulus 32, remainder 24);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 FOR VALUES WITH (modulus 32, remainder 25);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 FOR VALUES WITH (modulus 32, remainder 26);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 FOR VALUES WITH (modulus 32, remainder 27);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 FOR VALUES WITH (modulus 32, remainder 28);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 FOR VALUES WITH (modulus 32, remainder 29);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 FOR VALUES WITH (modulus 32, remainder 30);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 FOR VALUES WITH (modulus 32, remainder 31);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_00 FOR VALUES WITH (modulus 64, remainder 0);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_01 FOR VALUES WITH (modulus 64, remainder 1);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_02 FOR VALUES WITH (modulus 64, remainder 2);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_03 FOR VALUES WITH (modulus 64, remainder 3);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_04 FOR VALUES WITH (modulus 64, remainder 4);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_05 FOR VALUES WITH (modulus 64, remainder 5);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_06 FOR VALUES WITH (modulus 64, remainder 6);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_07 FOR VALUES WITH (modulus 64, remainder 7);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_08 FOR VALUES WITH (modulus 64, remainder 8);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_09 FOR VALUES WITH (modulus 64, remainder 9);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_10 FOR VALUES WITH (modulus 64, remainder 10);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_11 FOR VALUES WITH (modulus 64, remainder 11);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_12 FOR VALUES WITH (modulus 64, remainder 12);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_13 FOR VALUES WITH (modulus 64, remainder 13);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_14 FOR VALUES WITH (modulus 64, remainder 14);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_15 FOR VALUES WITH (modulus 64, remainder 15);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_16 FOR VALUES WITH (modulus 64, remainder 16);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_17 FOR VALUES WITH (modulus 64, remainder 17);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_18 FOR VALUES WITH (modulus 64, remainder 18);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_19 FOR VALUES WITH (modulus 64, remainder 19);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_20 FOR VALUES WITH (modulus 64, remainder 20);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_21 FOR VALUES WITH (modulus 64, remainder 21);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_22 FOR VALUES WITH (modulus 64, remainder 22);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_23 FOR VALUES WITH (modulus 64, remainder 23);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_24 FOR VALUES WITH (modulus 64, remainder 24);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_25 FOR VALUES WITH (modulus 64, remainder 25);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_26 FOR VALUES WITH (modulus 64, remainder 26);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_27 FOR VALUES WITH (modulus 64, remainder 27);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_28 FOR VALUES WITH (modulus 64, remainder 28);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_29 FOR VALUES WITH (modulus 64, remainder 29);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_30 FOR VALUES WITH (modulus 64, remainder 30);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_31 FOR VALUES WITH (modulus 64, remainder 31);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_32 FOR VALUES WITH (modulus 64, remainder 32);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_33 FOR VALUES WITH (modulus 64, remainder 33);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_34 FOR VALUES WITH (modulus 64, remainder 34);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_35 FOR VALUES WITH (modulus 64, remainder 35);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_36 FOR VALUES WITH (modulus 64, remainder 36);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_37 FOR VALUES WITH (modulus 64, remainder 37);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_38 FOR VALUES WITH (modulus 64, remainder 38);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_39 FOR VALUES WITH (modulus 64, remainder 39);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_40 FOR VALUES WITH (modulus 64, remainder 40);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_41 FOR VALUES WITH (modulus 64, remainder 41);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_42 FOR VALUES WITH (modulus 64, remainder 42);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_43 FOR VALUES WITH (modulus 64, remainder 43);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_44 FOR VALUES WITH (modulus 64, remainder 44);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_45 FOR VALUES WITH (modulus 64, remainder 45);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_46 FOR VALUES WITH (modulus 64, remainder 46);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_47 FOR VALUES WITH (modulus 64, remainder 47);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_48 FOR VALUES WITH (modulus 64, remainder 48);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_49 FOR VALUES WITH (modulus 64, remainder 49);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_50 FOR VALUES WITH (modulus 64, remainder 50);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_51 FOR VALUES WITH (modulus 64, remainder 51);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_52 FOR VALUES WITH (modulus 64, remainder 52);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_53 FOR VALUES WITH (modulus 64, remainder 53);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_54 FOR VALUES WITH (modulus 64, remainder 54);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_55 FOR VALUES WITH (modulus 64, remainder 55);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_56 FOR VALUES WITH (modulus 64, remainder 56);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_57 FOR VALUES WITH (modulus 64, remainder 57);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_58 FOR VALUES WITH (modulus 64, remainder 58);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_59 FOR VALUES WITH (modulus 64, remainder 59);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_60 FOR VALUES WITH (modulus 64, remainder 60);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_61 FOR VALUES WITH (modulus 64, remainder 61);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_62 FOR VALUES WITH (modulus 64, remainder 62);

ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_63 FOR VALUES WITH (modulus 64, remainder 63);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_00 FOR VALUES WITH (modulus 32, remainder 0);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_01 FOR VALUES WITH (modulus 32, remainder 1);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_02 FOR VALUES WITH (modulus 32, remainder 2);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_03 FOR VALUES WITH (modulus 32, remainder 3);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_04 FOR VALUES WITH (modulus 32, remainder 4);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_05 FOR VALUES WITH (modulus 32, remainder 5);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_06 FOR VALUES WITH (modulus 32, remainder 6);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_07 FOR VALUES WITH (modulus 32, remainder 7);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_08 FOR VALUES WITH (modulus 32, remainder 8);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_09 FOR VALUES WITH (modulus 32, remainder 9);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_10 FOR VALUES WITH (modulus 32, remainder 10);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_11 FOR VALUES WITH (modulus 32, remainder 11);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_12 FOR VALUES WITH (modulus 32, remainder 12);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_13 FOR VALUES WITH (modulus 32, remainder 13);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_14 FOR VALUES WITH (modulus 32, remainder 14);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_15 FOR VALUES WITH (modulus 32, remainder 15);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_16 FOR VALUES WITH (modulus 32, remainder 16);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_17 FOR VALUES WITH (modulus 32, remainder 17);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_18 FOR VALUES WITH (modulus 32, remainder 18);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_19 FOR VALUES WITH (modulus 32, remainder 19);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_20 FOR VALUES WITH (modulus 32, remainder 20);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_21 FOR VALUES WITH (modulus 32, remainder 21);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_22 FOR VALUES WITH (modulus 32, remainder 22);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_23 FOR VALUES WITH (modulus 32, remainder 23);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_24 FOR VALUES WITH (modulus 32, remainder 24);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_25 FOR VALUES WITH (modulus 32, remainder 25);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_26 FOR VALUES WITH (modulus 32, remainder 26);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_27 FOR VALUES WITH (modulus 32, remainder 27);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_28 FOR VALUES WITH (modulus 32, remainder 28);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_29 FOR VALUES WITH (modulus 32, remainder 29);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_30 FOR VALUES WITH (modulus 32, remainder 30);

ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_31 FOR VALUES WITH (modulus 32, remainder 31);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 FOR VALUES WITH (modulus 16, remainder 0);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 FOR VALUES WITH (modulus 16, remainder 1);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 FOR VALUES WITH (modulus 16, remainder 2);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 FOR VALUES WITH (modulus 16, remainder 3);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 FOR VALUES WITH (modulus 16, remainder 4);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 FOR VALUES WITH (modulus 16, remainder 5);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 FOR VALUES WITH (modulus 16, remainder 6);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 FOR VALUES WITH (modulus 16, remainder 7);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 FOR VALUES WITH (modulus 16, remainder 8);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 FOR VALUES WITH (modulus 16, remainder 9);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 FOR VALUES WITH (modulus 16, remainder 10);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 FOR VALUES WITH (modulus 16, remainder 11);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 FOR VALUES WITH (modulus 16, remainder 12);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 FOR VALUES WITH (modulus 16, remainder 13);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 FOR VALUES WITH (modulus 16, remainder 14);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 FOR VALUES WITH (modulus 16, remainder 15);

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION abuse_report_uploads FOR VALUES IN ('AbuseReport');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION achievement_uploads FOR VALUES IN ('Achievements::Achievement');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION ai_vectorizable_file_uploads FOR VALUES IN ('Ai::VectorizableFile');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION alert_management_alert_metric_image_uploads FOR VALUES IN ('AlertManagement::MetricImage');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION appearance_uploads FOR VALUES IN ('Appearance');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION bulk_import_export_upload_uploads FOR VALUES IN ('BulkImports::ExportUpload');

ALTER TABLE ONLY ci_runner_taggings ATTACH PARTITION ci_runner_taggings_group_type FOR VALUES IN ('2');

ALTER TABLE ONLY ci_runner_taggings ATTACH PARTITION ci_runner_taggings_instance_type FOR VALUES IN ('1');

ALTER TABLE ONLY ci_runner_taggings ATTACH PARTITION ci_runner_taggings_project_type FOR VALUES IN ('3');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION dependency_list_export_part_uploads FOR VALUES IN ('Dependencies::DependencyListExport::Part');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION dependency_list_export_uploads FOR VALUES IN ('Dependencies::DependencyListExport');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION design_management_action_uploads FOR VALUES IN ('DesignManagement::Action');

ALTER TABLE ONLY ci_runner_machines ATTACH PARTITION group_type_ci_runner_machines FOR VALUES IN ('2');

ALTER TABLE ONLY ci_runners ATTACH PARTITION group_type_ci_runners FOR VALUES IN ('2');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION import_export_upload_uploads FOR VALUES IN ('ImportExportUpload');

ALTER TABLE ONLY ci_runner_machines ATTACH PARTITION instance_type_ci_runner_machines FOR VALUES IN ('1');

ALTER TABLE ONLY ci_runners ATTACH PARTITION instance_type_ci_runners FOR VALUES IN ('1');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION issuable_metric_image_uploads FOR VALUES IN ('IssuableMetricImage');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION namespace_uploads FOR VALUES IN ('Namespace');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION note_uploads FOR VALUES IN ('Note');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION organization_detail_uploads FOR VALUES IN ('Organizations::OrganizationDetail');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION project_import_export_relation_export_upload_uploads FOR VALUES IN ('Projects::ImportExport::RelationExportUpload');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION project_topic_uploads FOR VALUES IN ('Projects::Topic');

ALTER TABLE ONLY ci_runner_machines ATTACH PARTITION project_type_ci_runner_machines FOR VALUES IN ('3');

ALTER TABLE ONLY ci_runners ATTACH PARTITION project_type_ci_runners FOR VALUES IN ('3');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION project_uploads FOR VALUES IN ('Project');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION snippet_uploads FOR VALUES IN ('Snippet');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION user_permission_export_upload_uploads FOR VALUES IN ('UserPermissionExportUpload');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION user_uploads FOR VALUES IN ('User');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION vulnerability_archive_export_uploads FOR VALUES IN ('Vulnerabilities::ArchiveExport');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION vulnerability_export_part_uploads FOR VALUES IN ('Vulnerabilities::Export::Part');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION vulnerability_export_uploads FOR VALUES IN ('Vulnerabilities::Export');

ALTER TABLE ONLY uploads_9ba88c4165 ATTACH PARTITION vulnerability_remediation_uploads FOR VALUES IN ('Vulnerabilities::Remediation');

ALTER TABLE ONLY abuse_events ALTER COLUMN id SET DEFAULT nextval('abuse_events_id_seq'::regclass);

ALTER TABLE ONLY abuse_report_assignees ALTER COLUMN id SET DEFAULT nextval('abuse_report_assignees_id_seq'::regclass);

ALTER TABLE ONLY abuse_report_events ALTER COLUMN id SET DEFAULT nextval('abuse_report_events_id_seq'::regclass);

ALTER TABLE ONLY abuse_report_label_links ALTER COLUMN id SET DEFAULT nextval('abuse_report_label_links_id_seq'::regclass);

ALTER TABLE ONLY abuse_report_labels ALTER COLUMN id SET DEFAULT nextval('abuse_report_labels_id_seq'::regclass);

ALTER TABLE ONLY abuse_report_notes ALTER COLUMN id SET DEFAULT nextval('abuse_report_notes_id_seq'::regclass);

ALTER TABLE ONLY abuse_report_user_mentions ALTER COLUMN id SET DEFAULT nextval('abuse_report_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY abuse_reports ALTER COLUMN id SET DEFAULT nextval('abuse_reports_id_seq'::regclass);

ALTER TABLE ONLY abuse_trust_scores ALTER COLUMN id SET DEFAULT nextval('abuse_trust_scores_id_seq'::regclass);

ALTER TABLE ONLY achievements ALTER COLUMN id SET DEFAULT nextval('achievements_id_seq'::regclass);

ALTER TABLE ONLY activity_pub_releases_subscriptions ALTER COLUMN id SET DEFAULT nextval('activity_pub_releases_subscriptions_id_seq'::regclass);

ALTER TABLE ONLY admin_roles ALTER COLUMN id SET DEFAULT nextval('admin_roles_id_seq'::regclass);

ALTER TABLE ONLY agent_activity_events ALTER COLUMN id SET DEFAULT nextval('agent_activity_events_id_seq'::regclass);

ALTER TABLE ONLY agent_group_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_group_authorizations_id_seq'::regclass);

ALTER TABLE ONLY agent_organization_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_organization_authorizations_id_seq'::regclass);

ALTER TABLE ONLY agent_project_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_project_authorizations_id_seq'::regclass);

ALTER TABLE ONLY agent_user_access_group_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_user_access_group_authorizations_id_seq'::regclass);

ALTER TABLE ONLY agent_user_access_project_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_user_access_project_authorizations_id_seq'::regclass);

ALTER TABLE ONLY ai_active_context_collections ALTER COLUMN id SET DEFAULT nextval('ai_active_context_collections_id_seq'::regclass);

ALTER TABLE ONLY ai_active_context_connections ALTER COLUMN id SET DEFAULT nextval('ai_active_context_connections_id_seq'::regclass);

ALTER TABLE ONLY ai_active_context_migrations ALTER COLUMN id SET DEFAULT nextval('ai_active_context_migrations_id_seq'::regclass);

ALTER TABLE ONLY ai_agent_version_attachments ALTER COLUMN id SET DEFAULT nextval('ai_agent_version_attachments_id_seq'::regclass);

ALTER TABLE ONLY ai_agent_versions ALTER COLUMN id SET DEFAULT nextval('ai_agent_versions_id_seq'::regclass);

ALTER TABLE ONLY ai_agents ALTER COLUMN id SET DEFAULT nextval('ai_agents_id_seq'::regclass);

ALTER TABLE ONLY ai_catalog_item_consumers ALTER COLUMN id SET DEFAULT nextval('ai_catalog_item_consumers_id_seq'::regclass);

ALTER TABLE ONLY ai_catalog_item_versions ALTER COLUMN id SET DEFAULT nextval('ai_catalog_item_versions_id_seq'::regclass);

ALTER TABLE ONLY ai_catalog_items ALTER COLUMN id SET DEFAULT nextval('ai_catalog_items_id_seq'::regclass);

ALTER TABLE ONLY ai_code_suggestion_events ALTER COLUMN id SET DEFAULT nextval('ai_code_suggestion_events_id_seq'::regclass);

ALTER TABLE ONLY ai_conversation_messages ALTER COLUMN id SET DEFAULT nextval('ai_conversation_messages_id_seq'::regclass);

ALTER TABLE ONLY ai_conversation_threads ALTER COLUMN id SET DEFAULT nextval('ai_conversation_threads_id_seq'::regclass);

ALTER TABLE ONLY ai_duo_chat_events ALTER COLUMN id SET DEFAULT nextval('ai_duo_chat_events_id_seq'::regclass);

ALTER TABLE ONLY ai_feature_settings ALTER COLUMN id SET DEFAULT nextval('ai_feature_settings_id_seq'::regclass);

ALTER TABLE ONLY ai_namespace_feature_settings ALTER COLUMN id SET DEFAULT nextval('ai_namespace_feature_settings_id_seq'::regclass);

ALTER TABLE ONLY ai_self_hosted_models ALTER COLUMN id SET DEFAULT nextval('ai_self_hosted_models_id_seq'::regclass);

ALTER TABLE ONLY ai_settings ALTER COLUMN id SET DEFAULT nextval('ai_settings_id_seq'::regclass);

ALTER TABLE ONLY ai_troubleshoot_job_events ALTER COLUMN id SET DEFAULT nextval('ai_troubleshoot_job_events_id_seq'::regclass);

ALTER TABLE ONLY ai_usage_events ALTER COLUMN id SET DEFAULT nextval('ai_usage_events_id_seq'::regclass);

ALTER TABLE ONLY ai_vectorizable_files ALTER COLUMN id SET DEFAULT nextval('ai_vectorizable_files_id_seq'::regclass);

ALTER TABLE ONLY alert_management_alert_assignees ALTER COLUMN id SET DEFAULT nextval('alert_management_alert_assignees_id_seq'::regclass);

ALTER TABLE ONLY alert_management_alert_metric_images ALTER COLUMN id SET DEFAULT nextval('alert_management_alert_metric_images_id_seq'::regclass);

ALTER TABLE ONLY alert_management_alert_user_mentions ALTER COLUMN id SET DEFAULT nextval('alert_management_alert_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY alert_management_alerts ALTER COLUMN id SET DEFAULT nextval('alert_management_alerts_id_seq'::regclass);

ALTER TABLE ONLY alert_management_http_integrations ALTER COLUMN id SET DEFAULT nextval('alert_management_http_integrations_id_seq'::regclass);

ALTER TABLE ONLY allowed_email_domains ALTER COLUMN id SET DEFAULT nextval('allowed_email_domains_id_seq'::regclass);

ALTER TABLE ONLY analytics_cycle_analytics_group_stages ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_group_stages_id_seq'::regclass);

ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_group_value_streams_id_seq'::regclass);

ALTER TABLE ONLY analytics_cycle_analytics_stage_event_hashes ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_stage_event_hashes_id_seq'::regclass);

ALTER TABLE ONLY analytics_dashboards_pointers ALTER COLUMN id SET DEFAULT nextval('analytics_dashboards_pointers_id_seq'::regclass);

ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segments_id_seq'::regclass);

ALTER TABLE ONLY analytics_devops_adoption_snapshots ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_snapshots_id_seq'::regclass);

ALTER TABLE ONLY analytics_usage_trends_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_usage_trends_measurements_id_seq'::regclass);

ALTER TABLE ONLY analyzer_namespace_statuses ALTER COLUMN id SET DEFAULT nextval('analyzer_namespace_statuses_id_seq'::regclass);

ALTER TABLE ONLY analyzer_project_statuses ALTER COLUMN id SET DEFAULT nextval('analyzer_project_statuses_id_seq'::regclass);

ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass);

ALTER TABLE ONLY application_setting_terms ALTER COLUMN id SET DEFAULT nextval('application_setting_terms_id_seq'::regclass);

ALTER TABLE ONLY application_settings ALTER COLUMN id SET DEFAULT nextval('application_settings_id_seq'::regclass);

ALTER TABLE ONLY approval_group_rules ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_id_seq'::regclass);

ALTER TABLE ONLY approval_group_rules_groups ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_groups_id_seq'::regclass);

ALTER TABLE ONLY approval_group_rules_protected_branches ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_protected_branches_id_seq'::regclass);

ALTER TABLE ONLY approval_group_rules_users ALTER COLUMN id SET DEFAULT nextval('approval_group_rules_users_id_seq'::regclass);

ALTER TABLE ONLY approval_merge_request_rule_sources ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rule_sources_id_seq'::regclass);

ALTER TABLE ONLY approval_merge_request_rules ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rules_id_seq'::regclass);

ALTER TABLE ONLY approval_merge_request_rules_approved_approvers ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rules_approved_approvers_id_seq'::regclass);

ALTER TABLE ONLY approval_merge_request_rules_groups ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rules_groups_id_seq'::regclass);

ALTER TABLE ONLY approval_merge_request_rules_users ALTER COLUMN id SET DEFAULT nextval('approval_merge_request_rules_users_id_seq'::regclass);

ALTER TABLE ONLY approval_policy_rule_project_links ALTER COLUMN id SET DEFAULT nextval('approval_policy_rule_project_links_id_seq'::regclass);

ALTER TABLE ONLY approval_policy_rules ALTER COLUMN id SET DEFAULT nextval('approval_policy_rules_id_seq'::regclass);

ALTER TABLE ONLY approval_project_rules ALTER COLUMN id SET DEFAULT nextval('approval_project_rules_id_seq'::regclass);

ALTER TABLE ONLY approval_project_rules_groups ALTER COLUMN id SET DEFAULT nextval('approval_project_rules_groups_id_seq'::regclass);

ALTER TABLE ONLY approval_project_rules_users ALTER COLUMN id SET DEFAULT nextval('approval_project_rules_users_id_seq'::regclass);

ALTER TABLE ONLY approvals ALTER COLUMN id SET DEFAULT nextval('approvals_id_seq'::regclass);

ALTER TABLE ONLY approver_groups ALTER COLUMN id SET DEFAULT nextval('approver_groups_id_seq'::regclass);

ALTER TABLE ONLY approvers ALTER COLUMN id SET DEFAULT nextval('approvers_id_seq'::regclass);

ALTER TABLE ONLY arkose_sessions ALTER COLUMN id SET DEFAULT nextval('arkose_sessions_id_seq'::regclass);

ALTER TABLE ONLY atlassian_identities ALTER COLUMN user_id SET DEFAULT nextval('atlassian_identities_user_id_seq'::regclass);

ALTER TABLE ONLY audit_events ALTER COLUMN id SET DEFAULT nextval('audit_events_id_seq'::regclass);

ALTER TABLE ONLY audit_events_amazon_s3_configurations ALTER COLUMN id SET DEFAULT nextval('audit_events_amazon_s3_configurations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_external_audit_event_destinations ALTER COLUMN id SET DEFAULT nextval('audit_events_external_audit_event_destinations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_google_cloud_logging_configurations ALTER COLUMN id SET DEFAULT nextval('audit_events_google_cloud_logging_configurations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_group_external_streaming_destinations ALTER COLUMN id SET DEFAULT nextval('audit_events_group_external_streaming_destinations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_group_streaming_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_group_streaming_event_type_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_instance_amazon_s3_configurations ALTER COLUMN id SET DEFAULT nextval('audit_events_instance_amazon_s3_configurations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_instance_external_audit_event_destinations ALTER COLUMN id SET DEFAULT nextval('audit_events_instance_external_audit_event_destinations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_instance_external_streaming_destinations ALTER COLUMN id SET DEFAULT nextval('audit_events_instance_external_streaming_destinations_id_seq'::regclass);

ALTER TABLE ONLY audit_events_instance_google_cloud_logging_configurations ALTER COLUMN id SET DEFAULT nextval('audit_events_instance_google_cloud_logging_configuration_id_seq'::regclass);

ALTER TABLE ONLY audit_events_instance_streaming_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_instance_streaming_event_type_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_event_type_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_group_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_group_namespace_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_headers ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_headers_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_http_group_namespace_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_http_instance_namespace_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_instance_event_type_filters_id_seq'::regclass);

ALTER TABLE ONLY audit_events_streaming_instance_namespace_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_instance_namespace_filters_id_seq'::regclass);

ALTER TABLE ONLY authentication_events ALTER COLUMN id SET DEFAULT nextval('authentication_events_id_seq'::regclass);

ALTER TABLE ONLY automation_rules ALTER COLUMN id SET DEFAULT nextval('automation_rules_id_seq'::regclass);

ALTER TABLE ONLY award_emoji ALTER COLUMN id SET DEFAULT nextval('award_emoji_id_seq'::regclass);

ALTER TABLE ONLY background_migration_jobs ALTER COLUMN id SET DEFAULT nextval('background_migration_jobs_id_seq'::regclass);

ALTER TABLE ONLY badges ALTER COLUMN id SET DEFAULT nextval('badges_id_seq'::regclass);

ALTER TABLE ONLY batched_background_migration_job_transition_logs ALTER COLUMN id SET DEFAULT nextval('batched_background_migration_job_transition_logs_id_seq'::regclass);

ALTER TABLE ONLY batched_background_migration_jobs ALTER COLUMN id SET DEFAULT nextval('batched_background_migration_jobs_id_seq'::regclass);

ALTER TABLE ONLY batched_background_migrations ALTER COLUMN id SET DEFAULT nextval('batched_background_migrations_id_seq'::regclass);

ALTER TABLE ONLY board_assignees ALTER COLUMN id SET DEFAULT nextval('board_assignees_id_seq'::regclass);

ALTER TABLE ONLY board_group_recent_visits ALTER COLUMN id SET DEFAULT nextval('board_group_recent_visits_id_seq'::regclass);

ALTER TABLE ONLY board_labels ALTER COLUMN id SET DEFAULT nextval('board_labels_id_seq'::regclass);

ALTER TABLE ONLY board_project_recent_visits ALTER COLUMN id SET DEFAULT nextval('board_project_recent_visits_id_seq'::regclass);

ALTER TABLE ONLY board_user_preferences ALTER COLUMN id SET DEFAULT nextval('board_user_preferences_id_seq'::regclass);

ALTER TABLE ONLY boards ALTER COLUMN id SET DEFAULT nextval('boards_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_board_labels ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_labels_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_board_positions ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_positions_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_board_recent_visits ALTER COLUMN id SET DEFAULT nextval('boards_epic_board_recent_visits_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_boards ALTER COLUMN id SET DEFAULT nextval('boards_epic_boards_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_list_user_preferences ALTER COLUMN id SET DEFAULT nextval('boards_epic_list_user_preferences_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_lists ALTER COLUMN id SET DEFAULT nextval('boards_epic_lists_id_seq'::regclass);

ALTER TABLE ONLY boards_epic_user_preferences ALTER COLUMN id SET DEFAULT nextval('boards_epic_user_preferences_id_seq'::regclass);

ALTER TABLE ONLY broadcast_messages ALTER COLUMN id SET DEFAULT nextval('broadcast_messages_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_batch_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_batch_trackers_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval('bulk_import_configurations_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_export_batches ALTER COLUMN id SET DEFAULT nextval('bulk_import_export_batches_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_export_uploads ALTER COLUMN id SET DEFAULT nextval('bulk_import_export_uploads_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_exports ALTER COLUMN id SET DEFAULT nextval('bulk_import_exports_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_failures ALTER COLUMN id SET DEFAULT nextval('bulk_import_failures_id_seq'::regclass);

ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_trackers_id_seq'::regclass);

ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass);

ALTER TABLE ONLY catalog_resource_component_last_usages ALTER COLUMN id SET DEFAULT nextval('catalog_resource_component_last_usages_id_seq'::regclass);

ALTER TABLE ONLY catalog_resource_components ALTER COLUMN id SET DEFAULT nextval('catalog_resource_components_id_seq'::regclass);

ALTER TABLE ONLY catalog_resource_versions ALTER COLUMN id SET DEFAULT nextval('catalog_resource_versions_id_seq'::regclass);

ALTER TABLE ONLY catalog_resources ALTER COLUMN id SET DEFAULT nextval('catalog_resources_id_seq'::regclass);

ALTER TABLE ONLY catalog_verified_namespaces ALTER COLUMN id SET DEFAULT nextval('catalog_verified_namespaces_id_seq'::regclass);

ALTER TABLE ONLY chat_names ALTER COLUMN id SET DEFAULT nextval('chat_names_id_seq'::regclass);

ALTER TABLE ONLY chat_teams ALTER COLUMN id SET DEFAULT nextval('chat_teams_id_seq'::regclass);

ALTER TABLE ONLY ci_build_needs ALTER COLUMN id SET DEFAULT nextval('ci_build_needs_id_seq'::regclass);

ALTER TABLE ONLY ci_build_pending_states ALTER COLUMN id SET DEFAULT nextval('ci_build_pending_states_id_seq'::regclass);

ALTER TABLE ONLY ci_build_trace_chunks ALTER COLUMN id SET DEFAULT nextval('ci_build_trace_chunks_id_seq'::regclass);

ALTER TABLE ONLY ci_builds_runner_session ALTER COLUMN id SET DEFAULT nextval('ci_builds_runner_session_id_seq'::regclass);

ALTER TABLE ONLY ci_daily_build_group_report_results ALTER COLUMN id SET DEFAULT nextval('ci_daily_build_group_report_results_id_seq'::regclass);

ALTER TABLE ONLY ci_deleted_objects ALTER COLUMN id SET DEFAULT nextval('ci_deleted_objects_id_seq'::regclass);

ALTER TABLE ONLY ci_freeze_periods ALTER COLUMN id SET DEFAULT nextval('ci_freeze_periods_id_seq'::regclass);

ALTER TABLE ONLY ci_gitlab_hosted_runner_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_gitlab_hosted_runner_monthly_usages_id_seq'::regclass);

ALTER TABLE ONLY ci_group_variables ALTER COLUMN id SET DEFAULT nextval('ci_group_variables_id_seq'::regclass);

ALTER TABLE ONLY ci_instance_runner_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_instance_runner_monthly_usages_id_seq'::regclass);

ALTER TABLE ONLY ci_instance_variables ALTER COLUMN id SET DEFAULT nextval('ci_instance_variables_id_seq'::regclass);

ALTER TABLE ONLY ci_job_token_authorizations ALTER COLUMN id SET DEFAULT nextval('ci_job_token_authorizations_id_seq'::regclass);

ALTER TABLE ONLY ci_job_token_group_scope_links ALTER COLUMN id SET DEFAULT nextval('ci_job_token_group_scope_links_id_seq'::regclass);

ALTER TABLE ONLY ci_job_token_project_scope_links ALTER COLUMN id SET DEFAULT nextval('ci_job_token_project_scope_links_id_seq'::regclass);

ALTER TABLE ONLY ci_job_variables ALTER COLUMN id SET DEFAULT nextval('ci_job_variables_id_seq'::regclass);

ALTER TABLE ONLY ci_minutes_additional_packs ALTER COLUMN id SET DEFAULT nextval('ci_minutes_additional_packs_id_seq'::regclass);

ALTER TABLE ONLY ci_namespace_mirrors ALTER COLUMN id SET DEFAULT nextval('ci_namespace_mirrors_id_seq'::regclass);

ALTER TABLE ONLY ci_namespace_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_namespace_monthly_usages_id_seq'::regclass);

ALTER TABLE ONLY ci_pending_builds ALTER COLUMN id SET DEFAULT nextval('ci_pending_builds_id_seq'::regclass);

ALTER TABLE ONLY ci_pipeline_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_artifacts_id_seq'::regclass);

ALTER TABLE ONLY ci_pipeline_chat_data ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_chat_data_id_seq'::regclass);

ALTER TABLE ONLY ci_pipeline_messages ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_messages_id_seq'::regclass);

ALTER TABLE ONLY ci_pipeline_schedule_inputs ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_schedule_inputs_id_seq'::regclass);

ALTER TABLE ONLY ci_pipeline_schedule_variables ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_schedule_variables_id_seq'::regclass);

ALTER TABLE ONLY ci_pipeline_schedules ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_schedules_id_seq'::regclass);

ALTER TABLE ONLY ci_project_mirrors ALTER COLUMN id SET DEFAULT nextval('ci_project_mirrors_id_seq'::regclass);

ALTER TABLE ONLY ci_project_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_project_monthly_usages_id_seq'::regclass);

ALTER TABLE ONLY ci_refs ALTER COLUMN id SET DEFAULT nextval('ci_refs_id_seq'::regclass);

ALTER TABLE ONLY ci_resource_groups ALTER COLUMN id SET DEFAULT nextval('ci_resource_groups_id_seq'::regclass);

ALTER TABLE ONLY ci_resources ALTER COLUMN id SET DEFAULT nextval('ci_resources_id_seq'::regclass);

ALTER TABLE ONLY ci_runner_namespaces ALTER COLUMN id SET DEFAULT nextval('ci_runner_namespaces_id_seq'::regclass);

ALTER TABLE ONLY ci_runner_projects ALTER COLUMN id SET DEFAULT nextval('ci_runner_projects_id_seq'::regclass);

ALTER TABLE ONLY ci_running_builds ALTER COLUMN id SET DEFAULT nextval('ci_running_builds_id_seq'::regclass);

ALTER TABLE ONLY ci_secure_file_states ALTER COLUMN ci_secure_file_id SET DEFAULT nextval('ci_secure_file_states_ci_secure_file_id_seq'::regclass);

ALTER TABLE ONLY ci_secure_files ALTER COLUMN id SET DEFAULT nextval('ci_secure_files_id_seq'::regclass);

ALTER TABLE ONLY ci_sources_pipelines ALTER COLUMN id SET DEFAULT nextval('ci_sources_pipelines_id_seq'::regclass);

ALTER TABLE ONLY ci_sources_projects ALTER COLUMN id SET DEFAULT nextval('ci_sources_projects_id_seq'::regclass);

ALTER TABLE ONLY ci_subscriptions_projects ALTER COLUMN id SET DEFAULT nextval('ci_subscriptions_projects_id_seq'::regclass);

ALTER TABLE ONLY ci_triggers ALTER COLUMN id SET DEFAULT nextval('ci_triggers_id_seq'::regclass);

ALTER TABLE ONLY ci_unit_test_failures ALTER COLUMN id SET DEFAULT nextval('ci_unit_test_failures_id_seq'::regclass);

ALTER TABLE ONLY ci_unit_tests ALTER COLUMN id SET DEFAULT nextval('ci_unit_tests_id_seq'::regclass);

ALTER TABLE ONLY ci_variables ALTER COLUMN id SET DEFAULT nextval('ci_variables_id_seq'::regclass);

ALTER TABLE ONLY cloud_connector_access ALTER COLUMN id SET DEFAULT nextval('cloud_connector_access_id_seq'::regclass);

ALTER TABLE ONLY cloud_connector_keys ALTER COLUMN id SET DEFAULT nextval('cloud_connector_keys_id_seq'::regclass);

ALTER TABLE ONLY cluster_agent_migrations ALTER COLUMN id SET DEFAULT nextval('cluster_agent_migrations_id_seq'::regclass);

ALTER TABLE ONLY cluster_agent_tokens ALTER COLUMN id SET DEFAULT nextval('cluster_agent_tokens_id_seq'::regclass);

ALTER TABLE ONLY cluster_agent_url_configurations ALTER COLUMN id SET DEFAULT nextval('cluster_agent_url_configurations_id_seq'::regclass);

ALTER TABLE ONLY cluster_agents ALTER COLUMN id SET DEFAULT nextval('cluster_agents_id_seq'::regclass);

ALTER TABLE ONLY cluster_enabled_grants ALTER COLUMN id SET DEFAULT nextval('cluster_enabled_grants_id_seq'::regclass);

ALTER TABLE ONLY cluster_groups ALTER COLUMN id SET DEFAULT nextval('cluster_groups_id_seq'::regclass);

ALTER TABLE ONLY cluster_platforms_kubernetes ALTER COLUMN id SET DEFAULT nextval('cluster_platforms_kubernetes_id_seq'::regclass);

ALTER TABLE ONLY cluster_projects ALTER COLUMN id SET DEFAULT nextval('cluster_projects_id_seq'::regclass);

ALTER TABLE ONLY cluster_providers_aws ALTER COLUMN id SET DEFAULT nextval('cluster_providers_aws_id_seq'::regclass);

ALTER TABLE ONLY cluster_providers_gcp ALTER COLUMN id SET DEFAULT nextval('cluster_providers_gcp_id_seq'::regclass);

ALTER TABLE ONLY clusters ALTER COLUMN id SET DEFAULT nextval('clusters_id_seq'::regclass);

ALTER TABLE ONLY clusters_kubernetes_namespaces ALTER COLUMN id SET DEFAULT nextval('clusters_kubernetes_namespaces_id_seq'::regclass);

ALTER TABLE ONLY clusters_managed_resources ALTER COLUMN id SET DEFAULT nextval('clusters_managed_resources_id_seq'::regclass);

ALTER TABLE ONLY commit_user_mentions ALTER COLUMN id SET DEFAULT nextval('commit_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY compliance_framework_security_policies ALTER COLUMN id SET DEFAULT nextval('compliance_framework_security_policies_id_seq'::regclass);

ALTER TABLE ONLY compliance_management_frameworks ALTER COLUMN id SET DEFAULT nextval('compliance_management_frameworks_id_seq'::regclass);

ALTER TABLE ONLY compliance_requirements ALTER COLUMN id SET DEFAULT nextval('compliance_requirements_id_seq'::regclass);

ALTER TABLE ONLY compliance_requirements_controls ALTER COLUMN id SET DEFAULT nextval('compliance_requirements_controls_id_seq'::regclass);

ALTER TABLE ONLY compromised_password_detections ALTER COLUMN id SET DEFAULT nextval('compromised_password_detections_id_seq'::regclass);

ALTER TABLE ONLY container_registry_protection_rules ALTER COLUMN id SET DEFAULT nextval('container_registry_protection_rules_id_seq'::regclass);

ALTER TABLE ONLY container_registry_protection_tag_rules ALTER COLUMN id SET DEFAULT nextval('container_registry_protection_tag_rules_id_seq'::regclass);

ALTER TABLE ONLY container_repositories ALTER COLUMN id SET DEFAULT nextval('container_repositories_id_seq'::regclass);

ALTER TABLE ONLY content_blocked_states ALTER COLUMN id SET DEFAULT nextval('content_blocked_states_id_seq'::regclass);

ALTER TABLE ONLY conversational_development_index_metrics ALTER COLUMN id SET DEFAULT nextval('conversational_development_index_metrics_id_seq'::regclass);

ALTER TABLE ONLY country_access_logs ALTER COLUMN id SET DEFAULT nextval('country_access_logs_id_seq'::regclass);

ALTER TABLE ONLY coverage_fuzzing_corpuses ALTER COLUMN id SET DEFAULT nextval('coverage_fuzzing_corpuses_id_seq'::regclass);

ALTER TABLE ONLY csv_issue_imports ALTER COLUMN id SET DEFAULT nextval('csv_issue_imports_id_seq'::regclass);

ALTER TABLE ONLY custom_emoji ALTER COLUMN id SET DEFAULT nextval('custom_emoji_id_seq'::regclass);

ALTER TABLE ONLY custom_field_select_options ALTER COLUMN id SET DEFAULT nextval('custom_field_select_options_id_seq'::regclass);

ALTER TABLE ONLY custom_fields ALTER COLUMN id SET DEFAULT nextval('custom_fields_id_seq'::regclass);

ALTER TABLE ONLY custom_software_licenses ALTER COLUMN id SET DEFAULT nextval('custom_software_licenses_id_seq'::regclass);

ALTER TABLE ONLY customer_relations_contacts ALTER COLUMN id SET DEFAULT nextval('customer_relations_contacts_id_seq'::regclass);

ALTER TABLE ONLY customer_relations_organizations ALTER COLUMN id SET DEFAULT nextval('customer_relations_organizations_id_seq'::regclass);

ALTER TABLE ONLY dast_pre_scan_verification_steps ALTER COLUMN id SET DEFAULT nextval('dast_pre_scan_verification_steps_id_seq'::regclass);

ALTER TABLE ONLY dast_pre_scan_verifications ALTER COLUMN id SET DEFAULT nextval('dast_pre_scan_verifications_id_seq'::regclass);

ALTER TABLE ONLY dast_profile_schedules ALTER COLUMN id SET DEFAULT nextval('dast_profile_schedules_id_seq'::regclass);

ALTER TABLE ONLY dast_profiles ALTER COLUMN id SET DEFAULT nextval('dast_profiles_id_seq'::regclass);

ALTER TABLE ONLY dast_profiles_tags ALTER COLUMN id SET DEFAULT nextval('dast_profiles_tags_id_seq'::regclass);

ALTER TABLE ONLY dast_scanner_profiles ALTER COLUMN id SET DEFAULT nextval('dast_scanner_profiles_id_seq'::regclass);

ALTER TABLE ONLY dast_site_profile_secret_variables ALTER COLUMN id SET DEFAULT nextval('dast_site_profile_secret_variables_id_seq'::regclass);

ALTER TABLE ONLY dast_site_profiles ALTER COLUMN id SET DEFAULT nextval('dast_site_profiles_id_seq'::regclass);

ALTER TABLE ONLY dast_site_tokens ALTER COLUMN id SET DEFAULT nextval('dast_site_tokens_id_seq'::regclass);

ALTER TABLE ONLY dast_site_validations ALTER COLUMN id SET DEFAULT nextval('dast_site_validations_id_seq'::regclass);

ALTER TABLE ONLY dast_sites ALTER COLUMN id SET DEFAULT nextval('dast_sites_id_seq'::regclass);

ALTER TABLE ONLY dependency_list_export_parts ALTER COLUMN id SET DEFAULT nextval('dependency_list_export_parts_id_seq'::regclass);

ALTER TABLE ONLY dependency_list_exports ALTER COLUMN id SET DEFAULT nextval('dependency_list_exports_id_seq'::regclass);

ALTER TABLE ONLY dependency_proxy_blobs ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_blobs_id_seq'::regclass);

ALTER TABLE ONLY dependency_proxy_group_settings ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_group_settings_id_seq'::regclass);

ALTER TABLE ONLY dependency_proxy_manifests ALTER COLUMN id SET DEFAULT nextval('dependency_proxy_manifests_id_seq'::regclass);

ALTER TABLE ONLY deploy_keys_projects ALTER COLUMN id SET DEFAULT nextval('deploy_keys_projects_id_seq'::regclass);

ALTER TABLE ONLY deploy_tokens ALTER COLUMN id SET DEFAULT nextval('deploy_tokens_id_seq'::regclass);

ALTER TABLE ONLY deployment_approvals ALTER COLUMN id SET DEFAULT nextval('deployment_approvals_id_seq'::regclass);

ALTER TABLE ONLY deployments ALTER COLUMN id SET DEFAULT nextval('deployments_id_seq'::regclass);

ALTER TABLE ONLY description_versions ALTER COLUMN id SET DEFAULT nextval('description_versions_id_seq'::regclass);

ALTER TABLE ONLY design_management_designs ALTER COLUMN id SET DEFAULT nextval('design_management_designs_id_seq'::regclass);

ALTER TABLE ONLY design_management_designs_versions ALTER COLUMN id SET DEFAULT nextval('design_management_designs_versions_id_seq'::regclass);

ALTER TABLE ONLY design_management_repositories ALTER COLUMN id SET DEFAULT nextval('design_management_repositories_id_seq'::regclass);

ALTER TABLE ONLY design_management_versions ALTER COLUMN id SET DEFAULT nextval('design_management_versions_id_seq'::regclass);

ALTER TABLE ONLY design_user_mentions ALTER COLUMN id SET DEFAULT nextval('design_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY detached_partitions ALTER COLUMN id SET DEFAULT nextval('detached_partitions_id_seq'::regclass);

ALTER TABLE ONLY diff_note_positions ALTER COLUMN id SET DEFAULT nextval('diff_note_positions_id_seq'::regclass);

ALTER TABLE ONLY dingtalk_tracker_data ALTER COLUMN id SET DEFAULT nextval('dingtalk_tracker_data_id_seq'::regclass);

ALTER TABLE ONLY dora_configurations ALTER COLUMN id SET DEFAULT nextval('dora_configurations_id_seq'::regclass);

ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_daily_metrics_id_seq'::regclass);

ALTER TABLE ONLY dora_performance_scores ALTER COLUMN id SET DEFAULT nextval('dora_performance_scores_id_seq'::regclass);

ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass);

ALTER TABLE ONLY duo_workflows_checkpoint_writes ALTER COLUMN id SET DEFAULT nextval('duo_workflows_checkpoint_writes_id_seq'::regclass);

ALTER TABLE ONLY duo_workflows_checkpoints ALTER COLUMN id SET DEFAULT nextval('duo_workflows_checkpoints_id_seq'::regclass);

ALTER TABLE ONLY duo_workflows_events ALTER COLUMN id SET DEFAULT nextval('duo_workflows_events_id_seq'::regclass);

ALTER TABLE ONLY duo_workflows_workflows ALTER COLUMN id SET DEFAULT nextval('duo_workflows_workflows_id_seq'::regclass);

ALTER TABLE ONLY duo_workflows_workloads ALTER COLUMN id SET DEFAULT nextval('duo_workflows_workloads_id_seq'::regclass);

ALTER TABLE ONLY early_access_program_tracking_events ALTER COLUMN id SET DEFAULT nextval('early_access_program_tracking_events_id_seq'::regclass);

ALTER TABLE ONLY elastic_index_settings ALTER COLUMN id SET DEFAULT nextval('elastic_index_settings_id_seq'::regclass);

ALTER TABLE ONLY elastic_reindexing_slices ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_slices_id_seq'::regclass);

ALTER TABLE ONLY elastic_reindexing_subtasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_subtasks_id_seq'::regclass);

ALTER TABLE ONLY elastic_reindexing_tasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_tasks_id_seq'::regclass);

ALTER TABLE ONLY emails ALTER COLUMN id SET DEFAULT nextval('emails_id_seq'::regclass);

ALTER TABLE ONLY environments ALTER COLUMN id SET DEFAULT nextval('environments_id_seq'::regclass);

ALTER TABLE ONLY epic_issues ALTER COLUMN id SET DEFAULT nextval('epic_issues_id_seq'::regclass);

ALTER TABLE ONLY epic_user_mentions ALTER COLUMN id SET DEFAULT nextval('epic_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY epics ALTER COLUMN id SET DEFAULT nextval('epics_id_seq'::regclass);

ALTER TABLE ONLY error_tracking_client_keys ALTER COLUMN id SET DEFAULT nextval('error_tracking_client_keys_id_seq'::regclass);

ALTER TABLE ONLY error_tracking_error_events ALTER COLUMN id SET DEFAULT nextval('error_tracking_error_events_id_seq'::regclass);

ALTER TABLE ONLY error_tracking_errors ALTER COLUMN id SET DEFAULT nextval('error_tracking_errors_id_seq'::regclass);

ALTER TABLE ONLY events ALTER COLUMN id SET DEFAULT nextval('events_id_seq'::regclass);

ALTER TABLE ONLY evidences ALTER COLUMN id SET DEFAULT nextval('evidences_id_seq'::regclass);

ALTER TABLE ONLY excluded_merge_requests ALTER COLUMN id SET DEFAULT nextval('excluded_merge_requests_id_seq'::regclass);

ALTER TABLE ONLY external_approval_rules ALTER COLUMN id SET DEFAULT nextval('external_approval_rules_id_seq'::regclass);

ALTER TABLE ONLY external_pull_requests ALTER COLUMN id SET DEFAULT nextval('external_pull_requests_id_seq'::regclass);

ALTER TABLE ONLY external_status_checks ALTER COLUMN id SET DEFAULT nextval('external_status_checks_id_seq'::regclass);

ALTER TABLE ONLY external_status_checks_protected_branches ALTER COLUMN id SET DEFAULT nextval('external_status_checks_protected_branches_id_seq'::regclass);

ALTER TABLE ONLY feature_gates ALTER COLUMN id SET DEFAULT nextval('feature_gates_id_seq'::regclass);

ALTER TABLE ONLY features ALTER COLUMN id SET DEFAULT nextval('features_id_seq'::regclass);

ALTER TABLE ONLY fork_network_members ALTER COLUMN id SET DEFAULT nextval('fork_network_members_id_seq'::regclass);

ALTER TABLE ONLY fork_networks ALTER COLUMN id SET DEFAULT nextval('fork_networks_id_seq'::regclass);

ALTER TABLE ONLY geo_cache_invalidation_events ALTER COLUMN id SET DEFAULT nextval('geo_cache_invalidation_events_id_seq'::regclass);

ALTER TABLE ONLY geo_event_log ALTER COLUMN id SET DEFAULT nextval('geo_event_log_id_seq'::regclass);

ALTER TABLE ONLY geo_events ALTER COLUMN id SET DEFAULT nextval('geo_events_id_seq'::regclass);

ALTER TABLE ONLY geo_node_namespace_links ALTER COLUMN id SET DEFAULT nextval('geo_node_namespace_links_id_seq'::regclass);

ALTER TABLE ONLY geo_node_statuses ALTER COLUMN id SET DEFAULT nextval('geo_node_statuses_id_seq'::regclass);

ALTER TABLE ONLY geo_nodes ALTER COLUMN id SET DEFAULT nextval('geo_nodes_id_seq'::regclass);

ALTER TABLE ONLY ghost_user_migrations ALTER COLUMN id SET DEFAULT nextval('ghost_user_migrations_id_seq'::regclass);

ALTER TABLE ONLY gitlab_subscription_histories ALTER COLUMN id SET DEFAULT nextval('gitlab_subscription_histories_id_seq'::regclass);

ALTER TABLE ONLY gitlab_subscriptions ALTER COLUMN id SET DEFAULT nextval('gitlab_subscriptions_id_seq'::regclass);

ALTER TABLE ONLY gpg_key_subkeys ALTER COLUMN id SET DEFAULT nextval('gpg_key_subkeys_id_seq'::regclass);

ALTER TABLE ONLY gpg_keys ALTER COLUMN id SET DEFAULT nextval('gpg_keys_id_seq'::regclass);

ALTER TABLE ONLY gpg_signatures ALTER COLUMN id SET DEFAULT nextval('gpg_signatures_id_seq'::regclass);

ALTER TABLE ONLY grafana_integrations ALTER COLUMN id SET DEFAULT nextval('grafana_integrations_id_seq'::regclass);

ALTER TABLE ONLY group_crm_settings ALTER COLUMN group_id SET DEFAULT nextval('group_crm_settings_group_id_seq'::regclass);

ALTER TABLE ONLY group_custom_attributes ALTER COLUMN id SET DEFAULT nextval('group_custom_attributes_id_seq'::regclass);

ALTER TABLE ONLY group_deploy_keys ALTER COLUMN id SET DEFAULT nextval('group_deploy_keys_id_seq'::regclass);

ALTER TABLE ONLY group_deploy_keys_groups ALTER COLUMN id SET DEFAULT nextval('group_deploy_keys_groups_id_seq'::regclass);

ALTER TABLE ONLY group_deploy_tokens ALTER COLUMN id SET DEFAULT nextval('group_deploy_tokens_id_seq'::regclass);

ALTER TABLE ONLY group_group_links ALTER COLUMN id SET DEFAULT nextval('group_group_links_id_seq'::regclass);

ALTER TABLE ONLY group_import_states ALTER COLUMN group_id SET DEFAULT nextval('group_import_states_group_id_seq'::regclass);

ALTER TABLE ONLY group_push_rules ALTER COLUMN id SET DEFAULT nextval('group_push_rules_id_seq'::regclass);

ALTER TABLE ONLY group_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('group_repository_storage_moves_id_seq'::regclass);

ALTER TABLE ONLY group_saved_replies ALTER COLUMN id SET DEFAULT nextval('group_saved_replies_id_seq'::regclass);

ALTER TABLE ONLY group_scim_auth_access_tokens ALTER COLUMN id SET DEFAULT nextval('group_scim_auth_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY group_scim_identities ALTER COLUMN id SET DEFAULT nextval('group_scim_identities_id_seq'::regclass);

ALTER TABLE ONLY group_security_exclusions ALTER COLUMN id SET DEFAULT nextval('group_security_exclusions_id_seq'::regclass);

ALTER TABLE ONLY group_ssh_certificates ALTER COLUMN id SET DEFAULT nextval('group_ssh_certificates_id_seq'::regclass);

ALTER TABLE ONLY group_wiki_repository_states ALTER COLUMN id SET DEFAULT nextval('group_wiki_repository_states_id_seq'::regclass);

ALTER TABLE ONLY groups_visits ALTER COLUMN id SET DEFAULT nextval('groups_visits_id_seq'::regclass);

ALTER TABLE ONLY historical_data ALTER COLUMN id SET DEFAULT nextval('historical_data_id_seq'::regclass);

ALTER TABLE ONLY identities ALTER COLUMN id SET DEFAULT nextval('identities_id_seq'::regclass);

ALTER TABLE ONLY import_export_uploads ALTER COLUMN id SET DEFAULT nextval('import_export_uploads_id_seq'::regclass);

ALTER TABLE ONLY import_failures ALTER COLUMN id SET DEFAULT nextval('import_failures_id_seq'::regclass);

ALTER TABLE ONLY import_placeholder_memberships ALTER COLUMN id SET DEFAULT nextval('import_placeholder_memberships_id_seq'::regclass);

ALTER TABLE ONLY import_placeholder_user_details ALTER COLUMN id SET DEFAULT nextval('import_placeholder_user_details_id_seq'::regclass);

ALTER TABLE ONLY import_source_user_placeholder_references ALTER COLUMN id SET DEFAULT nextval('import_source_user_placeholder_references_id_seq'::regclass);

ALTER TABLE ONLY import_source_users ALTER COLUMN id SET DEFAULT nextval('import_source_users_id_seq'::regclass);

ALTER TABLE ONLY incident_management_escalation_policies ALTER COLUMN id SET DEFAULT nextval('incident_management_escalation_policies_id_seq'::regclass);

ALTER TABLE ONLY incident_management_escalation_rules ALTER COLUMN id SET DEFAULT nextval('incident_management_escalation_rules_id_seq'::regclass);

ALTER TABLE ONLY incident_management_issuable_escalation_statuses ALTER COLUMN id SET DEFAULT nextval('incident_management_issuable_escalation_statuses_id_seq'::regclass);

ALTER TABLE ONLY incident_management_oncall_participants ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_participants_id_seq'::regclass);

ALTER TABLE ONLY incident_management_oncall_rotations ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_rotations_id_seq'::regclass);

ALTER TABLE ONLY incident_management_oncall_schedules ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_schedules_id_seq'::regclass);

ALTER TABLE ONLY incident_management_oncall_shifts ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_shifts_id_seq'::regclass);

ALTER TABLE ONLY incident_management_pending_alert_escalations ALTER COLUMN id SET DEFAULT nextval('incident_management_pending_alert_escalations_id_seq'::regclass);

ALTER TABLE ONLY incident_management_pending_issue_escalations ALTER COLUMN id SET DEFAULT nextval('incident_management_pending_issue_escalations_id_seq'::regclass);

ALTER TABLE ONLY incident_management_timeline_event_tag_links ALTER COLUMN id SET DEFAULT nextval('incident_management_timeline_event_tag_links_id_seq'::regclass);

ALTER TABLE ONLY incident_management_timeline_event_tags ALTER COLUMN id SET DEFAULT nextval('incident_management_timeline_event_tags_id_seq'::regclass);

ALTER TABLE ONLY incident_management_timeline_events ALTER COLUMN id SET DEFAULT nextval('incident_management_timeline_events_id_seq'::regclass);

ALTER TABLE ONLY index_statuses ALTER COLUMN id SET DEFAULT nextval('index_statuses_id_seq'::regclass);

ALTER TABLE ONLY insights ALTER COLUMN id SET DEFAULT nextval('insights_id_seq'::regclass);

ALTER TABLE ONLY instance_audit_events_streaming_headers ALTER COLUMN id SET DEFAULT nextval('instance_audit_events_streaming_headers_id_seq'::regclass);

ALTER TABLE ONLY instance_integrations ALTER COLUMN id SET DEFAULT nextval('instance_integrations_id_seq'::regclass);

ALTER TABLE ONLY integrations ALTER COLUMN id SET DEFAULT nextval('integrations_id_seq'::regclass);

ALTER TABLE ONLY internal_ids ALTER COLUMN id SET DEFAULT nextval('internal_ids_id_seq'::regclass);

ALTER TABLE ONLY ip_restrictions ALTER COLUMN id SET DEFAULT nextval('ip_restrictions_id_seq'::regclass);

ALTER TABLE ONLY issuable_metric_images ALTER COLUMN id SET DEFAULT nextval('issuable_metric_images_id_seq'::regclass);

ALTER TABLE ONLY issuable_resource_links ALTER COLUMN id SET DEFAULT nextval('issuable_resource_links_id_seq'::regclass);

ALTER TABLE ONLY issuable_severities ALTER COLUMN id SET DEFAULT nextval('issuable_severities_id_seq'::regclass);

ALTER TABLE ONLY issuable_slas ALTER COLUMN id SET DEFAULT nextval('issuable_slas_id_seq'::regclass);

ALTER TABLE ONLY issue_assignment_events ALTER COLUMN id SET DEFAULT nextval('issue_assignment_events_id_seq'::regclass);

ALTER TABLE ONLY issue_customer_relations_contacts ALTER COLUMN id SET DEFAULT nextval('issue_customer_relations_contacts_id_seq'::regclass);

ALTER TABLE ONLY issue_email_participants ALTER COLUMN id SET DEFAULT nextval('issue_email_participants_id_seq'::regclass);

ALTER TABLE ONLY issue_emails ALTER COLUMN id SET DEFAULT nextval('issue_emails_id_seq'::regclass);

ALTER TABLE ONLY issue_links ALTER COLUMN id SET DEFAULT nextval('issue_links_id_seq'::regclass);

ALTER TABLE ONLY issue_metrics ALTER COLUMN id SET DEFAULT nextval('issue_metrics_id_seq'::regclass);

ALTER TABLE ONLY issue_tracker_data ALTER COLUMN id SET DEFAULT nextval('issue_tracker_data_id_seq'::regclass);

ALTER TABLE ONLY issue_user_mentions ALTER COLUMN id SET DEFAULT nextval('issue_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY issues ALTER COLUMN id SET DEFAULT nextval('issues_id_seq'::regclass);

ALTER TABLE ONLY iterations_cadences ALTER COLUMN id SET DEFAULT nextval('iterations_cadences_id_seq'::regclass);

ALTER TABLE ONLY jira_connect_installations ALTER COLUMN id SET DEFAULT nextval('jira_connect_installations_id_seq'::regclass);

ALTER TABLE ONLY jira_connect_subscriptions ALTER COLUMN id SET DEFAULT nextval('jira_connect_subscriptions_id_seq'::regclass);

ALTER TABLE ONLY jira_imports ALTER COLUMN id SET DEFAULT nextval('jira_imports_id_seq'::regclass);

ALTER TABLE ONLY jira_tracker_data ALTER COLUMN id SET DEFAULT nextval('jira_tracker_data_id_seq'::regclass);

ALTER TABLE ONLY keys ALTER COLUMN id SET DEFAULT nextval('keys_id_seq'::regclass);

ALTER TABLE ONLY label_links ALTER COLUMN id SET DEFAULT nextval('label_links_id_seq'::regclass);

ALTER TABLE ONLY label_priorities ALTER COLUMN id SET DEFAULT nextval('label_priorities_id_seq'::regclass);

ALTER TABLE ONLY labels ALTER COLUMN id SET DEFAULT nextval('labels_id_seq'::regclass);

ALTER TABLE ONLY ldap_admin_role_links ALTER COLUMN id SET DEFAULT nextval('ldap_admin_role_links_id_seq'::regclass);

ALTER TABLE ONLY ldap_group_links ALTER COLUMN id SET DEFAULT nextval('ldap_group_links_id_seq'::regclass);

ALTER TABLE ONLY lfs_file_locks ALTER COLUMN id SET DEFAULT nextval('lfs_file_locks_id_seq'::regclass);

ALTER TABLE ONLY lfs_object_states ALTER COLUMN lfs_object_id SET DEFAULT nextval('lfs_object_states_lfs_object_id_seq'::regclass);

ALTER TABLE ONLY lfs_objects ALTER COLUMN id SET DEFAULT nextval('lfs_objects_id_seq'::regclass);

ALTER TABLE ONLY lfs_objects_projects ALTER COLUMN id SET DEFAULT nextval('lfs_objects_projects_id_seq'::regclass);

ALTER TABLE ONLY licenses ALTER COLUMN id SET DEFAULT nextval('licenses_id_seq'::regclass);

ALTER TABLE ONLY list_user_preferences ALTER COLUMN id SET DEFAULT nextval('list_user_preferences_id_seq'::regclass);

ALTER TABLE ONLY lists ALTER COLUMN id SET DEFAULT nextval('lists_id_seq'::regclass);

ALTER TABLE ONLY loose_foreign_keys_deleted_records ALTER COLUMN id SET DEFAULT nextval('loose_foreign_keys_deleted_records_id_seq'::regclass);

ALTER TABLE ONLY member_approvals ALTER COLUMN id SET DEFAULT nextval('member_approvals_id_seq'::regclass);

ALTER TABLE ONLY member_roles ALTER COLUMN id SET DEFAULT nextval('member_roles_id_seq'::regclass);

ALTER TABLE ONLY members ALTER COLUMN id SET DEFAULT nextval('members_id_seq'::regclass);

ALTER TABLE ONLY members_deletion_schedules ALTER COLUMN id SET DEFAULT nextval('members_deletion_schedules_id_seq'::regclass);

ALTER TABLE ONLY merge_request_assignees ALTER COLUMN id SET DEFAULT nextval('merge_request_assignees_id_seq'::regclass);

ALTER TABLE ONLY merge_request_assignment_events ALTER COLUMN id SET DEFAULT nextval('merge_request_assignment_events_id_seq'::regclass);

ALTER TABLE ONLY merge_request_blocks ALTER COLUMN id SET DEFAULT nextval('merge_request_blocks_id_seq'::regclass);

ALTER TABLE ONLY merge_request_cleanup_schedules ALTER COLUMN merge_request_id SET DEFAULT nextval('merge_request_cleanup_schedules_merge_request_id_seq'::regclass);

ALTER TABLE ONLY merge_request_commits_metadata ALTER COLUMN id SET DEFAULT nextval('merge_request_commits_metadata_id_seq'::regclass);

ALTER TABLE ONLY merge_request_context_commits ALTER COLUMN id SET DEFAULT nextval('merge_request_context_commits_id_seq'::regclass);

ALTER TABLE ONLY merge_request_diff_commit_users ALTER COLUMN id SET DEFAULT nextval('merge_request_diff_commit_users_id_seq'::regclass);

ALTER TABLE ONLY merge_request_diff_details ALTER COLUMN merge_request_diff_id SET DEFAULT nextval('merge_request_diff_details_merge_request_diff_id_seq'::regclass);

ALTER TABLE ONLY merge_request_diffs ALTER COLUMN id SET DEFAULT nextval('merge_request_diffs_id_seq'::regclass);

ALTER TABLE ONLY merge_request_merge_schedules ALTER COLUMN id SET DEFAULT nextval('merge_request_merge_schedules_id_seq'::regclass);

ALTER TABLE ONLY merge_request_metrics ALTER COLUMN id SET DEFAULT nextval('merge_request_metrics_id_seq'::regclass);

ALTER TABLE ONLY merge_request_predictions ALTER COLUMN merge_request_id SET DEFAULT nextval('merge_request_predictions_merge_request_id_seq'::regclass);

ALTER TABLE ONLY merge_request_requested_changes ALTER COLUMN id SET DEFAULT nextval('merge_request_requested_changes_id_seq'::regclass);

ALTER TABLE ONLY merge_request_reviewers ALTER COLUMN id SET DEFAULT nextval('merge_request_reviewers_id_seq'::regclass);

ALTER TABLE ONLY merge_request_user_mentions ALTER COLUMN id SET DEFAULT nextval('merge_request_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY merge_requests ALTER COLUMN id SET DEFAULT nextval('merge_requests_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_approval_rules ALTER COLUMN id SET DEFAULT nextval('merge_requests_approval_rules_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_approval_rules_approver_groups ALTER COLUMN id SET DEFAULT nextval('merge_requests_approval_rules_approver_groups_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_approval_rules_approver_users ALTER COLUMN id SET DEFAULT nextval('merge_requests_approval_rules_approver_users_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_approval_rules_groups ALTER COLUMN id SET DEFAULT nextval('merge_requests_approval_rules_groups_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_approval_rules_merge_requests ALTER COLUMN id SET DEFAULT nextval('merge_requests_approval_rules_merge_requests_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_approval_rules_projects ALTER COLUMN id SET DEFAULT nextval('merge_requests_approval_rules_projects_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_closing_issues ALTER COLUMN id SET DEFAULT nextval('merge_requests_closing_issues_id_seq'::regclass);

ALTER TABLE ONLY merge_requests_compliance_violations ALTER COLUMN id SET DEFAULT nextval('merge_requests_compliance_violations_id_seq'::regclass);

ALTER TABLE ONLY merge_trains ALTER COLUMN id SET DEFAULT nextval('merge_trains_id_seq'::regclass);

ALTER TABLE ONLY milestones ALTER COLUMN id SET DEFAULT nextval('milestones_id_seq'::regclass);

ALTER TABLE ONLY ml_candidate_metadata ALTER COLUMN id SET DEFAULT nextval('ml_candidate_metadata_id_seq'::regclass);

ALTER TABLE ONLY ml_candidate_metrics ALTER COLUMN id SET DEFAULT nextval('ml_candidate_metrics_id_seq'::regclass);

ALTER TABLE ONLY ml_candidate_params ALTER COLUMN id SET DEFAULT nextval('ml_candidate_params_id_seq'::regclass);

ALTER TABLE ONLY ml_candidates ALTER COLUMN id SET DEFAULT nextval('ml_candidates_id_seq'::regclass);

ALTER TABLE ONLY ml_experiment_metadata ALTER COLUMN id SET DEFAULT nextval('ml_experiment_metadata_id_seq'::regclass);

ALTER TABLE ONLY ml_experiments ALTER COLUMN id SET DEFAULT nextval('ml_experiments_id_seq'::regclass);

ALTER TABLE ONLY ml_model_metadata ALTER COLUMN id SET DEFAULT nextval('ml_model_metadata_id_seq'::regclass);

ALTER TABLE ONLY ml_model_version_metadata ALTER COLUMN id SET DEFAULT nextval('ml_model_version_metadata_id_seq'::regclass);

ALTER TABLE ONLY ml_model_versions ALTER COLUMN id SET DEFAULT nextval('ml_model_versions_id_seq'::regclass);

ALTER TABLE ONLY ml_models ALTER COLUMN id SET DEFAULT nextval('ml_models_id_seq'::regclass);

ALTER TABLE ONLY namespace_admin_notes ALTER COLUMN id SET DEFAULT nextval('namespace_admin_notes_id_seq'::regclass);

ALTER TABLE ONLY namespace_bans ALTER COLUMN id SET DEFAULT nextval('namespace_bans_id_seq'::regclass);

ALTER TABLE ONLY namespace_cluster_agent_mappings ALTER COLUMN id SET DEFAULT nextval('namespace_cluster_agent_mappings_id_seq'::regclass);

ALTER TABLE ONLY namespace_commit_emails ALTER COLUMN id SET DEFAULT nextval('namespace_commit_emails_id_seq'::regclass);

ALTER TABLE ONLY namespace_deletion_schedules ALTER COLUMN namespace_id SET DEFAULT nextval('namespace_deletion_schedules_namespace_id_seq'::regclass);

ALTER TABLE ONLY namespace_import_users ALTER COLUMN id SET DEFAULT nextval('namespace_import_users_id_seq'::regclass);

ALTER TABLE ONLY namespace_statistics ALTER COLUMN id SET DEFAULT nextval('namespace_statistics_id_seq'::regclass);

ALTER TABLE ONLY namespaces ALTER COLUMN id SET DEFAULT nextval('namespaces_id_seq'::regclass);

ALTER TABLE ONLY namespaces_storage_limit_exclusions ALTER COLUMN id SET DEFAULT nextval('namespaces_storage_limit_exclusions_id_seq'::regclass);

ALTER TABLE ONLY namespaces_sync_events ALTER COLUMN id SET DEFAULT nextval('namespaces_sync_events_id_seq'::regclass);

ALTER TABLE ONLY non_sql_service_pings ALTER COLUMN id SET DEFAULT nextval('non_sql_service_pings_id_seq'::regclass);

ALTER TABLE ONLY note_diff_files ALTER COLUMN id SET DEFAULT nextval('note_diff_files_id_seq'::regclass);

ALTER TABLE ONLY note_metadata ALTER COLUMN note_id SET DEFAULT nextval('note_metadata_note_id_seq'::regclass);

ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);

ALTER TABLE ONLY notification_settings ALTER COLUMN id SET DEFAULT nextval('notification_settings_id_seq'::regclass);

ALTER TABLE ONLY oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('oauth_access_grants_id_seq'::regclass);

ALTER TABLE ONLY oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY oauth_applications ALTER COLUMN id SET DEFAULT nextval('oauth_applications_id_seq'::regclass);

ALTER TABLE ONLY oauth_device_grants ALTER COLUMN id SET DEFAULT nextval('oauth_device_grants_id_seq'::regclass);

ALTER TABLE ONLY oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('oauth_openid_requests_id_seq'::regclass);

ALTER TABLE ONLY observability_group_o11y_settings ALTER COLUMN id SET DEFAULT nextval('observability_group_o11y_settings_id_seq'::regclass);

ALTER TABLE ONLY observability_logs_issues_connections ALTER COLUMN id SET DEFAULT nextval('observability_logs_issues_connections_id_seq'::regclass);

ALTER TABLE ONLY observability_metrics_issues_connections ALTER COLUMN id SET DEFAULT nextval('observability_metrics_issues_connections_id_seq'::regclass);

ALTER TABLE ONLY observability_traces_issues_connections ALTER COLUMN id SET DEFAULT nextval('observability_traces_issues_connections_id_seq'::regclass);

ALTER TABLE ONLY onboarding_progresses ALTER COLUMN id SET DEFAULT nextval('onboarding_progresses_id_seq'::regclass);

ALTER TABLE ONLY operations_feature_flags ALTER COLUMN id SET DEFAULT nextval('operations_feature_flags_id_seq'::regclass);

ALTER TABLE ONLY operations_feature_flags_clients ALTER COLUMN id SET DEFAULT nextval('operations_feature_flags_clients_id_seq'::regclass);

ALTER TABLE ONLY operations_feature_flags_issues ALTER COLUMN id SET DEFAULT nextval('operations_feature_flags_issues_id_seq'::regclass);

ALTER TABLE ONLY operations_scopes ALTER COLUMN id SET DEFAULT nextval('operations_scopes_id_seq'::regclass);

ALTER TABLE ONLY operations_strategies ALTER COLUMN id SET DEFAULT nextval('operations_strategies_id_seq'::regclass);

ALTER TABLE ONLY operations_strategies_user_lists ALTER COLUMN id SET DEFAULT nextval('operations_strategies_user_lists_id_seq'::regclass);

ALTER TABLE ONLY operations_user_lists ALTER COLUMN id SET DEFAULT nextval('operations_user_lists_id_seq'::regclass);

ALTER TABLE ONLY organization_cluster_agent_mappings ALTER COLUMN id SET DEFAULT nextval('organization_cluster_agent_mappings_id_seq'::regclass);

ALTER TABLE ONLY organization_push_rules ALTER COLUMN id SET DEFAULT nextval('organization_push_rules_id_seq'::regclass);

ALTER TABLE ONLY organization_user_aliases ALTER COLUMN id SET DEFAULT nextval('organization_user_aliases_id_seq'::regclass);

ALTER TABLE ONLY organization_user_details ALTER COLUMN id SET DEFAULT nextval('organization_user_details_id_seq'::regclass);

ALTER TABLE ONLY organization_users ALTER COLUMN id SET DEFAULT nextval('organization_users_id_seq'::regclass);

ALTER TABLE ONLY organizations ALTER COLUMN id SET DEFAULT nextval('organizations_id_seq'::regclass);

ALTER TABLE ONLY p_ai_active_context_code_enabled_namespaces ALTER COLUMN id SET DEFAULT nextval('p_ai_active_context_code_enabled_namespaces_id_seq'::regclass);

ALTER TABLE ONLY p_ai_active_context_code_repositories ALTER COLUMN id SET DEFAULT nextval('p_ai_active_context_code_repositories_id_seq'::regclass);

ALTER TABLE ONLY p_batched_git_ref_updates_deletions ALTER COLUMN id SET DEFAULT nextval('p_batched_git_ref_updates_deletions_id_seq'::regclass);

ALTER TABLE ONLY p_catalog_resource_sync_events ALTER COLUMN id SET DEFAULT nextval('p_catalog_resource_sync_events_id_seq'::regclass);

ALTER TABLE ONLY p_ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval('ci_builds_metadata_id_seq'::regclass);

ALTER TABLE ONLY p_ci_job_inputs ALTER COLUMN id SET DEFAULT nextval('p_ci_job_inputs_id_seq'::regclass);

ALTER TABLE ONLY p_ci_workloads ALTER COLUMN id SET DEFAULT nextval('p_ci_workloads_id_seq'::regclass);

ALTER TABLE ONLY p_knowledge_graph_enabled_namespaces ALTER COLUMN id SET DEFAULT nextval('p_knowledge_graph_enabled_namespaces_id_seq'::regclass);

ALTER TABLE ONLY p_knowledge_graph_replicas ALTER COLUMN id SET DEFAULT nextval('p_knowledge_graph_replicas_id_seq'::regclass);

ALTER TABLE ONLY packages_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_build_infos_id_seq'::regclass);

ALTER TABLE ONLY packages_conan_file_metadata ALTER COLUMN id SET DEFAULT nextval('packages_conan_file_metadata_id_seq'::regclass);

ALTER TABLE ONLY packages_conan_metadata ALTER COLUMN id SET DEFAULT nextval('packages_conan_metadata_id_seq'::regclass);

ALTER TABLE ONLY packages_conan_package_references ALTER COLUMN id SET DEFAULT nextval('packages_conan_package_references_id_seq'::regclass);

ALTER TABLE ONLY packages_conan_package_revisions ALTER COLUMN id SET DEFAULT nextval('packages_conan_package_revisions_id_seq'::regclass);

ALTER TABLE ONLY packages_conan_recipe_revisions ALTER COLUMN id SET DEFAULT nextval('packages_conan_recipe_revisions_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_group_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_architectures_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_group_component_files ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_component_files_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_group_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_components_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_group_distribution_keys ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distribution_keys_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_group_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distributions_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_project_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_architectures_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_project_component_files ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_component_files_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_project_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_components_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_project_distribution_keys ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distribution_keys_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_project_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distributions_id_seq'::regclass);

ALTER TABLE ONLY packages_debian_publications ALTER COLUMN id SET DEFAULT nextval('packages_debian_publications_id_seq'::regclass);

ALTER TABLE ONLY packages_dependencies ALTER COLUMN id SET DEFAULT nextval('packages_dependencies_id_seq'::regclass);

ALTER TABLE ONLY packages_dependency_links ALTER COLUMN id SET DEFAULT nextval('packages_dependency_links_id_seq'::regclass);

ALTER TABLE ONLY packages_helm_metadata_caches ALTER COLUMN id SET DEFAULT nextval('packages_helm_metadata_caches_id_seq'::regclass);

ALTER TABLE ONLY packages_maven_metadata ALTER COLUMN id SET DEFAULT nextval('packages_maven_metadata_id_seq'::regclass);

ALTER TABLE ONLY packages_npm_metadata_caches ALTER COLUMN id SET DEFAULT nextval('packages_npm_metadata_caches_id_seq'::regclass);

ALTER TABLE ONLY packages_nuget_symbols ALTER COLUMN id SET DEFAULT nextval('packages_nuget_symbols_id_seq'::regclass);

ALTER TABLE ONLY packages_package_file_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_package_file_build_infos_id_seq'::regclass);

ALTER TABLE ONLY packages_package_files ALTER COLUMN id SET DEFAULT nextval('packages_package_files_id_seq'::regclass);

ALTER TABLE ONLY packages_packages ALTER COLUMN id SET DEFAULT nextval('packages_packages_id_seq'::regclass);

ALTER TABLE ONLY packages_protection_rules ALTER COLUMN id SET DEFAULT nextval('packages_protection_rules_id_seq'::regclass);

ALTER TABLE ONLY packages_rpm_repository_files ALTER COLUMN id SET DEFAULT nextval('packages_rpm_repository_files_id_seq'::regclass);

ALTER TABLE ONLY packages_tags ALTER COLUMN id SET DEFAULT nextval('packages_tags_id_seq'::regclass);

ALTER TABLE ONLY pages_deployment_states ALTER COLUMN pages_deployment_id SET DEFAULT nextval('pages_deployment_states_pages_deployment_id_seq'::regclass);

ALTER TABLE ONLY pages_deployments ALTER COLUMN id SET DEFAULT nextval('pages_deployments_id_seq'::regclass);

ALTER TABLE ONLY pages_domain_acme_orders ALTER COLUMN id SET DEFAULT nextval('pages_domain_acme_orders_id_seq'::regclass);

ALTER TABLE ONLY pages_domains ALTER COLUMN id SET DEFAULT nextval('pages_domains_id_seq'::regclass);

ALTER TABLE ONLY path_locks ALTER COLUMN id SET DEFAULT nextval('path_locks_id_seq'::regclass);

ALTER TABLE ONLY personal_access_token_last_used_ips ALTER COLUMN id SET DEFAULT nextval('personal_access_token_last_used_ips_id_seq'::regclass);

ALTER TABLE ONLY personal_access_tokens ALTER COLUMN id SET DEFAULT nextval('personal_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY plan_limits ALTER COLUMN id SET DEFAULT nextval('plan_limits_id_seq'::regclass);

ALTER TABLE ONLY plans ALTER COLUMN id SET DEFAULT nextval('plans_id_seq'::regclass);

ALTER TABLE ONLY pm_advisories ALTER COLUMN id SET DEFAULT nextval('pm_advisories_id_seq'::regclass);

ALTER TABLE ONLY pm_affected_packages ALTER COLUMN id SET DEFAULT nextval('pm_affected_packages_id_seq'::regclass);

ALTER TABLE ONLY pm_checkpoints ALTER COLUMN id SET DEFAULT nextval('pm_checkpoints_id_seq'::regclass);

ALTER TABLE ONLY pm_cve_enrichment ALTER COLUMN id SET DEFAULT nextval('pm_cve_enrichment_id_seq'::regclass);

ALTER TABLE ONLY pm_licenses ALTER COLUMN id SET DEFAULT nextval('pm_licenses_id_seq'::regclass);

ALTER TABLE ONLY pm_package_version_licenses ALTER COLUMN id SET DEFAULT nextval('pm_package_version_licenses_id_seq'::regclass);

ALTER TABLE ONLY pm_package_versions ALTER COLUMN id SET DEFAULT nextval('pm_package_versions_id_seq'::regclass);

ALTER TABLE ONLY pm_packages ALTER COLUMN id SET DEFAULT nextval('pm_packages_id_seq'::regclass);

ALTER TABLE ONLY pool_repositories ALTER COLUMN id SET DEFAULT nextval('pool_repositories_id_seq'::regclass);

ALTER TABLE ONLY postgres_async_foreign_key_validations ALTER COLUMN id SET DEFAULT nextval('postgres_async_foreign_key_validations_id_seq'::regclass);

ALTER TABLE ONLY postgres_async_indexes ALTER COLUMN id SET DEFAULT nextval('postgres_async_indexes_id_seq'::regclass);

ALTER TABLE ONLY postgres_reindex_actions ALTER COLUMN id SET DEFAULT nextval('postgres_reindex_actions_id_seq'::regclass);

ALTER TABLE ONLY postgres_reindex_queued_actions ALTER COLUMN id SET DEFAULT nextval('postgres_reindex_queued_actions_id_seq'::regclass);

ALTER TABLE ONLY programming_languages ALTER COLUMN id SET DEFAULT nextval('programming_languages_id_seq'::regclass);

ALTER TABLE ONLY project_aliases ALTER COLUMN id SET DEFAULT nextval('project_aliases_id_seq'::regclass);

ALTER TABLE ONLY project_auto_devops ALTER COLUMN id SET DEFAULT nextval('project_auto_devops_id_seq'::regclass);

ALTER TABLE ONLY project_build_artifacts_size_refreshes ALTER COLUMN id SET DEFAULT nextval('project_build_artifacts_size_refreshes_id_seq'::regclass);

ALTER TABLE ONLY project_ci_cd_settings ALTER COLUMN id SET DEFAULT nextval('project_ci_cd_settings_id_seq'::regclass);

ALTER TABLE ONLY project_ci_feature_usages ALTER COLUMN id SET DEFAULT nextval('project_ci_feature_usages_id_seq'::regclass);

ALTER TABLE ONLY project_compliance_framework_settings ALTER COLUMN id SET DEFAULT nextval('project_compliance_framework_settings_id_seq'::regclass);

ALTER TABLE ONLY project_compliance_standards_adherence ALTER COLUMN id SET DEFAULT nextval('project_compliance_standards_adherence_id_seq'::regclass);

ALTER TABLE ONLY project_compliance_violations ALTER COLUMN id SET DEFAULT nextval('project_compliance_violations_id_seq'::regclass);

ALTER TABLE ONLY project_compliance_violations_issues ALTER COLUMN id SET DEFAULT nextval('project_compliance_violations_issues_id_seq'::regclass);

ALTER TABLE ONLY project_control_compliance_statuses ALTER COLUMN id SET DEFAULT nextval('project_control_compliance_statuses_id_seq'::regclass);

ALTER TABLE ONLY project_custom_attributes ALTER COLUMN id SET DEFAULT nextval('project_custom_attributes_id_seq'::regclass);

ALTER TABLE ONLY project_daily_statistics ALTER COLUMN id SET DEFAULT nextval('project_daily_statistics_id_seq'::regclass);

ALTER TABLE ONLY project_data_transfers ALTER COLUMN id SET DEFAULT nextval('project_data_transfers_id_seq'::regclass);

ALTER TABLE ONLY project_deploy_tokens ALTER COLUMN id SET DEFAULT nextval('project_deploy_tokens_id_seq'::regclass);

ALTER TABLE ONLY project_export_jobs ALTER COLUMN id SET DEFAULT nextval('project_export_jobs_id_seq'::regclass);

ALTER TABLE ONLY project_features ALTER COLUMN id SET DEFAULT nextval('project_features_id_seq'::regclass);

ALTER TABLE ONLY project_group_links ALTER COLUMN id SET DEFAULT nextval('project_group_links_id_seq'::regclass);

ALTER TABLE ONLY project_import_data ALTER COLUMN id SET DEFAULT nextval('project_import_data_id_seq'::regclass);

ALTER TABLE ONLY project_incident_management_settings ALTER COLUMN project_id SET DEFAULT nextval('project_incident_management_settings_project_id_seq'::regclass);

ALTER TABLE ONLY project_mirror_data ALTER COLUMN id SET DEFAULT nextval('project_mirror_data_id_seq'::regclass);

ALTER TABLE ONLY project_relation_export_uploads ALTER COLUMN id SET DEFAULT nextval('project_relation_export_uploads_id_seq'::regclass);

ALTER TABLE ONLY project_relation_exports ALTER COLUMN id SET DEFAULT nextval('project_relation_exports_id_seq'::regclass);

ALTER TABLE ONLY project_repositories ALTER COLUMN id SET DEFAULT nextval('project_repositories_id_seq'::regclass);

ALTER TABLE ONLY project_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('project_repository_storage_moves_id_seq'::regclass);

ALTER TABLE ONLY project_requirement_compliance_statuses ALTER COLUMN id SET DEFAULT nextval('project_requirement_compliance_statuses_id_seq'::regclass);

ALTER TABLE ONLY project_saved_replies ALTER COLUMN id SET DEFAULT nextval('project_saved_replies_id_seq'::regclass);

ALTER TABLE ONLY project_secrets_managers ALTER COLUMN id SET DEFAULT nextval('project_secrets_managers_id_seq'::regclass);

ALTER TABLE ONLY project_security_exclusions ALTER COLUMN id SET DEFAULT nextval('project_security_exclusions_id_seq'::regclass);

ALTER TABLE ONLY project_security_settings ALTER COLUMN project_id SET DEFAULT nextval('project_security_settings_project_id_seq'::regclass);

ALTER TABLE ONLY project_states ALTER COLUMN id SET DEFAULT nextval('project_states_id_seq'::regclass);

ALTER TABLE ONLY project_statistics ALTER COLUMN id SET DEFAULT nextval('project_statistics_id_seq'::regclass);

ALTER TABLE ONLY project_topics ALTER COLUMN id SET DEFAULT nextval('project_topics_id_seq'::regclass);

ALTER TABLE ONLY project_wiki_repositories ALTER COLUMN id SET DEFAULT nextval('project_wiki_repositories_id_seq'::regclass);

ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);

ALTER TABLE ONLY projects_branch_rules_merge_request_approval_settings ALTER COLUMN id SET DEFAULT nextval('projects_branch_rules_merge_request_approval_settings_id_seq'::regclass);

ALTER TABLE ONLY projects_branch_rules_squash_options ALTER COLUMN id SET DEFAULT nextval('projects_branch_rules_squash_options_id_seq'::regclass);

ALTER TABLE ONLY projects_sync_events ALTER COLUMN id SET DEFAULT nextval('projects_sync_events_id_seq'::regclass);

ALTER TABLE ONLY projects_visits ALTER COLUMN id SET DEFAULT nextval('projects_visits_id_seq'::regclass);

ALTER TABLE ONLY protected_branch_merge_access_levels ALTER COLUMN id SET DEFAULT nextval('protected_branch_merge_access_levels_id_seq'::regclass);

ALTER TABLE ONLY protected_branch_push_access_levels ALTER COLUMN id SET DEFAULT nextval('protected_branch_push_access_levels_id_seq'::regclass);

ALTER TABLE ONLY protected_branch_unprotect_access_levels ALTER COLUMN id SET DEFAULT nextval('protected_branch_unprotect_access_levels_id_seq'::regclass);

ALTER TABLE ONLY protected_branches ALTER COLUMN id SET DEFAULT nextval('protected_branches_id_seq'::regclass);

ALTER TABLE ONLY protected_environment_approval_rules ALTER COLUMN id SET DEFAULT nextval('protected_environment_approval_rules_id_seq'::regclass);

ALTER TABLE ONLY protected_environment_deploy_access_levels ALTER COLUMN id SET DEFAULT nextval('protected_environment_deploy_access_levels_id_seq'::regclass);

ALTER TABLE ONLY protected_environments ALTER COLUMN id SET DEFAULT nextval('protected_environments_id_seq'::regclass);

ALTER TABLE ONLY protected_tag_create_access_levels ALTER COLUMN id SET DEFAULT nextval('protected_tag_create_access_levels_id_seq'::regclass);

ALTER TABLE ONLY protected_tags ALTER COLUMN id SET DEFAULT nextval('protected_tags_id_seq'::regclass);

ALTER TABLE ONLY push_rules ALTER COLUMN id SET DEFAULT nextval('push_rules_id_seq'::regclass);

ALTER TABLE ONLY queries_service_pings ALTER COLUMN id SET DEFAULT nextval('queries_service_pings_id_seq'::regclass);

ALTER TABLE ONLY raw_usage_data ALTER COLUMN id SET DEFAULT nextval('raw_usage_data_id_seq'::regclass);

ALTER TABLE ONLY redirect_routes ALTER COLUMN id SET DEFAULT nextval('redirect_routes_id_seq'::regclass);

ALTER TABLE ONLY related_epic_links ALTER COLUMN id SET DEFAULT nextval('related_epic_links_id_seq'::regclass);

ALTER TABLE ONLY relation_import_trackers ALTER COLUMN id SET DEFAULT nextval('relation_import_trackers_id_seq'::regclass);

ALTER TABLE ONLY release_links ALTER COLUMN id SET DEFAULT nextval('release_links_id_seq'::regclass);

ALTER TABLE ONLY releases ALTER COLUMN id SET DEFAULT nextval('releases_id_seq'::regclass);

ALTER TABLE ONLY remote_mirrors ALTER COLUMN id SET DEFAULT nextval('remote_mirrors_id_seq'::regclass);

ALTER TABLE ONLY required_code_owners_sections ALTER COLUMN id SET DEFAULT nextval('required_code_owners_sections_id_seq'::regclass);

ALTER TABLE ONLY requirements ALTER COLUMN id SET DEFAULT nextval('requirements_id_seq'::regclass);

ALTER TABLE ONLY requirements_management_test_reports ALTER COLUMN id SET DEFAULT nextval('requirements_management_test_reports_id_seq'::regclass);

ALTER TABLE ONLY resource_iteration_events ALTER COLUMN id SET DEFAULT nextval('resource_iteration_events_id_seq'::regclass);

ALTER TABLE ONLY resource_label_events ALTER COLUMN id SET DEFAULT nextval('resource_label_events_id_seq'::regclass);

ALTER TABLE ONLY resource_link_events ALTER COLUMN id SET DEFAULT nextval('resource_link_events_id_seq'::regclass);

ALTER TABLE ONLY resource_milestone_events ALTER COLUMN id SET DEFAULT nextval('resource_milestone_events_id_seq'::regclass);

ALTER TABLE ONLY resource_state_events ALTER COLUMN id SET DEFAULT nextval('resource_state_events_id_seq'::regclass);

ALTER TABLE ONLY resource_weight_events ALTER COLUMN id SET DEFAULT nextval('resource_weight_events_id_seq'::regclass);

ALTER TABLE ONLY reviews ALTER COLUMN id SET DEFAULT nextval('reviews_id_seq'::regclass);

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 saved_replies ALTER COLUMN id SET DEFAULT nextval('saved_replies_id_seq'::regclass);

ALTER TABLE ONLY sbom_component_versions ALTER COLUMN id SET DEFAULT nextval('sbom_component_versions_id_seq'::regclass);

ALTER TABLE ONLY sbom_components ALTER COLUMN id SET DEFAULT nextval('sbom_components_id_seq'::regclass);

ALTER TABLE ONLY sbom_graph_paths ALTER COLUMN id SET DEFAULT nextval('sbom_graph_paths_id_seq'::regclass);

ALTER TABLE ONLY sbom_occurrences ALTER COLUMN id SET DEFAULT nextval('sbom_occurrences_id_seq'::regclass);

ALTER TABLE ONLY sbom_occurrences_vulnerabilities ALTER COLUMN id SET DEFAULT nextval('sbom_occurrences_vulnerabilities_id_seq'::regclass);

ALTER TABLE ONLY sbom_source_packages ALTER COLUMN id SET DEFAULT nextval('sbom_source_packages_id_seq'::regclass);

ALTER TABLE ONLY sbom_sources ALTER COLUMN id SET DEFAULT nextval('sbom_sources_id_seq'::regclass);

ALTER TABLE ONLY scan_execution_policy_rules ALTER COLUMN id SET DEFAULT nextval('scan_execution_policy_rules_id_seq'::regclass);

ALTER TABLE ONLY scan_result_policies ALTER COLUMN id SET DEFAULT nextval('scan_result_policies_id_seq'::regclass);

ALTER TABLE ONLY scan_result_policy_violations ALTER COLUMN id SET DEFAULT nextval('scan_result_policy_violations_id_seq'::regclass);

ALTER TABLE ONLY scim_group_memberships ALTER COLUMN id SET DEFAULT nextval('scim_group_memberships_id_seq'::regclass);

ALTER TABLE ONLY scim_identities ALTER COLUMN id SET DEFAULT nextval('scim_identities_id_seq'::regclass);

ALTER TABLE ONLY scim_oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('scim_oauth_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY security_categories ALTER COLUMN id SET DEFAULT nextval('security_categories_id_seq'::regclass);

ALTER TABLE ONLY security_findings ALTER COLUMN id SET DEFAULT nextval('security_findings_id_seq'::regclass);

ALTER TABLE ONLY security_orchestration_policy_configurations ALTER COLUMN id SET DEFAULT nextval('security_orchestration_policy_configurations_id_seq'::regclass);

ALTER TABLE ONLY security_orchestration_policy_rule_schedules ALTER COLUMN id SET DEFAULT nextval('security_orchestration_policy_rule_schedules_id_seq'::regclass);

ALTER TABLE ONLY security_pipeline_execution_policy_config_links ALTER COLUMN id SET DEFAULT nextval('security_pipeline_execution_policy_config_links_id_seq'::regclass);

ALTER TABLE ONLY security_pipeline_execution_project_schedules ALTER COLUMN id SET DEFAULT nextval('security_pipeline_execution_project_schedules_id_seq'::regclass);

ALTER TABLE ONLY security_policies ALTER COLUMN id SET DEFAULT nextval('security_policies_id_seq'::regclass);

ALTER TABLE ONLY security_policy_project_links ALTER COLUMN id SET DEFAULT nextval('security_policy_project_links_id_seq'::regclass);

ALTER TABLE ONLY security_policy_requirements ALTER COLUMN id SET DEFAULT nextval('security_policy_requirements_id_seq'::regclass);

ALTER TABLE ONLY security_policy_settings ALTER COLUMN id SET DEFAULT nextval('security_policy_settings_id_seq'::regclass);

ALTER TABLE ONLY security_scans ALTER COLUMN id SET DEFAULT nextval('security_scans_id_seq'::regclass);

ALTER TABLE ONLY security_training_providers ALTER COLUMN id SET DEFAULT nextval('security_training_providers_id_seq'::regclass);

ALTER TABLE ONLY security_trainings ALTER COLUMN id SET DEFAULT nextval('security_trainings_id_seq'::regclass);

ALTER TABLE ONLY sent_notifications ALTER COLUMN id SET DEFAULT nextval('sent_notifications_id_seq'::regclass);

ALTER TABLE ONLY sentry_issues ALTER COLUMN id SET DEFAULT nextval('sentry_issues_id_seq'::regclass);

ALTER TABLE ONLY service_access_tokens ALTER COLUMN id SET DEFAULT nextval('service_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY shards ALTER COLUMN id SET DEFAULT nextval('shards_id_seq'::regclass);

ALTER TABLE ONLY slack_api_scopes ALTER COLUMN id SET DEFAULT nextval('slack_api_scopes_id_seq'::regclass);

ALTER TABLE ONLY slack_integrations ALTER COLUMN id SET DEFAULT nextval('slack_integrations_id_seq'::regclass);

ALTER TABLE ONLY slack_integrations_scopes ALTER COLUMN id SET DEFAULT nextval('slack_integrations_scopes_id_seq'::regclass);

ALTER TABLE ONLY smartcard_identities ALTER COLUMN id SET DEFAULT nextval('smartcard_identities_id_seq'::regclass);

ALTER TABLE ONLY snippet_repository_states ALTER COLUMN id SET DEFAULT nextval('snippet_repository_states_id_seq'::regclass);

ALTER TABLE ONLY snippet_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('snippet_repository_storage_moves_id_seq'::regclass);

ALTER TABLE ONLY snippet_user_mentions ALTER COLUMN id SET DEFAULT nextval('snippet_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY snippets ALTER COLUMN id SET DEFAULT nextval('snippets_id_seq'::regclass);

ALTER TABLE ONLY software_license_policies ALTER COLUMN id SET DEFAULT nextval('software_license_policies_id_seq'::regclass);

ALTER TABLE ONLY software_licenses ALTER COLUMN id SET DEFAULT nextval('software_licenses_id_seq'::regclass);

ALTER TABLE ONLY spam_logs ALTER COLUMN id SET DEFAULT nextval('spam_logs_id_seq'::regclass);

ALTER TABLE ONLY sprints ALTER COLUMN id SET DEFAULT nextval('sprints_id_seq'::regclass);

ALTER TABLE ONLY ssh_signatures ALTER COLUMN id SET DEFAULT nextval('ssh_signatures_id_seq'::regclass);

ALTER TABLE ONLY status_check_responses ALTER COLUMN id SET DEFAULT nextval('status_check_responses_id_seq'::regclass);

ALTER TABLE ONLY status_page_published_incidents ALTER COLUMN id SET DEFAULT nextval('status_page_published_incidents_id_seq'::regclass);

ALTER TABLE ONLY status_page_settings ALTER COLUMN project_id SET DEFAULT nextval('status_page_settings_project_id_seq'::regclass);

ALTER TABLE ONLY subscription_add_on_purchases ALTER COLUMN id SET DEFAULT nextval('subscription_add_on_purchases_id_seq'::regclass);

ALTER TABLE ONLY subscription_add_ons ALTER COLUMN id SET DEFAULT nextval('subscription_add_ons_id_seq'::regclass);

ALTER TABLE ONLY subscription_seat_assignments ALTER COLUMN id SET DEFAULT nextval('subscription_seat_assignments_id_seq'::regclass);

ALTER TABLE ONLY subscription_user_add_on_assignment_versions ALTER COLUMN id SET DEFAULT nextval('subscription_user_add_on_assignment_versions_id_seq'::regclass);

ALTER TABLE ONLY subscription_user_add_on_assignments ALTER COLUMN id SET DEFAULT nextval('subscription_user_add_on_assignments_id_seq'::regclass);

ALTER TABLE ONLY subscriptions ALTER COLUMN id SET DEFAULT nextval('subscriptions_id_seq'::regclass);

ALTER TABLE ONLY suggestions ALTER COLUMN id SET DEFAULT nextval('suggestions_id_seq'::regclass);

ALTER TABLE ONLY system_access_group_microsoft_applications ALTER COLUMN id SET DEFAULT nextval('system_access_group_microsoft_applications_id_seq'::regclass);

ALTER TABLE ONLY system_access_group_microsoft_graph_access_tokens ALTER COLUMN id SET DEFAULT nextval('system_access_group_microsoft_graph_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY system_access_instance_microsoft_applications ALTER COLUMN id SET DEFAULT nextval('system_access_instance_microsoft_applications_id_seq'::regclass);

ALTER TABLE ONLY system_access_instance_microsoft_graph_access_tokens ALTER COLUMN id SET DEFAULT nextval('system_access_instance_microsoft_graph_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY system_access_microsoft_applications ALTER COLUMN id SET DEFAULT nextval('system_access_microsoft_applications_id_seq'::regclass);

ALTER TABLE ONLY system_access_microsoft_graph_access_tokens ALTER COLUMN id SET DEFAULT nextval('system_access_microsoft_graph_access_tokens_id_seq'::regclass);

ALTER TABLE ONLY system_note_metadata ALTER COLUMN id SET DEFAULT nextval('system_note_metadata_id_seq'::regclass);

ALTER TABLE ONLY tags ALTER COLUMN id SET DEFAULT nextval('tags_id_seq'::regclass);

ALTER TABLE ONLY target_branch_rules ALTER COLUMN id SET DEFAULT nextval('target_branch_rules_id_seq'::regclass);

ALTER TABLE ONLY targeted_message_dismissals ALTER COLUMN id SET DEFAULT nextval('targeted_message_dismissals_id_seq'::regclass);

ALTER TABLE ONLY targeted_message_namespaces ALTER COLUMN id SET DEFAULT nextval('targeted_message_namespaces_id_seq'::regclass);

ALTER TABLE ONLY targeted_messages ALTER COLUMN id SET DEFAULT nextval('targeted_messages_id_seq'::regclass);

ALTER TABLE ONLY term_agreements ALTER COLUMN id SET DEFAULT nextval('term_agreements_id_seq'::regclass);

ALTER TABLE ONLY terraform_state_version_states ALTER COLUMN id SET DEFAULT nextval('terraform_state_version_states_id_seq'::regclass);

ALTER TABLE ONLY terraform_state_versions ALTER COLUMN id SET DEFAULT nextval('terraform_state_versions_id_seq'::regclass);

ALTER TABLE ONLY terraform_states ALTER COLUMN id SET DEFAULT nextval('terraform_states_id_seq'::regclass);

ALTER TABLE ONLY timelog_categories ALTER COLUMN id SET DEFAULT nextval('timelog_categories_id_seq'::regclass);

ALTER TABLE ONLY timelogs ALTER COLUMN id SET DEFAULT nextval('timelogs_id_seq'::regclass);

ALTER TABLE ONLY todos ALTER COLUMN id SET DEFAULT nextval('todos_id_seq'::regclass);

ALTER TABLE ONLY topics ALTER COLUMN id SET DEFAULT nextval('topics_id_seq'::regclass);

ALTER TABLE ONLY trending_projects ALTER COLUMN id SET DEFAULT nextval('trending_projects_id_seq'::regclass);

ALTER TABLE ONLY upcoming_reconciliations ALTER COLUMN id SET DEFAULT nextval('upcoming_reconciliations_id_seq'::regclass);

ALTER TABLE ONLY upload_states ALTER COLUMN upload_id SET DEFAULT nextval('upload_states_upload_id_seq'::regclass);

ALTER TABLE ONLY uploads ALTER COLUMN id SET DEFAULT nextval('uploads_id_seq'::regclass);

ALTER TABLE ONLY user_achievements ALTER COLUMN id SET DEFAULT nextval('user_achievements_id_seq'::regclass);

ALTER TABLE ONLY user_agent_details ALTER COLUMN id SET DEFAULT nextval('user_agent_details_id_seq'::regclass);

ALTER TABLE ONLY user_broadcast_message_dismissals ALTER COLUMN id SET DEFAULT nextval('user_broadcast_message_dismissals_id_seq'::regclass);

ALTER TABLE ONLY user_callouts ALTER COLUMN id SET DEFAULT nextval('user_callouts_id_seq'::regclass);

ALTER TABLE ONLY user_custom_attributes ALTER COLUMN id SET DEFAULT nextval('user_custom_attributes_id_seq'::regclass);

ALTER TABLE ONLY user_details ALTER COLUMN user_id SET DEFAULT nextval('user_details_user_id_seq'::regclass);

ALTER TABLE ONLY user_group_callouts ALTER COLUMN id SET DEFAULT nextval('user_group_callouts_id_seq'::regclass);

ALTER TABLE ONLY user_group_member_roles ALTER COLUMN id SET DEFAULT nextval('user_group_member_roles_id_seq'::regclass);

ALTER TABLE ONLY user_member_roles ALTER COLUMN id SET DEFAULT nextval('user_member_roles_id_seq'::regclass);

ALTER TABLE ONLY user_namespace_callouts ALTER COLUMN id SET DEFAULT nextval('user_namespace_callouts_id_seq'::regclass);

ALTER TABLE ONLY user_permission_export_uploads ALTER COLUMN id SET DEFAULT nextval('user_permission_export_uploads_id_seq'::regclass);

ALTER TABLE ONLY user_preferences ALTER COLUMN id SET DEFAULT nextval('user_preferences_id_seq'::regclass);

ALTER TABLE ONLY user_project_callouts ALTER COLUMN id SET DEFAULT nextval('user_project_callouts_id_seq'::regclass);

ALTER TABLE ONLY user_statuses ALTER COLUMN user_id SET DEFAULT nextval('user_statuses_user_id_seq'::regclass);

ALTER TABLE ONLY user_synced_attributes_metadata ALTER COLUMN id SET DEFAULT nextval('user_synced_attributes_metadata_id_seq'::regclass);

ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);

ALTER TABLE ONLY users_ops_dashboard_projects ALTER COLUMN id SET DEFAULT nextval('users_ops_dashboard_projects_id_seq'::regclass);

ALTER TABLE ONLY users_star_projects ALTER COLUMN id SET DEFAULT nextval('users_star_projects_id_seq'::regclass);

ALTER TABLE ONLY users_statistics ALTER COLUMN id SET DEFAULT nextval('users_statistics_id_seq'::regclass);

ALTER TABLE ONLY value_stream_dashboard_counts ALTER COLUMN id SET DEFAULT nextval('value_stream_dashboard_counts_id_seq'::regclass);

ALTER TABLE ONLY virtual_registries_packages_maven_registries ALTER COLUMN id SET DEFAULT nextval('virtual_registries_packages_maven_registries_id_seq'::regclass);

ALTER TABLE ONLY virtual_registries_packages_maven_registry_upstreams ALTER COLUMN id SET DEFAULT nextval('virtual_registries_packages_maven_registry_upstreams_id_seq'::regclass);

ALTER TABLE ONLY virtual_registries_packages_maven_upstreams ALTER COLUMN id SET DEFAULT nextval('virtual_registries_packages_maven_upstreams_id_seq'::regclass);

ALTER TABLE ONLY vs_code_settings ALTER COLUMN id SET DEFAULT nextval('vs_code_settings_id_seq'::regclass);

ALTER TABLE ONLY vulnerabilities ALTER COLUMN id SET DEFAULT nextval('vulnerabilities_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_archive_exports ALTER COLUMN id SET DEFAULT nextval('vulnerability_archive_exports_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_archived_records ALTER COLUMN id SET DEFAULT nextval('vulnerability_archived_records_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_archives ALTER COLUMN id SET DEFAULT nextval('vulnerability_archives_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_export_parts ALTER COLUMN id SET DEFAULT nextval('vulnerability_export_parts_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_exports ALTER COLUMN id SET DEFAULT nextval('vulnerability_exports_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_external_issue_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_external_issue_links_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_finding_evidences ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidences_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_finding_signatures ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_signatures_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_findings_remediations ALTER COLUMN id SET DEFAULT nextval('vulnerability_findings_remediations_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_flags ALTER COLUMN id SET DEFAULT nextval('vulnerability_flags_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_historical_statistics_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_identifiers ALTER COLUMN id SET DEFAULT nextval('vulnerability_identifiers_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_issue_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_issue_links_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_management_policy_rules ALTER COLUMN id SET DEFAULT nextval('vulnerability_management_policy_rules_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_merge_request_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_merge_request_links_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_namespace_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_namespace_historical_statistics_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_namespace_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_namespace_statistics_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_occurrence_identifiers ALTER COLUMN id SET DEFAULT nextval('vulnerability_occurrence_identifiers_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_occurrences ALTER COLUMN id SET DEFAULT nextval('vulnerability_occurrences_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_reads ALTER COLUMN id SET DEFAULT nextval('vulnerability_reads_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_remediations ALTER COLUMN id SET DEFAULT nextval('vulnerability_remediations_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_scanners ALTER COLUMN id SET DEFAULT nextval('vulnerability_scanners_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_severity_overrides ALTER COLUMN id SET DEFAULT nextval('vulnerability_severity_overrides_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_state_transitions ALTER COLUMN id SET DEFAULT nextval('vulnerability_state_transitions_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_statistics_id_seq'::regclass);

ALTER TABLE ONLY vulnerability_user_mentions ALTER COLUMN id SET DEFAULT nextval('vulnerability_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY web_hook_logs_daily ALTER COLUMN id SET DEFAULT nextval('web_hook_logs_daily_id_seq'::regclass);

ALTER TABLE ONLY web_hooks ALTER COLUMN id SET DEFAULT nextval('web_hooks_id_seq'::regclass);

ALTER TABLE ONLY webauthn_registrations ALTER COLUMN id SET DEFAULT nextval('webauthn_registrations_id_seq'::regclass);

ALTER TABLE ONLY wiki_page_meta ALTER COLUMN id SET DEFAULT nextval('wiki_page_meta_id_seq'::regclass);

ALTER TABLE ONLY wiki_page_meta_user_mentions ALTER COLUMN id SET DEFAULT nextval('wiki_page_meta_user_mentions_id_seq'::regclass);

ALTER TABLE ONLY wiki_page_slugs ALTER COLUMN id SET DEFAULT nextval('wiki_page_slugs_id_seq'::regclass);

ALTER TABLE ONLY wiki_repository_states ALTER COLUMN id SET DEFAULT nextval('wiki_repository_states_id_seq'::regclass);

ALTER TABLE ONLY work_item_current_statuses ALTER COLUMN id SET DEFAULT nextval('work_item_current_statuses_id_seq'::regclass);

ALTER TABLE ONLY work_item_custom_lifecycle_statuses ALTER COLUMN id SET DEFAULT nextval('work_item_custom_lifecycle_statuses_id_seq'::regclass);

ALTER TABLE ONLY work_item_custom_lifecycles ALTER COLUMN id SET DEFAULT nextval('work_item_custom_lifecycles_id_seq'::regclass);

ALTER TABLE ONLY work_item_custom_statuses ALTER COLUMN id SET DEFAULT nextval('work_item_custom_statuses_id_seq'::regclass);

ALTER TABLE ONLY work_item_hierarchy_restrictions ALTER COLUMN id SET DEFAULT nextval('work_item_hierarchy_restrictions_id_seq'::regclass);

ALTER TABLE ONLY work_item_number_field_values ALTER COLUMN id SET DEFAULT nextval('work_item_number_field_values_id_seq'::regclass);

ALTER TABLE ONLY work_item_parent_links ALTER COLUMN id SET DEFAULT nextval('work_item_parent_links_id_seq'::regclass);

ALTER TABLE ONLY work_item_related_link_restrictions ALTER COLUMN id SET DEFAULT nextval('work_item_related_link_restrictions_id_seq'::regclass);

ALTER TABLE ONLY work_item_select_field_values ALTER COLUMN id SET DEFAULT nextval('work_item_select_field_values_id_seq'::regclass);

ALTER TABLE ONLY work_item_text_field_values ALTER COLUMN id SET DEFAULT nextval('work_item_text_field_values_id_seq'::regclass);

ALTER TABLE ONLY work_item_type_custom_fields ALTER COLUMN id SET DEFAULT nextval('work_item_type_custom_fields_id_seq'::regclass);

ALTER TABLE ONLY work_item_type_custom_lifecycles ALTER COLUMN id SET DEFAULT nextval('work_item_type_custom_lifecycles_id_seq'::regclass);

ALTER TABLE ONLY work_item_type_user_preferences ALTER COLUMN id SET DEFAULT nextval('work_item_type_user_preferences_id_seq'::regclass);

ALTER TABLE ONLY work_item_widget_definitions ALTER COLUMN id SET DEFAULT nextval('work_item_widget_definitions_id_seq'::regclass);

ALTER TABLE ONLY workspace_agentk_states ALTER COLUMN id SET DEFAULT nextval('workspace_agentk_states_id_seq'::regclass);

ALTER TABLE ONLY workspace_tokens ALTER COLUMN id SET DEFAULT nextval('workspace_tokens_id_seq'::regclass);

ALTER TABLE ONLY workspace_variables ALTER COLUMN id SET DEFAULT nextval('workspace_variables_id_seq'::regclass);

ALTER TABLE ONLY workspaces ALTER COLUMN id SET DEFAULT nextval('workspaces_id_seq'::regclass);

ALTER TABLE ONLY workspaces_agent_config_versions ALTER COLUMN id SET DEFAULT nextval('workspaces_agent_config_versions_id_seq'::regclass);

ALTER TABLE ONLY workspaces_agent_configs ALTER COLUMN id SET DEFAULT nextval('workspaces_agent_configs_id_seq'::regclass);

ALTER TABLE ONLY x509_certificates ALTER COLUMN id SET DEFAULT nextval('x509_certificates_id_seq'::regclass);

ALTER TABLE ONLY x509_commit_signatures ALTER COLUMN id SET DEFAULT nextval('x509_commit_signatures_id_seq'::regclass);

ALTER TABLE ONLY x509_issuers ALTER COLUMN id SET DEFAULT nextval('x509_issuers_id_seq'::regclass);

ALTER TABLE ONLY xray_reports ALTER COLUMN id SET DEFAULT nextval('xray_reports_id_seq'::regclass);

ALTER TABLE ONLY zentao_tracker_data ALTER COLUMN id SET DEFAULT nextval('zentao_tracker_data_id_seq'::regclass);

ALTER TABLE ONLY zoekt_enabled_namespaces ALTER COLUMN id SET DEFAULT nextval('zoekt_enabled_namespaces_id_seq'::regclass);

ALTER TABLE ONLY zoekt_indices ALTER COLUMN id SET DEFAULT nextval('zoekt_indices_id_seq'::regclass);

ALTER TABLE ONLY zoekt_nodes ALTER COLUMN id SET DEFAULT nextval('zoekt_nodes_id_seq'::regclass);

ALTER TABLE ONLY zoekt_replicas ALTER COLUMN id SET DEFAULT nextval('zoekt_replicas_id_seq'::regclass);

ALTER TABLE ONLY zoekt_repositories ALTER COLUMN id SET DEFAULT nextval('zoekt_repositories_id_seq'::regclass);

ALTER TABLE ONLY zoom_meetings ALTER COLUMN id SET DEFAULT nextval('zoom_meetings_id_seq'::regclass);

ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_00_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_01_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_02_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_03_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_04_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_05_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_06_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_07_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_08_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_09_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_10_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_11_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_12_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_13_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_14_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_15_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_16_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_17_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_18_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_19_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_20_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_21_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_22_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_23_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_24_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_25_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_26_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_27_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_28_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_29_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_30_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31
    ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_31_pkey PRIMARY KEY (stage_event_hash_id, issue_id);

ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_00_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_01_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_02_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_03_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_04_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_05_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_06_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_07_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_08_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_09_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_10_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_11_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_12_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_13_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_14_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_15_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_16_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_17_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_18_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_19_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_20_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_21_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_22_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_23_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_24_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_25_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_26_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_27_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_28_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_29_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_30_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31
    ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_31_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);

ALTER TABLE ONLY issue_search_data
    ADD CONSTRAINT issue_search_data_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_00
    ADD CONSTRAINT issue_search_data_00_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_01
    ADD CONSTRAINT issue_search_data_01_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_02
    ADD CONSTRAINT issue_search_data_02_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_03
    ADD CONSTRAINT issue_search_data_03_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_04
    ADD CONSTRAINT issue_search_data_04_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_05
    ADD CONSTRAINT issue_search_data_05_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_06
    ADD CONSTRAINT issue_search_data_06_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_07
    ADD CONSTRAINT issue_search_data_07_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_08
    ADD CONSTRAINT issue_search_data_08_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_09
    ADD CONSTRAINT issue_search_data_09_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_10
    ADD CONSTRAINT issue_search_data_10_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_11
    ADD CONSTRAINT issue_search_data_11_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_12
    ADD CONSTRAINT issue_search_data_12_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_13
    ADD CONSTRAINT issue_search_data_13_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_14
    ADD CONSTRAINT issue_search_data_14_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_15
    ADD CONSTRAINT issue_search_data_15_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_16
    ADD CONSTRAINT issue_search_data_16_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_17
    ADD CONSTRAINT issue_search_data_17_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_18
    ADD CONSTRAINT issue_search_data_18_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_19
    ADD CONSTRAINT issue_search_data_19_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_20
    ADD CONSTRAINT issue_search_data_20_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_21
    ADD CONSTRAINT issue_search_data_21_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_22
    ADD CONSTRAINT issue_search_data_22_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_23
    ADD CONSTRAINT issue_search_data_23_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_24
    ADD CONSTRAINT issue_search_data_24_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_25
    ADD CONSTRAINT issue_search_data_25_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_26
    ADD CONSTRAINT issue_search_data_26_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_27
    ADD CONSTRAINT issue_search_data_27_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_28
    ADD CONSTRAINT issue_search_data_28_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_29
    ADD CONSTRAINT issue_search_data_29_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_30
    ADD CONSTRAINT issue_search_data_30_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_31
    ADD CONSTRAINT issue_search_data_31_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_32
    ADD CONSTRAINT issue_search_data_32_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_33
    ADD CONSTRAINT issue_search_data_33_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_34
    ADD CONSTRAINT issue_search_data_34_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_35
    ADD CONSTRAINT issue_search_data_35_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_36
    ADD CONSTRAINT issue_search_data_36_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_37
    ADD CONSTRAINT issue_search_data_37_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_38
    ADD CONSTRAINT issue_search_data_38_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_39
    ADD CONSTRAINT issue_search_data_39_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_40
    ADD CONSTRAINT issue_search_data_40_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_41
    ADD CONSTRAINT issue_search_data_41_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_42
    ADD CONSTRAINT issue_search_data_42_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_43
    ADD CONSTRAINT issue_search_data_43_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_44
    ADD CONSTRAINT issue_search_data_44_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_45
    ADD CONSTRAINT issue_search_data_45_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_46
    ADD CONSTRAINT issue_search_data_46_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_47
    ADD CONSTRAINT issue_search_data_47_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_48
    ADD CONSTRAINT issue_search_data_48_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_49
    ADD CONSTRAINT issue_search_data_49_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_50
    ADD CONSTRAINT issue_search_data_50_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_51
    ADD CONSTRAINT issue_search_data_51_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_52
    ADD CONSTRAINT issue_search_data_52_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_53
    ADD CONSTRAINT issue_search_data_53_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_54
    ADD CONSTRAINT issue_search_data_54_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_55
    ADD CONSTRAINT issue_search_data_55_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_56
    ADD CONSTRAINT issue_search_data_56_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_57
    ADD CONSTRAINT issue_search_data_57_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_58
    ADD CONSTRAINT issue_search_data_58_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_59
    ADD CONSTRAINT issue_search_data_59_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_60
    ADD CONSTRAINT issue_search_data_60_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_61
    ADD CONSTRAINT issue_search_data_61_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_62
    ADD CONSTRAINT issue_search_data_62_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_63
    ADD CONSTRAINT issue_search_data_63_pkey PRIMARY KEY (project_id, issue_id);

ALTER TABLE ONLY namespace_descendants
    ADD CONSTRAINT namespace_descendants_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_00
    ADD CONSTRAINT namespace_descendants_00_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_01
    ADD CONSTRAINT namespace_descendants_01_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_02
    ADD CONSTRAINT namespace_descendants_02_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_03
    ADD CONSTRAINT namespace_descendants_03_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_04
    ADD CONSTRAINT namespace_descendants_04_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_05
    ADD CONSTRAINT namespace_descendants_05_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_06
    ADD CONSTRAINT namespace_descendants_06_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_07
    ADD CONSTRAINT namespace_descendants_07_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_08
    ADD CONSTRAINT namespace_descendants_08_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_09
    ADD CONSTRAINT namespace_descendants_09_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_10
    ADD CONSTRAINT namespace_descendants_10_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_11
    ADD CONSTRAINT namespace_descendants_11_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_12
    ADD CONSTRAINT namespace_descendants_12_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_13
    ADD CONSTRAINT namespace_descendants_13_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_14
    ADD CONSTRAINT namespace_descendants_14_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_15
    ADD CONSTRAINT namespace_descendants_15_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_16
    ADD CONSTRAINT namespace_descendants_16_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_17
    ADD CONSTRAINT namespace_descendants_17_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_18
    ADD CONSTRAINT namespace_descendants_18_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_19
    ADD CONSTRAINT namespace_descendants_19_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_20
    ADD CONSTRAINT namespace_descendants_20_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_21
    ADD CONSTRAINT namespace_descendants_21_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_22
    ADD CONSTRAINT namespace_descendants_22_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_23
    ADD CONSTRAINT namespace_descendants_23_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_24
    ADD CONSTRAINT namespace_descendants_24_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_25
    ADD CONSTRAINT namespace_descendants_25_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_26
    ADD CONSTRAINT namespace_descendants_26_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_27
    ADD CONSTRAINT namespace_descendants_27_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_28
    ADD CONSTRAINT namespace_descendants_28_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_29
    ADD CONSTRAINT namespace_descendants_29_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_30
    ADD CONSTRAINT namespace_descendants_30_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_31
    ADD CONSTRAINT namespace_descendants_31_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY virtual_registries_packages_maven_cache_entries
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_00_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_01_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_02_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_03_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_04_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_05_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_06_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_07_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_08_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_09_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_10_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_11_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_12_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_13_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_14_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15
    ADD CONSTRAINT virtual_registries_packages_maven_cache_entries_15_pkey PRIMARY KEY (upstream_id, relative_path, status);

ALTER TABLE ONLY abuse_events
    ADD CONSTRAINT abuse_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_report_assignees
    ADD CONSTRAINT abuse_report_assignees_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_report_events
    ADD CONSTRAINT abuse_report_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_report_label_links
    ADD CONSTRAINT abuse_report_label_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_report_labels
    ADD CONSTRAINT abuse_report_labels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_report_notes
    ADD CONSTRAINT abuse_report_notes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY uploads_9ba88c4165
    ADD CONSTRAINT uploads_9ba88c4165_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY abuse_report_uploads
    ADD CONSTRAINT abuse_report_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY abuse_report_user_mentions
    ADD CONSTRAINT abuse_report_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_reports
    ADD CONSTRAINT abuse_reports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY abuse_trust_scores
    ADD CONSTRAINT abuse_trust_scores_pkey PRIMARY KEY (id);

ALTER TABLE ONLY achievement_uploads
    ADD CONSTRAINT achievement_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY achievements
    ADD CONSTRAINT achievements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY activity_pub_releases_subscriptions
    ADD CONSTRAINT activity_pub_releases_subscriptions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY admin_roles
    ADD CONSTRAINT admin_roles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT agent_activity_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY agent_group_authorizations
    ADD CONSTRAINT agent_group_authorizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY agent_organization_authorizations
    ADD CONSTRAINT agent_organization_authorizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY agent_project_authorizations
    ADD CONSTRAINT agent_project_authorizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY agent_user_access_group_authorizations
    ADD CONSTRAINT agent_user_access_group_authorizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY agent_user_access_project_authorizations
    ADD CONSTRAINT agent_user_access_project_authorizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_active_context_collections
    ADD CONSTRAINT ai_active_context_collections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_active_context_connections
    ADD CONSTRAINT ai_active_context_connections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_active_context_migrations
    ADD CONSTRAINT ai_active_context_migrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_agent_version_attachments
    ADD CONSTRAINT ai_agent_version_attachments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_agent_versions
    ADD CONSTRAINT ai_agent_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_agents
    ADD CONSTRAINT ai_agents_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_catalog_item_consumers
    ADD CONSTRAINT ai_catalog_item_consumers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_catalog_item_versions
    ADD CONSTRAINT ai_catalog_item_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_catalog_items
    ADD CONSTRAINT ai_catalog_items_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_code_suggestion_events
    ADD CONSTRAINT ai_code_suggestion_events_pkey PRIMARY KEY (id, "timestamp");

ALTER TABLE ONLY ai_conversation_messages
    ADD CONSTRAINT ai_conversation_messages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_conversation_threads
    ADD CONSTRAINT ai_conversation_threads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_duo_chat_events
    ADD CONSTRAINT ai_duo_chat_events_pkey PRIMARY KEY (id, "timestamp");

ALTER TABLE ONLY ai_feature_settings
    ADD CONSTRAINT ai_feature_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_namespace_feature_settings
    ADD CONSTRAINT ai_namespace_feature_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_self_hosted_models
    ADD CONSTRAINT ai_self_hosted_models_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_settings
    ADD CONSTRAINT ai_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ai_testing_terms_acceptances
    ADD CONSTRAINT ai_testing_terms_acceptances_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY ai_troubleshoot_job_events
    ADD CONSTRAINT ai_troubleshoot_job_events_pkey PRIMARY KEY (id, "timestamp");

ALTER TABLE ONLY ai_usage_events
    ADD CONSTRAINT ai_usage_events_pkey PRIMARY KEY (id, "timestamp");

ALTER TABLE ONLY ai_user_metrics
    ADD CONSTRAINT ai_user_metrics_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY ai_vectorizable_file_uploads
    ADD CONSTRAINT ai_vectorizable_file_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY ai_vectorizable_files
    ADD CONSTRAINT ai_vectorizable_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY alert_management_alert_assignees
    ADD CONSTRAINT alert_management_alert_assignees_pkey PRIMARY KEY (id);

ALTER TABLE ONLY alert_management_alert_metric_image_uploads
    ADD CONSTRAINT alert_management_alert_metric_image_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY alert_management_alert_metric_images
    ADD CONSTRAINT alert_management_alert_metric_images_pkey PRIMARY KEY (id);

ALTER TABLE ONLY alert_management_alert_user_mentions
    ADD CONSTRAINT alert_management_alert_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY alert_management_alerts
    ADD CONSTRAINT alert_management_alerts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY alert_management_http_integrations
    ADD CONSTRAINT alert_management_http_integrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY allowed_email_domains
    ADD CONSTRAINT allowed_email_domains_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_cycle_analytics_aggregations
    ADD CONSTRAINT analytics_cycle_analytics_aggregations_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY analytics_cycle_analytics_group_stages
    ADD CONSTRAINT analytics_cycle_analytics_group_stages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams
    ADD CONSTRAINT analytics_cycle_analytics_group_value_streams_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_cycle_analytics_stage_aggregations
    ADD CONSTRAINT analytics_cycle_analytics_stage_aggregations_pkey PRIMARY KEY (stage_id);

ALTER TABLE ONLY analytics_cycle_analytics_stage_event_hashes
    ADD CONSTRAINT analytics_cycle_analytics_stage_event_hashes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_cycle_analytics_value_stream_settings
    ADD CONSTRAINT analytics_cycle_analytics_value_stream_settings_pkey PRIMARY KEY (value_stream_id);

ALTER TABLE ONLY analytics_dashboards_pointers
    ADD CONSTRAINT analytics_dashboards_pointers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_devops_adoption_segments
    ADD CONSTRAINT analytics_devops_adoption_segments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_devops_adoption_snapshots
    ADD CONSTRAINT analytics_devops_adoption_snapshots_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analytics_language_trend_repository_languages
    ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date);

ALTER TABLE ONLY analytics_usage_trends_measurements
    ADD CONSTRAINT analytics_usage_trends_measurements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analyzer_namespace_statuses
    ADD CONSTRAINT analyzer_namespace_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY analyzer_project_statuses
    ADD CONSTRAINT analyzer_project_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY appearance_uploads
    ADD CONSTRAINT appearance_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY appearances
    ADD CONSTRAINT appearances_pkey PRIMARY KEY (id);

ALTER TABLE ONLY application_setting_terms
    ADD CONSTRAINT application_setting_terms_pkey PRIMARY KEY (id);

ALTER TABLE ONLY application_settings
    ADD CONSTRAINT application_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_group_rules_groups
    ADD CONSTRAINT approval_group_rules_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_group_rules
    ADD CONSTRAINT approval_group_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_group_rules_protected_branches
    ADD CONSTRAINT approval_group_rules_protected_branches_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_group_rules_users
    ADD CONSTRAINT approval_group_rules_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_merge_request_rule_sources
    ADD CONSTRAINT approval_merge_request_rule_sources_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_merge_request_rules_approved_approvers
    ADD CONSTRAINT approval_merge_request_rules_approved_approvers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_merge_request_rules_groups
    ADD CONSTRAINT approval_merge_request_rules_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_merge_request_rules
    ADD CONSTRAINT approval_merge_request_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_merge_request_rules_users
    ADD CONSTRAINT approval_merge_request_rules_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_policy_rule_project_links
    ADD CONSTRAINT approval_policy_rule_project_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_policy_rules
    ADD CONSTRAINT approval_policy_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_project_rules_groups
    ADD CONSTRAINT approval_project_rules_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_project_rules
    ADD CONSTRAINT approval_project_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approval_project_rules_protected_branches
    ADD CONSTRAINT approval_project_rules_protected_branches_pkey PRIMARY KEY (approval_project_rule_id, protected_branch_id);

ALTER TABLE ONLY approval_project_rules_users
    ADD CONSTRAINT approval_project_rules_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approvals
    ADD CONSTRAINT approvals_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approver_groups
    ADD CONSTRAINT approver_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY approvers
    ADD CONSTRAINT approvers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ar_internal_metadata
    ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);

ALTER TABLE ONLY arkose_sessions
    ADD CONSTRAINT arkose_sessions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY atlassian_identities
    ADD CONSTRAINT atlassian_identities_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY audit_events_amazon_s3_configurations
    ADD CONSTRAINT audit_events_amazon_s3_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_external_audit_event_destinations
    ADD CONSTRAINT audit_events_external_audit_event_destinations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_google_cloud_logging_configurations
    ADD CONSTRAINT audit_events_google_cloud_logging_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_group_external_streaming_destinations
    ADD CONSTRAINT audit_events_group_external_streaming_destinations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_group_streaming_event_type_filters
    ADD CONSTRAINT audit_events_group_streaming_event_type_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_instance_amazon_s3_configurations
    ADD CONSTRAINT audit_events_instance_amazon_s3_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_instance_external_audit_event_destinations
    ADD CONSTRAINT audit_events_instance_external_audit_event_destinations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_instance_external_streaming_destinations
    ADD CONSTRAINT audit_events_instance_external_streaming_destinations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_instance_google_cloud_logging_configurations
    ADD CONSTRAINT audit_events_instance_google_cloud_logging_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_instance_streaming_event_type_filters
    ADD CONSTRAINT audit_events_instance_streaming_event_type_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events
    ADD CONSTRAINT audit_events_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY audit_events_streaming_event_type_filters
    ADD CONSTRAINT audit_events_streaming_event_type_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_streaming_group_namespace_filters
    ADD CONSTRAINT audit_events_streaming_group_namespace_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_streaming_headers
    ADD CONSTRAINT audit_events_streaming_headers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters
    ADD CONSTRAINT audit_events_streaming_http_group_namespace_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters
    ADD CONSTRAINT audit_events_streaming_http_instance_namespace_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters
    ADD CONSTRAINT audit_events_streaming_instance_event_type_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY audit_events_streaming_instance_namespace_filters
    ADD CONSTRAINT audit_events_streaming_instance_namespace_filters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY authentication_events
    ADD CONSTRAINT authentication_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY automation_rules
    ADD CONSTRAINT automation_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY award_emoji
    ADD CONSTRAINT award_emoji_pkey PRIMARY KEY (id);

ALTER TABLE ONLY aws_roles
    ADD CONSTRAINT aws_roles_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY background_migration_jobs
    ADD CONSTRAINT background_migration_jobs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY badges
    ADD CONSTRAINT badges_pkey PRIMARY KEY (id);

ALTER TABLE ONLY banned_users
    ADD CONSTRAINT banned_users_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY batched_background_migration_job_transition_logs
    ADD CONSTRAINT batched_background_migration_job_transition_logs_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY batched_background_migration_jobs
    ADD CONSTRAINT batched_background_migration_jobs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY batched_background_migrations
    ADD CONSTRAINT batched_background_migrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY board_assignees
    ADD CONSTRAINT board_assignees_pkey PRIMARY KEY (id);

ALTER TABLE ONLY board_group_recent_visits
    ADD CONSTRAINT board_group_recent_visits_pkey PRIMARY KEY (id);

ALTER TABLE ONLY board_labels
    ADD CONSTRAINT board_labels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY board_project_recent_visits
    ADD CONSTRAINT board_project_recent_visits_pkey PRIMARY KEY (id);

ALTER TABLE ONLY board_user_preferences
    ADD CONSTRAINT board_user_preferences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_board_labels
    ADD CONSTRAINT boards_epic_board_labels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_board_positions
    ADD CONSTRAINT boards_epic_board_positions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_board_recent_visits
    ADD CONSTRAINT boards_epic_board_recent_visits_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_boards
    ADD CONSTRAINT boards_epic_boards_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_list_user_preferences
    ADD CONSTRAINT boards_epic_list_user_preferences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_lists
    ADD CONSTRAINT boards_epic_lists_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards_epic_user_preferences
    ADD CONSTRAINT boards_epic_user_preferences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY boards
    ADD CONSTRAINT boards_pkey PRIMARY KEY (id);

ALTER TABLE ONLY broadcast_messages
    ADD CONSTRAINT broadcast_messages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_batch_trackers
    ADD CONSTRAINT bulk_import_batch_trackers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_configurations
    ADD CONSTRAINT bulk_import_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_entities
    ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_export_batches
    ADD CONSTRAINT bulk_import_export_batches_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_export_upload_uploads
    ADD CONSTRAINT bulk_import_export_upload_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY bulk_import_export_uploads
    ADD CONSTRAINT bulk_import_export_uploads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_exports
    ADD CONSTRAINT bulk_import_exports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_failures
    ADD CONSTRAINT bulk_import_failures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_import_trackers
    ADD CONSTRAINT bulk_import_trackers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY bulk_imports
    ADD CONSTRAINT bulk_imports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY catalog_resource_component_last_usages
    ADD CONSTRAINT catalog_resource_component_last_usages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY catalog_resource_components
    ADD CONSTRAINT catalog_resource_components_pkey PRIMARY KEY (id);

ALTER TABLE ONLY catalog_resource_versions
    ADD CONSTRAINT catalog_resource_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY catalog_resources
    ADD CONSTRAINT catalog_resources_pkey PRIMARY KEY (id);

ALTER TABLE ONLY catalog_verified_namespaces
    ADD CONSTRAINT catalog_verified_namespaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY chat_names
    ADD CONSTRAINT chat_names_pkey PRIMARY KEY (id);

ALTER TABLE ONLY chat_teams
    ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);

ALTER TABLE workspaces
    ADD CONSTRAINT check_2a89035b04 CHECK ((personal_access_token_id IS NOT NULL)) NOT VALID;

ALTER TABLE security_scans
    ADD CONSTRAINT check_2d56d882f6 CHECK ((project_id IS NOT NULL)) NOT VALID;

ALTER TABLE vulnerability_scanners
    ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;

ALTER TABLE ONLY instance_type_ci_runners
    ADD CONSTRAINT check_5c34a3c1db UNIQUE (id);

ALTER TABLE resource_label_events
    ADD CONSTRAINT check_614704e750 CHECK ((num_nonnulls(epic_id, issue_id, merge_request_id) = 1)) NOT VALID;

ALTER TABLE ONLY project_type_ci_runners
    ADD CONSTRAINT check_619c71f3a2 UNIQUE (id);

ALTER TABLE oauth_applications
    ADD CONSTRAINT check_75750847b8 CHECK ((char_length(scopes) <= 2048)) NOT VALID;

ALTER TABLE ONLY group_type_ci_runners
    ADD CONSTRAINT check_81b90172a6 UNIQUE (id);

ALTER TABLE p_ci_job_artifacts
    ADD CONSTRAINT check_b8fac815e7 CHECK ((char_length(exposed_as) <= 100)) NOT VALID;

ALTER TABLE sprints
    ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID;

ALTER TABLE group_import_states
    ADD CONSTRAINT check_cda75c7c3f CHECK ((user_id IS NOT NULL)) NOT VALID;

ALTER TABLE packages_packages
    ADD CONSTRAINT check_d6301aedeb CHECK ((char_length(status_message) <= 255)) NOT VALID;

ALTER TABLE sprints
    ADD CONSTRAINT check_df3816aed7 CHECK ((due_date IS NOT NULL)) NOT VALID;

ALTER TABLE ONLY ci_build_needs
    ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_build_pending_states
    ADD CONSTRAINT ci_build_pending_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_build_report_results
    ADD CONSTRAINT ci_build_report_results_pkey PRIMARY KEY (build_id, partition_id);

ALTER TABLE ONLY ci_build_trace_chunks
    ADD CONSTRAINT ci_build_trace_chunks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_builds_runner_session
    ADD CONSTRAINT ci_builds_runner_session_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_cost_settings
    ADD CONSTRAINT ci_cost_settings_pkey PRIMARY KEY (runner_id);

ALTER TABLE ONLY ci_daily_build_group_report_results
    ADD CONSTRAINT ci_daily_build_group_report_results_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_deleted_objects
    ADD CONSTRAINT ci_deleted_objects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_freeze_periods
    ADD CONSTRAINT ci_freeze_periods_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_gitlab_hosted_runner_monthly_usages
    ADD CONSTRAINT ci_gitlab_hosted_runner_monthly_usages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_group_variables
    ADD CONSTRAINT ci_group_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_hosted_runners
    ADD CONSTRAINT ci_hosted_runners_pkey PRIMARY KEY (runner_id);

ALTER TABLE ONLY ci_instance_runner_monthly_usages
    ADD CONSTRAINT ci_instance_runner_monthly_usages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_instance_variables
    ADD CONSTRAINT ci_instance_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_job_artifact_states
    ADD CONSTRAINT ci_job_artifact_states_pkey PRIMARY KEY (job_artifact_id, partition_id);

ALTER TABLE ONLY ci_job_token_authorizations
    ADD CONSTRAINT ci_job_token_authorizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_job_token_group_scope_links
    ADD CONSTRAINT ci_job_token_group_scope_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_job_token_project_scope_links
    ADD CONSTRAINT ci_job_token_project_scope_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_job_variables
    ADD CONSTRAINT ci_job_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_minutes_additional_packs
    ADD CONSTRAINT ci_minutes_additional_packs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_namespace_mirrors
    ADD CONSTRAINT ci_namespace_mirrors_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_namespace_monthly_usages
    ADD CONSTRAINT ci_namespace_monthly_usages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_partitions
    ADD CONSTRAINT ci_partitions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pending_builds
    ADD CONSTRAINT ci_pending_builds_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pipeline_artifacts
    ADD CONSTRAINT ci_pipeline_artifacts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pipeline_chat_data
    ADD CONSTRAINT ci_pipeline_chat_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pipeline_messages
    ADD CONSTRAINT ci_pipeline_messages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pipeline_metadata
    ADD CONSTRAINT ci_pipeline_metadata_pkey PRIMARY KEY (pipeline_id);

ALTER TABLE ONLY ci_pipeline_schedule_inputs
    ADD CONSTRAINT ci_pipeline_schedule_inputs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pipeline_schedule_variables
    ADD CONSTRAINT ci_pipeline_schedule_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_pipeline_schedules
    ADD CONSTRAINT ci_pipeline_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_project_mirrors
    ADD CONSTRAINT ci_project_mirrors_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_project_monthly_usages
    ADD CONSTRAINT ci_project_monthly_usages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_refs
    ADD CONSTRAINT ci_refs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_resource_groups
    ADD CONSTRAINT ci_resource_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_resources
    ADD CONSTRAINT ci_resources_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_runner_machines
    ADD CONSTRAINT ci_runner_machines_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY ci_runner_namespaces
    ADD CONSTRAINT ci_runner_namespaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_runner_projects
    ADD CONSTRAINT ci_runner_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_runner_taggings
    ADD CONSTRAINT ci_runner_taggings_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY ci_runner_taggings_group_type
    ADD CONSTRAINT ci_runner_taggings_group_type_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY ci_runner_taggings_instance_type
    ADD CONSTRAINT ci_runner_taggings_instance_type_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY ci_runner_taggings_project_type
    ADD CONSTRAINT ci_runner_taggings_project_type_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY ci_runner_versions
    ADD CONSTRAINT ci_runner_versions_pkey PRIMARY KEY (version);

ALTER TABLE ONLY ci_runners
    ADD CONSTRAINT ci_runners_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY ci_running_builds
    ADD CONSTRAINT ci_running_builds_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_secure_file_states
    ADD CONSTRAINT ci_secure_file_states_pkey PRIMARY KEY (ci_secure_file_id);

ALTER TABLE ONLY ci_secure_files
    ADD CONSTRAINT ci_secure_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_sources_pipelines
    ADD CONSTRAINT ci_sources_pipelines_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_sources_projects
    ADD CONSTRAINT ci_sources_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_subscriptions_projects
    ADD CONSTRAINT ci_subscriptions_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_triggers
    ADD CONSTRAINT ci_triggers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_unit_test_failures
    ADD CONSTRAINT ci_unit_test_failures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_unit_tests
    ADD CONSTRAINT ci_unit_tests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ci_variables
    ADD CONSTRAINT ci_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cloud_connector_access
    ADD CONSTRAINT cloud_connector_access_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cloud_connector_keys
    ADD CONSTRAINT cloud_connector_keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_agent_migrations
    ADD CONSTRAINT cluster_agent_migrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_agent_tokens
    ADD CONSTRAINT cluster_agent_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_agent_url_configurations
    ADD CONSTRAINT cluster_agent_url_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_agents
    ADD CONSTRAINT cluster_agents_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_enabled_grants
    ADD CONSTRAINT cluster_enabled_grants_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_groups
    ADD CONSTRAINT cluster_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_platforms_kubernetes
    ADD CONSTRAINT cluster_platforms_kubernetes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_projects
    ADD CONSTRAINT cluster_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_providers_aws
    ADD CONSTRAINT cluster_providers_aws_pkey PRIMARY KEY (id);

ALTER TABLE ONLY cluster_providers_gcp
    ADD CONSTRAINT cluster_providers_gcp_pkey PRIMARY KEY (id);

ALTER TABLE ONLY clusters_integration_prometheus
    ADD CONSTRAINT clusters_integration_prometheus_pkey PRIMARY KEY (cluster_id);

ALTER TABLE ONLY clusters_kubernetes_namespaces
    ADD CONSTRAINT clusters_kubernetes_namespaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY clusters_managed_resources
    ADD CONSTRAINT clusters_managed_resources_pkey PRIMARY KEY (id);

ALTER TABLE ONLY clusters
    ADD CONSTRAINT clusters_pkey PRIMARY KEY (id);

ALTER TABLE ONLY commit_user_mentions
    ADD CONSTRAINT commit_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY compliance_framework_security_policies
    ADD CONSTRAINT compliance_framework_security_policies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY compliance_management_frameworks
    ADD CONSTRAINT compliance_management_frameworks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY compliance_requirements_controls
    ADD CONSTRAINT compliance_requirements_controls_pkey PRIMARY KEY (id);

ALTER TABLE ONLY compliance_requirements
    ADD CONSTRAINT compliance_requirements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY compromised_password_detections
    ADD CONSTRAINT compromised_password_detections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY virtual_registries_packages_maven_registry_upstreams
    ADD CONSTRAINT constraint_vreg_pkgs_mvn_reg_upst_on_unique_regid_pos UNIQUE (registry_id, "position") DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE ONLY container_expiration_policies
    ADD CONSTRAINT container_expiration_policies_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY container_registry_data_repair_details
    ADD CONSTRAINT container_registry_data_repair_details_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY container_registry_protection_rules
    ADD CONSTRAINT container_registry_protection_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY container_registry_protection_tag_rules
    ADD CONSTRAINT container_registry_protection_tag_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY container_repositories
    ADD CONSTRAINT container_repositories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY container_repository_states
    ADD CONSTRAINT container_repository_states_pkey PRIMARY KEY (container_repository_id);

ALTER TABLE ONLY content_blocked_states
    ADD CONSTRAINT content_blocked_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY conversational_development_index_metrics
    ADD CONSTRAINT conversational_development_index_metrics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY country_access_logs
    ADD CONSTRAINT country_access_logs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY coverage_fuzzing_corpuses
    ADD CONSTRAINT coverage_fuzzing_corpuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY csv_issue_imports
    ADD CONSTRAINT csv_issue_imports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY custom_emoji
    ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id);

ALTER TABLE ONLY custom_field_select_options
    ADD CONSTRAINT custom_field_select_options_pkey PRIMARY KEY (id);

ALTER TABLE ONLY custom_fields
    ADD CONSTRAINT custom_fields_pkey PRIMARY KEY (id);

ALTER TABLE ONLY custom_software_licenses
    ADD CONSTRAINT custom_software_licenses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY customer_relations_contacts
    ADD CONSTRAINT customer_relations_contacts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY customer_relations_organizations
    ADD CONSTRAINT customer_relations_organizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_pre_scan_verification_steps
    ADD CONSTRAINT dast_pre_scan_verification_steps_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_pre_scan_verifications
    ADD CONSTRAINT dast_pre_scan_verifications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_profile_schedules
    ADD CONSTRAINT dast_profile_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_profiles_pipelines
    ADD CONSTRAINT dast_profiles_pipelines_pkey PRIMARY KEY (dast_profile_id, ci_pipeline_id);

ALTER TABLE ONLY dast_profiles
    ADD CONSTRAINT dast_profiles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_profiles_tags
    ADD CONSTRAINT dast_profiles_tags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_scanner_profiles_builds
    ADD CONSTRAINT dast_scanner_profiles_builds_pkey PRIMARY KEY (dast_scanner_profile_id, ci_build_id);

ALTER TABLE ONLY dast_scanner_profiles
    ADD CONSTRAINT dast_scanner_profiles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_site_profile_secret_variables
    ADD CONSTRAINT dast_site_profile_secret_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_site_profiles_builds
    ADD CONSTRAINT dast_site_profiles_builds_pkey PRIMARY KEY (dast_site_profile_id, ci_build_id);

ALTER TABLE ONLY dast_site_profiles
    ADD CONSTRAINT dast_site_profiles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_site_tokens
    ADD CONSTRAINT dast_site_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_site_validations
    ADD CONSTRAINT dast_site_validations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dast_sites
    ADD CONSTRAINT dast_sites_pkey PRIMARY KEY (id);

ALTER TABLE namespace_settings
    ADD CONSTRAINT default_branch_protection_defaults_size_constraint CHECK ((octet_length((default_branch_protection_defaults)::text) <= 1024)) NOT VALID;

ALTER TABLE application_settings
    ADD CONSTRAINT default_branch_protection_defaults_size_constraint CHECK ((octet_length((default_branch_protection_defaults)::text) <= 1024)) NOT VALID;

ALTER TABLE ONLY dependency_list_export_part_uploads
    ADD CONSTRAINT dependency_list_export_part_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY dependency_list_export_parts
    ADD CONSTRAINT dependency_list_export_parts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dependency_list_export_uploads
    ADD CONSTRAINT dependency_list_export_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY dependency_list_exports
    ADD CONSTRAINT dependency_list_exports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dependency_proxy_blob_states
    ADD CONSTRAINT dependency_proxy_blob_states_pkey PRIMARY KEY (dependency_proxy_blob_id);

ALTER TABLE ONLY dependency_proxy_blobs
    ADD CONSTRAINT dependency_proxy_blobs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dependency_proxy_group_settings
    ADD CONSTRAINT dependency_proxy_group_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dependency_proxy_image_ttl_group_policies
    ADD CONSTRAINT dependency_proxy_image_ttl_group_policies_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY dependency_proxy_manifest_states
    ADD CONSTRAINT dependency_proxy_manifest_states_pkey PRIMARY KEY (dependency_proxy_manifest_id);

ALTER TABLE ONLY dependency_proxy_manifests
    ADD CONSTRAINT dependency_proxy_manifests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dependency_proxy_packages_settings
    ADD CONSTRAINT dependency_proxy_packages_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY deploy_keys_projects
    ADD CONSTRAINT deploy_keys_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY deploy_tokens
    ADD CONSTRAINT deploy_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY deployment_approvals
    ADD CONSTRAINT deployment_approvals_pkey PRIMARY KEY (id);

ALTER TABLE ONLY deployment_clusters
    ADD CONSTRAINT deployment_clusters_pkey PRIMARY KEY (deployment_id);

ALTER TABLE ONLY deployment_merge_requests
    ADD CONSTRAINT deployment_merge_requests_pkey PRIMARY KEY (deployment_id, merge_request_id);

ALTER TABLE ONLY deployments
    ADD CONSTRAINT deployments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY description_versions
    ADD CONSTRAINT description_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY design_management_action_uploads
    ADD CONSTRAINT design_management_action_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY design_management_designs
    ADD CONSTRAINT design_management_designs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY design_management_designs_versions
    ADD CONSTRAINT design_management_designs_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY design_management_repositories
    ADD CONSTRAINT design_management_repositories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY design_management_repository_states
    ADD CONSTRAINT design_management_repository_states_pkey PRIMARY KEY (design_management_repository_id);

ALTER TABLE ONLY design_management_versions
    ADD CONSTRAINT design_management_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY design_user_mentions
    ADD CONSTRAINT design_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY detached_partitions
    ADD CONSTRAINT detached_partitions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY diff_note_positions
    ADD CONSTRAINT diff_note_positions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dingtalk_tracker_data
    ADD CONSTRAINT dingtalk_tracker_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dora_configurations
    ADD CONSTRAINT dora_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dora_daily_metrics
    ADD CONSTRAINT dora_daily_metrics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY dora_performance_scores
    ADD CONSTRAINT dora_performance_scores_pkey PRIMARY KEY (id);

ALTER TABLE ONLY draft_notes
    ADD CONSTRAINT draft_notes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY duo_workflows_checkpoint_writes
    ADD CONSTRAINT duo_workflows_checkpoint_writes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY duo_workflows_checkpoints
    ADD CONSTRAINT duo_workflows_checkpoints_pkey PRIMARY KEY (id);

ALTER TABLE ONLY duo_workflows_events
    ADD CONSTRAINT duo_workflows_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY duo_workflows_workflows
    ADD CONSTRAINT duo_workflows_workflows_pkey PRIMARY KEY (id);

ALTER TABLE ONLY duo_workflows_workloads
    ADD CONSTRAINT duo_workflows_workloads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY early_access_program_tracking_events
    ADD CONSTRAINT early_access_program_tracking_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY elastic_group_index_statuses
    ADD CONSTRAINT elastic_group_index_statuses_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY elastic_index_settings
    ADD CONSTRAINT elastic_index_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY elastic_reindexing_slices
    ADD CONSTRAINT elastic_reindexing_slices_pkey PRIMARY KEY (id);

ALTER TABLE ONLY elastic_reindexing_subtasks
    ADD CONSTRAINT elastic_reindexing_subtasks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY elastic_reindexing_tasks
    ADD CONSTRAINT elastic_reindexing_tasks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY elasticsearch_indexed_namespaces
    ADD CONSTRAINT elasticsearch_indexed_namespaces_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY elasticsearch_indexed_projects
    ADD CONSTRAINT elasticsearch_indexed_projects_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY emails
    ADD CONSTRAINT emails_pkey PRIMARY KEY (id);

ALTER TABLE ONLY environments
    ADD CONSTRAINT environments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY epic_issues
    ADD CONSTRAINT epic_issues_pkey PRIMARY KEY (id);

ALTER TABLE ONLY epic_user_mentions
    ADD CONSTRAINT epic_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY epics
    ADD CONSTRAINT epics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY error_tracking_client_keys
    ADD CONSTRAINT error_tracking_client_keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY error_tracking_error_events
    ADD CONSTRAINT error_tracking_error_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY error_tracking_errors
    ADD CONSTRAINT error_tracking_errors_pkey PRIMARY KEY (id);

ALTER TABLE ONLY events
    ADD CONSTRAINT events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY evidences
    ADD CONSTRAINT evidences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY excluded_merge_requests
    ADD CONSTRAINT excluded_merge_requests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY external_approval_rules
    ADD CONSTRAINT external_approval_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY external_pull_requests
    ADD CONSTRAINT external_pull_requests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY external_status_checks
    ADD CONSTRAINT external_status_checks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY external_status_checks_protected_branches
    ADD CONSTRAINT external_status_checks_protected_branches_pkey PRIMARY KEY (id);

ALTER TABLE ONLY feature_gates
    ADD CONSTRAINT feature_gates_pkey PRIMARY KEY (id);

ALTER TABLE ONLY features
    ADD CONSTRAINT features_pkey PRIMARY KEY (id);

ALTER TABLE ONLY fork_network_members
    ADD CONSTRAINT fork_network_members_pkey PRIMARY KEY (id);

ALTER TABLE ONLY fork_networks
    ADD CONSTRAINT fork_networks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY geo_cache_invalidation_events
    ADD CONSTRAINT geo_cache_invalidation_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY geo_event_log
    ADD CONSTRAINT geo_event_log_pkey PRIMARY KEY (id);

ALTER TABLE ONLY geo_events
    ADD CONSTRAINT geo_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY geo_node_namespace_links
    ADD CONSTRAINT geo_node_namespace_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY geo_node_statuses
    ADD CONSTRAINT geo_node_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY geo_nodes
    ADD CONSTRAINT geo_nodes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ghost_user_migrations
    ADD CONSTRAINT ghost_user_migrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY gitlab_subscription_histories
    ADD CONSTRAINT gitlab_subscription_histories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY gitlab_subscriptions
    ADD CONSTRAINT gitlab_subscriptions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY gpg_key_subkeys
    ADD CONSTRAINT gpg_key_subkeys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY gpg_keys
    ADD CONSTRAINT gpg_keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY gpg_signatures
    ADD CONSTRAINT gpg_signatures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY grafana_integrations
    ADD CONSTRAINT grafana_integrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_audit_events
    ADD CONSTRAINT group_audit_events_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY group_crm_settings
    ADD CONSTRAINT group_crm_settings_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY group_custom_attributes
    ADD CONSTRAINT group_custom_attributes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_deletion_schedules
    ADD CONSTRAINT group_deletion_schedules_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY group_deploy_keys_groups
    ADD CONSTRAINT group_deploy_keys_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_deploy_keys
    ADD CONSTRAINT group_deploy_keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_deploy_tokens
    ADD CONSTRAINT group_deploy_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_features
    ADD CONSTRAINT group_features_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY group_group_links
    ADD CONSTRAINT group_group_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_import_states
    ADD CONSTRAINT group_import_states_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY group_merge_request_approval_settings
    ADD CONSTRAINT group_merge_request_approval_settings_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY group_push_rules
    ADD CONSTRAINT group_push_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_repository_storage_moves
    ADD CONSTRAINT group_repository_storage_moves_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_saved_replies
    ADD CONSTRAINT group_saved_replies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_scim_auth_access_tokens
    ADD CONSTRAINT group_scim_auth_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_scim_identities
    ADD CONSTRAINT group_scim_identities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_security_exclusions
    ADD CONSTRAINT group_security_exclusions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_ssh_certificates
    ADD CONSTRAINT group_ssh_certificates_pkey PRIMARY KEY (id);

ALTER TABLE ONLY group_type_ci_runner_machines
    ADD CONSTRAINT group_type_ci_runner_machines_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY group_type_ci_runners
    ADD CONSTRAINT group_type_ci_runners_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY group_wiki_repositories
    ADD CONSTRAINT group_wiki_repositories_pkey PRIMARY KEY (group_id);

ALTER TABLE ONLY group_wiki_repository_states
    ADD CONSTRAINT group_wiki_repository_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY groups_visits
    ADD CONSTRAINT groups_visits_pkey PRIMARY KEY (id, visited_at);

ALTER TABLE ONLY historical_data
    ADD CONSTRAINT historical_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY identities
    ADD CONSTRAINT identities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY import_export_upload_uploads
    ADD CONSTRAINT import_export_upload_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY import_export_uploads
    ADD CONSTRAINT import_export_uploads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY import_failures
    ADD CONSTRAINT import_failures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY import_placeholder_memberships
    ADD CONSTRAINT import_placeholder_memberships_pkey PRIMARY KEY (id);

ALTER TABLE ONLY import_placeholder_user_details
    ADD CONSTRAINT import_placeholder_user_details_pkey PRIMARY KEY (id);

ALTER TABLE ONLY import_source_user_placeholder_references
    ADD CONSTRAINT import_source_user_placeholder_references_pkey PRIMARY KEY (id);

ALTER TABLE ONLY import_source_users
    ADD CONSTRAINT import_source_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_oncall_shifts
    ADD CONSTRAINT inc_mgmnt_no_overlapping_oncall_shifts EXCLUDE USING gist (rotation_id WITH =, tstzrange(starts_at, ends_at, '[)'::text) WITH &&);

ALTER TABLE ONLY incident_management_escalation_policies
    ADD CONSTRAINT incident_management_escalation_policies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_escalation_rules
    ADD CONSTRAINT incident_management_escalation_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_issuable_escalation_statuses
    ADD CONSTRAINT incident_management_issuable_escalation_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_oncall_participants
    ADD CONSTRAINT incident_management_oncall_participants_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_oncall_rotations
    ADD CONSTRAINT incident_management_oncall_rotations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_oncall_schedules
    ADD CONSTRAINT incident_management_oncall_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_oncall_shifts
    ADD CONSTRAINT incident_management_oncall_shifts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_pending_alert_escalations
    ADD CONSTRAINT incident_management_pending_alert_escalations_pkey PRIMARY KEY (id, process_at);

ALTER TABLE ONLY incident_management_pending_issue_escalations
    ADD CONSTRAINT incident_management_pending_issue_escalations_pkey PRIMARY KEY (id, process_at);

ALTER TABLE ONLY incident_management_timeline_event_tag_links
    ADD CONSTRAINT incident_management_timeline_event_tag_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_timeline_event_tags
    ADD CONSTRAINT incident_management_timeline_event_tags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY incident_management_timeline_events
    ADD CONSTRAINT incident_management_timeline_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY index_statuses
    ADD CONSTRAINT index_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY insights
    ADD CONSTRAINT insights_pkey PRIMARY KEY (id);

ALTER TABLE ONLY instance_audit_events
    ADD CONSTRAINT instance_audit_events_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY instance_audit_events_streaming_headers
    ADD CONSTRAINT instance_audit_events_streaming_headers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY instance_integrations
    ADD CONSTRAINT instance_integrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY instance_type_ci_runner_machines
    ADD CONSTRAINT instance_type_ci_runner_machines_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY instance_type_ci_runners
    ADD CONSTRAINT instance_type_ci_runners_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY integrations
    ADD CONSTRAINT integrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY internal_ids
    ADD CONSTRAINT internal_ids_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ip_restrictions
    ADD CONSTRAINT ip_restrictions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issuable_metric_image_uploads
    ADD CONSTRAINT issuable_metric_image_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY issuable_metric_images
    ADD CONSTRAINT issuable_metric_images_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issuable_resource_links
    ADD CONSTRAINT issuable_resource_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issuable_severities
    ADD CONSTRAINT issuable_severities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issuable_slas
    ADD CONSTRAINT issuable_slas_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_assignees
    ADD CONSTRAINT issue_assignees_pkey PRIMARY KEY (issue_id, user_id);

ALTER TABLE ONLY issue_assignment_events
    ADD CONSTRAINT issue_assignment_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_customer_relations_contacts
    ADD CONSTRAINT issue_customer_relations_contacts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_email_participants
    ADD CONSTRAINT issue_email_participants_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_emails
    ADD CONSTRAINT issue_emails_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_links
    ADD CONSTRAINT issue_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_metrics
    ADD CONSTRAINT issue_metrics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_tracker_data
    ADD CONSTRAINT issue_tracker_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issue_user_mentions
    ADD CONSTRAINT issue_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY issues
    ADD CONSTRAINT issues_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sprints
    ADD CONSTRAINT iteration_start_and_due_date_iterations_cadence_id_constraint EXCLUDE USING gist (iterations_cadence_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL)) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE ONLY iterations_cadences
    ADD CONSTRAINT iterations_cadences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY jira_connect_installations
    ADD CONSTRAINT jira_connect_installations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY jira_connect_subscriptions
    ADD CONSTRAINT jira_connect_subscriptions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY jira_imports
    ADD CONSTRAINT jira_imports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY jira_tracker_data
    ADD CONSTRAINT jira_tracker_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY keys
    ADD CONSTRAINT keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY label_links
    ADD CONSTRAINT label_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY label_priorities
    ADD CONSTRAINT label_priorities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY labels
    ADD CONSTRAINT labels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ldap_admin_role_links
    ADD CONSTRAINT ldap_admin_role_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ldap_group_links
    ADD CONSTRAINT ldap_group_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY lfs_file_locks
    ADD CONSTRAINT lfs_file_locks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY lfs_object_states
    ADD CONSTRAINT lfs_object_states_pkey PRIMARY KEY (lfs_object_id);

ALTER TABLE ONLY lfs_objects
    ADD CONSTRAINT lfs_objects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY lfs_objects_projects
    ADD CONSTRAINT lfs_objects_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY licenses
    ADD CONSTRAINT licenses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY list_user_preferences
    ADD CONSTRAINT list_user_preferences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY lists
    ADD CONSTRAINT lists_pkey PRIMARY KEY (id);

ALTER TABLE ONLY loose_foreign_keys_deleted_records
    ADD CONSTRAINT loose_foreign_keys_deleted_records_pkey PRIMARY KEY (partition, id);

ALTER TABLE ONLY member_approvals
    ADD CONSTRAINT member_approvals_pkey PRIMARY KEY (id);

ALTER TABLE ONLY member_roles
    ADD CONSTRAINT member_roles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY members_deletion_schedules
    ADD CONSTRAINT members_deletion_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY members
    ADD CONSTRAINT members_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_approval_metrics
    ADD CONSTRAINT merge_request_approval_metrics_pkey PRIMARY KEY (merge_request_id);

ALTER TABLE ONLY merge_request_assignees
    ADD CONSTRAINT merge_request_assignees_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_assignment_events
    ADD CONSTRAINT merge_request_assignment_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_blocks
    ADD CONSTRAINT merge_request_blocks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_cleanup_schedules
    ADD CONSTRAINT merge_request_cleanup_schedules_pkey PRIMARY KEY (merge_request_id);

ALTER TABLE ONLY merge_request_commits_metadata
    ADD CONSTRAINT merge_request_commits_metadata_pkey PRIMARY KEY (id, project_id);

ALTER TABLE ONLY merge_request_context_commit_diff_files
    ADD CONSTRAINT merge_request_context_commit_diff_files_pkey PRIMARY KEY (merge_request_context_commit_id, relative_order);

ALTER TABLE ONLY merge_request_context_commits
    ADD CONSTRAINT merge_request_context_commits_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_diff_commit_users
    ADD CONSTRAINT merge_request_diff_commit_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_diff_commits
    ADD CONSTRAINT merge_request_diff_commits_pkey PRIMARY KEY (merge_request_diff_id, relative_order);

ALTER TABLE ONLY merge_request_diff_details
    ADD CONSTRAINT merge_request_diff_details_pkey PRIMARY KEY (merge_request_diff_id);

ALTER TABLE ONLY merge_request_diff_files
    ADD CONSTRAINT merge_request_diff_files_pkey PRIMARY KEY (merge_request_diff_id, relative_order);

ALTER TABLE ONLY merge_request_diffs
    ADD CONSTRAINT merge_request_diffs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_merge_schedules
    ADD CONSTRAINT merge_request_merge_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_metrics
    ADD CONSTRAINT merge_request_metrics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_predictions
    ADD CONSTRAINT merge_request_predictions_pkey PRIMARY KEY (merge_request_id);

ALTER TABLE ONLY merge_request_requested_changes
    ADD CONSTRAINT merge_request_requested_changes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_reviewers
    ADD CONSTRAINT merge_request_reviewers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_request_user_mentions
    ADD CONSTRAINT merge_request_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_approval_rules_approver_groups
    ADD CONSTRAINT merge_requests_approval_rules_approver_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_approval_rules_approver_users
    ADD CONSTRAINT merge_requests_approval_rules_approver_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_approval_rules_groups
    ADD CONSTRAINT merge_requests_approval_rules_groups_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_approval_rules_merge_requests
    ADD CONSTRAINT merge_requests_approval_rules_merge_requests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_approval_rules
    ADD CONSTRAINT merge_requests_approval_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_approval_rules_projects
    ADD CONSTRAINT merge_requests_approval_rules_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_closing_issues
    ADD CONSTRAINT merge_requests_closing_issues_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests_compliance_violations
    ADD CONSTRAINT merge_requests_compliance_violations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT merge_requests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY merge_trains
    ADD CONSTRAINT merge_trains_pkey PRIMARY KEY (id);

ALTER TABLE ONLY milestone_releases
    ADD CONSTRAINT milestone_releases_pkey PRIMARY KEY (milestone_id, release_id);

ALTER TABLE ONLY milestones
    ADD CONSTRAINT milestones_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_candidate_metadata
    ADD CONSTRAINT ml_candidate_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_candidate_metrics
    ADD CONSTRAINT ml_candidate_metrics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_candidate_params
    ADD CONSTRAINT ml_candidate_params_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_candidates
    ADD CONSTRAINT ml_candidates_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_experiment_metadata
    ADD CONSTRAINT ml_experiment_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_experiments
    ADD CONSTRAINT ml_experiments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_model_metadata
    ADD CONSTRAINT ml_model_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_model_version_metadata
    ADD CONSTRAINT ml_model_version_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_model_versions
    ADD CONSTRAINT ml_model_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ml_models
    ADD CONSTRAINT ml_models_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_admin_notes
    ADD CONSTRAINT namespace_admin_notes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_aggregation_schedules
    ADD CONSTRAINT namespace_aggregation_schedules_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_ai_settings
    ADD CONSTRAINT namespace_ai_settings_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_bans
    ADD CONSTRAINT namespace_bans_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_ci_cd_settings
    ADD CONSTRAINT namespace_ci_cd_settings_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_cluster_agent_mappings
    ADD CONSTRAINT namespace_cluster_agent_mappings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_commit_emails
    ADD CONSTRAINT namespace_commit_emails_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_deletion_schedules
    ADD CONSTRAINT namespace_deletion_schedules_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_details
    ADD CONSTRAINT namespace_details_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_import_users
    ADD CONSTRAINT namespace_import_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_ldap_settings
    ADD CONSTRAINT namespace_ldap_settings_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_limits
    ADD CONSTRAINT namespace_limits_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_package_settings
    ADD CONSTRAINT namespace_package_settings_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_root_storage_statistics
    ADD CONSTRAINT namespace_root_storage_statistics_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_settings
    ADD CONSTRAINT namespace_settings_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY namespace_statistics
    ADD CONSTRAINT namespace_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespace_uploads
    ADD CONSTRAINT namespace_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY namespaces
    ADD CONSTRAINT namespaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespaces_storage_limit_exclusions
    ADD CONSTRAINT namespaces_storage_limit_exclusions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY namespaces_sync_events
    ADD CONSTRAINT namespaces_sync_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY non_sql_service_pings
    ADD CONSTRAINT non_sql_service_pings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY note_diff_files
    ADD CONSTRAINT note_diff_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY note_metadata
    ADD CONSTRAINT note_metadata_pkey PRIMARY KEY (note_id);

ALTER TABLE ONLY note_uploads
    ADD CONSTRAINT note_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY notes
    ADD CONSTRAINT notes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY notification_settings
    ADD CONSTRAINT notification_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY oauth_access_grants
    ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);

ALTER TABLE ONLY oauth_access_tokens
    ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY oauth_applications
    ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY oauth_device_grants
    ADD CONSTRAINT oauth_device_grants_pkey PRIMARY KEY (id);

ALTER TABLE ONLY oauth_openid_requests
    ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);

ALTER TABLE ONLY observability_group_o11y_settings
    ADD CONSTRAINT observability_group_o11y_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY observability_logs_issues_connections
    ADD CONSTRAINT observability_logs_issues_connections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY observability_metrics_issues_connections
    ADD CONSTRAINT observability_metrics_issues_connections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY observability_traces_issues_connections
    ADD CONSTRAINT observability_traces_issues_connections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY onboarding_progresses
    ADD CONSTRAINT onboarding_progresses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_feature_flags_clients
    ADD CONSTRAINT operations_feature_flags_clients_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_feature_flags_issues
    ADD CONSTRAINT operations_feature_flags_issues_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_feature_flags
    ADD CONSTRAINT operations_feature_flags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_scopes
    ADD CONSTRAINT operations_scopes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_strategies
    ADD CONSTRAINT operations_strategies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_strategies_user_lists
    ADD CONSTRAINT operations_strategies_user_lists_pkey PRIMARY KEY (id);

ALTER TABLE ONLY operations_user_lists
    ADD CONSTRAINT operations_user_lists_pkey PRIMARY KEY (id);

ALTER TABLE ONLY organization_cluster_agent_mappings
    ADD CONSTRAINT organization_cluster_agent_mappings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY organization_detail_uploads
    ADD CONSTRAINT organization_detail_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY organization_details
    ADD CONSTRAINT organization_details_pkey PRIMARY KEY (organization_id);

ALTER TABLE ONLY organization_push_rules
    ADD CONSTRAINT organization_push_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY organization_settings
    ADD CONSTRAINT organization_settings_pkey PRIMARY KEY (organization_id);

ALTER TABLE ONLY organization_user_aliases
    ADD CONSTRAINT organization_user_aliases_pkey PRIMARY KEY (id);

ALTER TABLE ONLY organization_user_details
    ADD CONSTRAINT organization_user_details_pkey PRIMARY KEY (id);

ALTER TABLE ONLY organization_users
    ADD CONSTRAINT organization_users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY organizations
    ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY p_ai_active_context_code_enabled_namespaces
    ADD CONSTRAINT p_ai_active_context_code_enabled_namespaces_pkey PRIMARY KEY (id, namespace_id);

ALTER TABLE ONLY p_ai_active_context_code_repositories
    ADD CONSTRAINT p_ai_active_context_code_repositories_pkey PRIMARY KEY (id, project_id);

ALTER TABLE ONLY p_batched_git_ref_updates_deletions
    ADD CONSTRAINT p_batched_git_ref_updates_deletions_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_catalog_resource_sync_events
    ADD CONSTRAINT p_catalog_resource_sync_events_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_build_names
    ADD CONSTRAINT p_ci_build_names_pkey PRIMARY KEY (build_id, partition_id);

ALTER TABLE ONLY p_ci_build_sources
    ADD CONSTRAINT p_ci_build_sources_pkey PRIMARY KEY (build_id, partition_id);

ALTER TABLE ONLY p_ci_build_tags
    ADD CONSTRAINT p_ci_build_tags_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_build_trace_metadata
    ADD CONSTRAINT p_ci_build_trace_metadata_pkey PRIMARY KEY (build_id, partition_id);

ALTER TABLE ONLY p_ci_builds_execution_configs
    ADD CONSTRAINT p_ci_builds_execution_configs_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_builds_metadata
    ADD CONSTRAINT p_ci_builds_metadata_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_builds
    ADD CONSTRAINT p_ci_builds_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_finished_build_ch_sync_events
    ADD CONSTRAINT p_ci_finished_build_ch_sync_events_pkey PRIMARY KEY (build_id, partition);

ALTER TABLE ONLY p_ci_finished_pipeline_ch_sync_events
    ADD CONSTRAINT p_ci_finished_pipeline_ch_sync_events_pkey PRIMARY KEY (pipeline_id, partition);

ALTER TABLE ONLY p_ci_job_annotations
    ADD CONSTRAINT p_ci_job_annotations_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_job_artifact_reports
    ADD CONSTRAINT p_ci_job_artifact_reports_pkey PRIMARY KEY (job_artifact_id, partition_id);

ALTER TABLE ONLY p_ci_job_artifacts
    ADD CONSTRAINT p_ci_job_artifacts_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_job_inputs
    ADD CONSTRAINT p_ci_job_inputs_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_pipeline_variables
    ADD CONSTRAINT p_ci_pipeline_variables_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_pipelines
    ADD CONSTRAINT p_ci_pipelines_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_runner_machine_builds
    ADD CONSTRAINT p_ci_runner_machine_builds_pkey PRIMARY KEY (build_id, partition_id);

ALTER TABLE ONLY p_ci_stages
    ADD CONSTRAINT p_ci_stages_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_ci_workloads
    ADD CONSTRAINT p_ci_workloads_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY p_duo_workflows_checkpoints
    ADD CONSTRAINT p_duo_workflows_checkpoints_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY p_knowledge_graph_enabled_namespaces
    ADD CONSTRAINT p_knowledge_graph_enabled_namespaces_pkey PRIMARY KEY (id, namespace_id);

ALTER TABLE ONLY p_knowledge_graph_replicas
    ADD CONSTRAINT p_knowledge_graph_replicas_pkey PRIMARY KEY (id, namespace_id);

ALTER TABLE ONLY p_knowledge_graph_tasks
    ADD CONSTRAINT p_knowledge_graph_tasks_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY packages_build_infos
    ADD CONSTRAINT packages_build_infos_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_cleanup_policies
    ADD CONSTRAINT packages_cleanup_policies_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY packages_composer_metadata
    ADD CONSTRAINT packages_composer_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY packages_composer_packages
    ADD CONSTRAINT packages_composer_packages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_conan_file_metadata
    ADD CONSTRAINT packages_conan_file_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_conan_metadata
    ADD CONSTRAINT packages_conan_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_conan_package_references
    ADD CONSTRAINT packages_conan_package_references_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_conan_package_revisions
    ADD CONSTRAINT packages_conan_package_revisions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_conan_recipe_revisions
    ADD CONSTRAINT packages_conan_recipe_revisions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_file_metadata
    ADD CONSTRAINT packages_debian_file_metadata_pkey PRIMARY KEY (package_file_id);

ALTER TABLE ONLY packages_debian_group_architectures
    ADD CONSTRAINT packages_debian_group_architectures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_group_component_files
    ADD CONSTRAINT packages_debian_group_component_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_group_components
    ADD CONSTRAINT packages_debian_group_components_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_group_distribution_keys
    ADD CONSTRAINT packages_debian_group_distribution_keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_group_distributions
    ADD CONSTRAINT packages_debian_group_distributions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_project_architectures
    ADD CONSTRAINT packages_debian_project_architectures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_project_component_files
    ADD CONSTRAINT packages_debian_project_component_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_project_components
    ADD CONSTRAINT packages_debian_project_components_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_project_distribution_keys
    ADD CONSTRAINT packages_debian_project_distribution_keys_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_project_distributions
    ADD CONSTRAINT packages_debian_project_distributions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_debian_publications
    ADD CONSTRAINT packages_debian_publications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_dependencies
    ADD CONSTRAINT packages_dependencies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_dependency_links
    ADD CONSTRAINT packages_dependency_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_helm_file_metadata
    ADD CONSTRAINT packages_helm_file_metadata_pkey PRIMARY KEY (package_file_id);

ALTER TABLE ONLY packages_helm_metadata_caches
    ADD CONSTRAINT packages_helm_metadata_caches_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_maven_metadata
    ADD CONSTRAINT packages_maven_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_npm_metadata_caches
    ADD CONSTRAINT packages_npm_metadata_caches_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_npm_metadata
    ADD CONSTRAINT packages_npm_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY packages_nuget_dependency_link_metadata
    ADD CONSTRAINT packages_nuget_dependency_link_metadata_pkey PRIMARY KEY (dependency_link_id);

ALTER TABLE ONLY packages_nuget_metadata
    ADD CONSTRAINT packages_nuget_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY packages_nuget_symbols
    ADD CONSTRAINT packages_nuget_symbols_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_package_file_build_infos
    ADD CONSTRAINT packages_package_file_build_infos_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_package_files
    ADD CONSTRAINT packages_package_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_packages
    ADD CONSTRAINT packages_packages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_protection_rules
    ADD CONSTRAINT packages_protection_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_pypi_metadata
    ADD CONSTRAINT packages_pypi_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY packages_rpm_metadata
    ADD CONSTRAINT packages_rpm_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY packages_rpm_repository_files
    ADD CONSTRAINT packages_rpm_repository_files_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_rubygems_metadata
    ADD CONSTRAINT packages_rubygems_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY packages_tags
    ADD CONSTRAINT packages_tags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY packages_terraform_module_metadata
    ADD CONSTRAINT packages_terraform_module_metadata_pkey PRIMARY KEY (package_id);

ALTER TABLE ONLY pages_deployment_states
    ADD CONSTRAINT pages_deployment_states_pkey PRIMARY KEY (pages_deployment_id);

ALTER TABLE ONLY pages_deployments
    ADD CONSTRAINT pages_deployments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pages_domain_acme_orders
    ADD CONSTRAINT pages_domain_acme_orders_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pages_domains
    ADD CONSTRAINT pages_domains_pkey PRIMARY KEY (id);

ALTER TABLE ONLY path_locks
    ADD CONSTRAINT path_locks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY personal_access_token_last_used_ips
    ADD CONSTRAINT personal_access_token_last_used_ips_pkey PRIMARY KEY (id);

ALTER TABLE ONLY personal_access_tokens
    ADD CONSTRAINT personal_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pipl_users
    ADD CONSTRAINT pipl_users_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY plan_limits
    ADD CONSTRAINT plan_limits_pkey PRIMARY KEY (id);

ALTER TABLE ONLY plans
    ADD CONSTRAINT plans_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_advisories
    ADD CONSTRAINT pm_advisories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_affected_packages
    ADD CONSTRAINT pm_affected_packages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_checkpoints
    ADD CONSTRAINT pm_checkpoints_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_cve_enrichment
    ADD CONSTRAINT pm_cve_enrichment_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_licenses
    ADD CONSTRAINT pm_licenses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_package_version_licenses
    ADD CONSTRAINT pm_package_version_licenses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_package_versions
    ADD CONSTRAINT pm_package_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pm_packages
    ADD CONSTRAINT pm_packages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY pool_repositories
    ADD CONSTRAINT pool_repositories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY postgres_async_foreign_key_validations
    ADD CONSTRAINT postgres_async_foreign_key_validations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY postgres_async_indexes
    ADD CONSTRAINT postgres_async_indexes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY postgres_reindex_actions
    ADD CONSTRAINT postgres_reindex_actions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY postgres_reindex_queued_actions
    ADD CONSTRAINT postgres_reindex_queued_actions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY programming_languages
    ADD CONSTRAINT programming_languages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_access_tokens
    ADD CONSTRAINT project_access_tokens_pkey PRIMARY KEY (personal_access_token_id, project_id);

ALTER TABLE ONLY project_alerting_settings
    ADD CONSTRAINT project_alerting_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_aliases
    ADD CONSTRAINT project_aliases_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_audit_events
    ADD CONSTRAINT project_audit_events_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY project_authorizations_for_migration
    ADD CONSTRAINT project_authorizations_for_migration_pkey PRIMARY KEY (user_id, project_id);

ALTER TABLE ONLY project_authorizations
    ADD CONSTRAINT project_authorizations_pkey PRIMARY KEY (user_id, project_id, access_level);

ALTER TABLE ONLY project_auto_devops
    ADD CONSTRAINT project_auto_devops_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_build_artifacts_size_refreshes
    ADD CONSTRAINT project_build_artifacts_size_refreshes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_ci_cd_settings
    ADD CONSTRAINT project_ci_cd_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_ci_feature_usages
    ADD CONSTRAINT project_ci_feature_usages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_compliance_framework_settings
    ADD CONSTRAINT project_compliance_framework_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_compliance_standards_adherence
    ADD CONSTRAINT project_compliance_standards_adherence_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_compliance_violations_issues
    ADD CONSTRAINT project_compliance_violations_issues_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_compliance_violations
    ADD CONSTRAINT project_compliance_violations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_control_compliance_statuses
    ADD CONSTRAINT project_control_compliance_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_custom_attributes
    ADD CONSTRAINT project_custom_attributes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_daily_statistics
    ADD CONSTRAINT project_daily_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_data_transfers
    ADD CONSTRAINT project_data_transfers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_deploy_tokens
    ADD CONSTRAINT project_deploy_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_error_tracking_settings
    ADD CONSTRAINT project_error_tracking_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_export_jobs
    ADD CONSTRAINT project_export_jobs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_feature_usages
    ADD CONSTRAINT project_feature_usages_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_features
    ADD CONSTRAINT project_features_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_group_links
    ADD CONSTRAINT project_group_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_import_data
    ADD CONSTRAINT project_import_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_import_export_relation_export_upload_uploads
    ADD CONSTRAINT project_import_export_relation_export_upload_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY project_incident_management_settings
    ADD CONSTRAINT project_incident_management_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_metrics_settings
    ADD CONSTRAINT project_metrics_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_mirror_data
    ADD CONSTRAINT project_mirror_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_pages_metadata
    ADD CONSTRAINT project_pages_metadata_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_relation_export_uploads
    ADD CONSTRAINT project_relation_export_uploads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_relation_exports
    ADD CONSTRAINT project_relation_exports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_repositories
    ADD CONSTRAINT project_repositories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_repository_storage_moves
    ADD CONSTRAINT project_repository_storage_moves_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_requirement_compliance_statuses
    ADD CONSTRAINT project_requirement_compliance_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_saved_replies
    ADD CONSTRAINT project_saved_replies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_secrets_managers
    ADD CONSTRAINT project_secrets_managers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_security_exclusions
    ADD CONSTRAINT project_security_exclusions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_security_settings
    ADD CONSTRAINT project_security_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_security_statistics
    ADD CONSTRAINT project_security_statistics_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_settings
    ADD CONSTRAINT project_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY project_states
    ADD CONSTRAINT project_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_statistics
    ADD CONSTRAINT project_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_topic_uploads
    ADD CONSTRAINT project_topic_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY project_topics
    ADD CONSTRAINT project_topics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY project_type_ci_runner_machines
    ADD CONSTRAINT project_type_ci_runner_machines_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY project_type_ci_runners
    ADD CONSTRAINT project_type_ci_runners_pkey PRIMARY KEY (id, runner_type);

ALTER TABLE ONLY project_uploads
    ADD CONSTRAINT project_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY project_wiki_repositories
    ADD CONSTRAINT project_wiki_repositories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY projects_branch_rules_merge_request_approval_settings
    ADD CONSTRAINT projects_branch_rules_merge_request_approval_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY projects_branch_rules_squash_options
    ADD CONSTRAINT projects_branch_rules_squash_options_pkey PRIMARY KEY (id);

ALTER TABLE ONLY projects
    ADD CONSTRAINT projects_pkey PRIMARY KEY (id);

ALTER TABLE projects
    ADD CONSTRAINT projects_star_count_positive CHECK ((star_count >= 0)) NOT VALID;

ALTER TABLE ONLY projects_sync_events
    ADD CONSTRAINT projects_sync_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY projects_visits
    ADD CONSTRAINT projects_visits_pkey PRIMARY KEY (id, visited_at);

ALTER TABLE ONLY projects_with_pipeline_variables
    ADD CONSTRAINT projects_with_pipeline_variables_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY protected_branch_merge_access_levels
    ADD CONSTRAINT protected_branch_merge_access_levels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT protected_branch_push_access_levels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_branch_unprotect_access_levels
    ADD CONSTRAINT protected_branch_unprotect_access_levels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_branches
    ADD CONSTRAINT protected_branches_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_environment_approval_rules
    ADD CONSTRAINT protected_environment_approval_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_environment_deploy_access_levels
    ADD CONSTRAINT protected_environment_deploy_access_levels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_environments
    ADD CONSTRAINT protected_environments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_tag_create_access_levels
    ADD CONSTRAINT protected_tag_create_access_levels_pkey PRIMARY KEY (id);

ALTER TABLE ONLY protected_tags
    ADD CONSTRAINT protected_tags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY push_event_payloads
    ADD CONSTRAINT push_event_payloads_pkey PRIMARY KEY (event_id);

ALTER TABLE ONLY push_rules
    ADD CONSTRAINT push_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY queries_service_pings
    ADD CONSTRAINT queries_service_pings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY raw_usage_data
    ADD CONSTRAINT raw_usage_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY redirect_routes
    ADD CONSTRAINT redirect_routes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY related_epic_links
    ADD CONSTRAINT related_epic_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY relation_import_trackers
    ADD CONSTRAINT relation_import_trackers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY release_links
    ADD CONSTRAINT release_links_pkey PRIMARY KEY (id);

ALTER TABLE releases
    ADD CONSTRAINT releases_not_null_tag CHECK ((tag IS NOT NULL)) NOT VALID;

ALTER TABLE ONLY releases
    ADD CONSTRAINT releases_pkey PRIMARY KEY (id);

ALTER TABLE ONLY remote_mirrors
    ADD CONSTRAINT remote_mirrors_pkey PRIMARY KEY (id);

ALTER TABLE ONLY repository_languages
    ADD CONSTRAINT repository_languages_pkey PRIMARY KEY (project_id, programming_language_id);

ALTER TABLE ONLY required_code_owners_sections
    ADD CONSTRAINT required_code_owners_sections_pkey PRIMARY KEY (id);

ALTER TABLE ONLY requirements_management_test_reports
    ADD CONSTRAINT requirements_management_test_reports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY requirements
    ADD CONSTRAINT requirements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT resource_iteration_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY resource_label_events
    ADD CONSTRAINT resource_label_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY resource_link_events
    ADD CONSTRAINT resource_link_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY resource_milestone_events
    ADD CONSTRAINT resource_milestone_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT resource_state_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY resource_weight_events
    ADD CONSTRAINT resource_weight_events_pkey PRIMARY KEY (id);

ALTER TABLE ONLY reviews
    ADD CONSTRAINT reviews_pkey PRIMARY KEY (id);

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);

ALTER TABLE ONLY saved_replies
    ADD CONSTRAINT saved_replies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_component_versions
    ADD CONSTRAINT sbom_component_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_components
    ADD CONSTRAINT sbom_components_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_graph_paths
    ADD CONSTRAINT sbom_graph_paths_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_occurrences
    ADD CONSTRAINT sbom_occurrences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_occurrences_vulnerabilities
    ADD CONSTRAINT sbom_occurrences_vulnerabilities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_source_packages
    ADD CONSTRAINT sbom_source_packages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sbom_sources
    ADD CONSTRAINT sbom_sources_pkey PRIMARY KEY (id);

ALTER TABLE ONLY scan_execution_policy_rules
    ADD CONSTRAINT scan_execution_policy_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY scan_result_policies
    ADD CONSTRAINT scan_result_policies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY scan_result_policy_violations
    ADD CONSTRAINT scan_result_policy_violations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY schema_migrations
    ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);

ALTER TABLE ONLY scim_group_memberships
    ADD CONSTRAINT scim_group_memberships_pkey PRIMARY KEY (id);

ALTER TABLE ONLY scim_identities
    ADD CONSTRAINT scim_identities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY scim_oauth_access_tokens
    ADD CONSTRAINT scim_oauth_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY secret_detection_token_statuses
    ADD CONSTRAINT secret_detection_token_statuses_pkey PRIMARY KEY (vulnerability_occurrence_id);

ALTER TABLE ONLY security_categories
    ADD CONSTRAINT security_categories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_findings
    ADD CONSTRAINT security_findings_pkey PRIMARY KEY (id, partition_number);

ALTER TABLE ONLY security_orchestration_policy_configurations
    ADD CONSTRAINT security_orchestration_policy_configurations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_orchestration_policy_rule_schedules
    ADD CONSTRAINT security_orchestration_policy_rule_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_pipeline_execution_policy_config_links
    ADD CONSTRAINT security_pipeline_execution_policy_config_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_pipeline_execution_project_schedules
    ADD CONSTRAINT security_pipeline_execution_project_schedules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_policies
    ADD CONSTRAINT security_policies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_policy_project_links
    ADD CONSTRAINT security_policy_project_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_policy_requirements
    ADD CONSTRAINT security_policy_requirements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_policy_settings
    ADD CONSTRAINT security_policy_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_scans
    ADD CONSTRAINT security_scans_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_training_providers
    ADD CONSTRAINT security_training_providers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY security_trainings
    ADD CONSTRAINT security_trainings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sent_notifications_7abbf02cb6
    ADD CONSTRAINT sent_notifications_7abbf02cb6_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY sent_notifications
    ADD CONSTRAINT sent_notifications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sentry_issues
    ADD CONSTRAINT sentry_issues_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sprints
    ADD CONSTRAINT sequence_is_unique_per_iterations_cadence_id UNIQUE (iterations_cadence_id, sequence) DEFERRABLE INITIALLY DEFERRED;

ALTER TABLE ONLY service_access_tokens
    ADD CONSTRAINT service_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY service_desk_custom_email_credentials
    ADD CONSTRAINT service_desk_custom_email_credentials_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY service_desk_custom_email_verifications
    ADD CONSTRAINT service_desk_custom_email_verifications_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY service_desk_settings
    ADD CONSTRAINT service_desk_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY shards
    ADD CONSTRAINT shards_pkey PRIMARY KEY (id);

ALTER TABLE ONLY slack_api_scopes
    ADD CONSTRAINT slack_api_scopes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY slack_integrations
    ADD CONSTRAINT slack_integrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY slack_integrations_scopes
    ADD CONSTRAINT slack_integrations_scopes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY smartcard_identities
    ADD CONSTRAINT smartcard_identities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY snippet_repositories
    ADD CONSTRAINT snippet_repositories_pkey PRIMARY KEY (snippet_id);

ALTER TABLE ONLY snippet_repository_states
    ADD CONSTRAINT snippet_repository_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY snippet_repository_storage_moves
    ADD CONSTRAINT snippet_repository_storage_moves_pkey PRIMARY KEY (id);

ALTER TABLE ONLY snippet_statistics
    ADD CONSTRAINT snippet_statistics_pkey PRIMARY KEY (snippet_id);

ALTER TABLE ONLY snippet_uploads
    ADD CONSTRAINT snippet_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY snippet_user_mentions
    ADD CONSTRAINT snippet_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY snippets
    ADD CONSTRAINT snippets_pkey PRIMARY KEY (id);

ALTER TABLE ONLY software_license_policies
    ADD CONSTRAINT software_license_policies_pkey PRIMARY KEY (id);

ALTER TABLE ONLY software_licenses
    ADD CONSTRAINT software_licenses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY spam_logs
    ADD CONSTRAINT spam_logs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY sprints
    ADD CONSTRAINT sprints_pkey PRIMARY KEY (id);

ALTER TABLE ONLY ssh_signatures
    ADD CONSTRAINT ssh_signatures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY status_check_responses
    ADD CONSTRAINT status_check_responses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY status_page_published_incidents
    ADD CONSTRAINT status_page_published_incidents_pkey PRIMARY KEY (id);

ALTER TABLE ONLY status_page_settings
    ADD CONSTRAINT status_page_settings_pkey PRIMARY KEY (project_id);

ALTER TABLE ONLY subscription_add_on_purchases
    ADD CONSTRAINT subscription_add_on_purchases_pkey PRIMARY KEY (id);

ALTER TABLE ONLY subscription_add_ons
    ADD CONSTRAINT subscription_add_ons_pkey PRIMARY KEY (id);

ALTER TABLE ONLY subscription_seat_assignments
    ADD CONSTRAINT subscription_seat_assignments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY subscription_user_add_on_assignment_versions
    ADD CONSTRAINT subscription_user_add_on_assignment_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY subscription_user_add_on_assignments
    ADD CONSTRAINT subscription_user_add_on_assignments_pkey PRIMARY KEY (id);

ALTER TABLE ONLY subscriptions
    ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY suggestions
    ADD CONSTRAINT suggestions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_access_group_microsoft_applications
    ADD CONSTRAINT system_access_group_microsoft_applications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_access_group_microsoft_graph_access_tokens
    ADD CONSTRAINT system_access_group_microsoft_graph_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_access_instance_microsoft_applications
    ADD CONSTRAINT system_access_instance_microsoft_applications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_access_instance_microsoft_graph_access_tokens
    ADD CONSTRAINT system_access_instance_microsoft_graph_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_access_microsoft_applications
    ADD CONSTRAINT system_access_microsoft_applications_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_access_microsoft_graph_access_tokens
    ADD CONSTRAINT system_access_microsoft_graph_access_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY system_note_metadata
    ADD CONSTRAINT system_note_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY tags
    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY target_branch_rules
    ADD CONSTRAINT target_branch_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY targeted_message_dismissals
    ADD CONSTRAINT targeted_message_dismissals_pkey PRIMARY KEY (id);

ALTER TABLE ONLY targeted_message_namespaces
    ADD CONSTRAINT targeted_message_namespaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY targeted_messages
    ADD CONSTRAINT targeted_messages_pkey PRIMARY KEY (id);

ALTER TABLE ONLY term_agreements
    ADD CONSTRAINT term_agreements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY terraform_state_version_states
    ADD CONSTRAINT terraform_state_version_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY terraform_state_versions
    ADD CONSTRAINT terraform_state_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY terraform_states
    ADD CONSTRAINT terraform_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY timelog_categories
    ADD CONSTRAINT timelog_categories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY timelogs
    ADD CONSTRAINT timelogs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY todos
    ADD CONSTRAINT todos_pkey PRIMARY KEY (id);

ALTER TABLE ONLY topics
    ADD CONSTRAINT topics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY trending_projects
    ADD CONSTRAINT trending_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY upcoming_reconciliations
    ADD CONSTRAINT upcoming_reconciliations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY upload_states
    ADD CONSTRAINT upload_states_pkey PRIMARY KEY (upload_id);

ALTER TABLE ONLY uploads
    ADD CONSTRAINT uploads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_achievements
    ADD CONSTRAINT user_achievements_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_admin_roles
    ADD CONSTRAINT user_admin_roles_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY user_agent_details
    ADD CONSTRAINT user_agent_details_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_audit_events
    ADD CONSTRAINT user_audit_events_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY user_broadcast_message_dismissals
    ADD CONSTRAINT user_broadcast_message_dismissals_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_callouts
    ADD CONSTRAINT user_callouts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_credit_card_validations
    ADD CONSTRAINT user_credit_card_validations_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY user_custom_attributes
    ADD CONSTRAINT user_custom_attributes_pkey PRIMARY KEY (id);

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_group_callouts
    ADD CONSTRAINT user_group_callouts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_group_member_roles
    ADD CONSTRAINT user_group_member_roles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_highest_roles
    ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY user_member_roles
    ADD CONSTRAINT user_member_roles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_namespace_callouts
    ADD CONSTRAINT user_namespace_callouts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_permission_export_upload_uploads
    ADD CONSTRAINT user_permission_export_upload_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY user_permission_export_uploads
    ADD CONSTRAINT user_permission_export_uploads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_phone_number_validations
    ADD CONSTRAINT user_phone_number_validations_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY user_preferences
    ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_project_callouts
    ADD CONSTRAINT user_project_callouts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_statuses
    ADD CONSTRAINT user_statuses_pkey PRIMARY KEY (user_id);

ALTER TABLE ONLY user_synced_attributes_metadata
    ADD CONSTRAINT user_synced_attributes_metadata_pkey PRIMARY KEY (id);

ALTER TABLE ONLY user_uploads
    ADD CONSTRAINT user_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY users_ops_dashboard_projects
    ADD CONSTRAINT users_ops_dashboard_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY users_security_dashboard_projects
    ADD CONSTRAINT users_security_dashboard_projects_pkey PRIMARY KEY (project_id, user_id);

ALTER TABLE ONLY users_star_projects
    ADD CONSTRAINT users_star_projects_pkey PRIMARY KEY (id);

ALTER TABLE ONLY users_statistics
    ADD CONSTRAINT users_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY value_stream_dashboard_aggregations
    ADD CONSTRAINT value_stream_dashboard_aggregations_pkey PRIMARY KEY (namespace_id);

ALTER TABLE ONLY value_stream_dashboard_counts
    ADD CONSTRAINT value_stream_dashboard_counts_pkey PRIMARY KEY (namespace_id, metric, recorded_at, count, id);

ALTER TABLE ONLY verification_codes
    ADD CONSTRAINT verification_codes_pkey PRIMARY KEY (created_at, visitor_id_code, code, phone);

ALTER TABLE ONLY virtual_registries_packages_maven_registries
    ADD CONSTRAINT virtual_registries_packages_maven_registries_pkey PRIMARY KEY (id);

ALTER TABLE ONLY virtual_registries_packages_maven_registry_upstreams
    ADD CONSTRAINT virtual_registries_packages_maven_registry_upstreams_pkey PRIMARY KEY (id);

ALTER TABLE ONLY virtual_registries_packages_maven_upstreams
    ADD CONSTRAINT virtual_registries_packages_maven_upstreams_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vs_code_settings
    ADD CONSTRAINT vs_code_settings_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerabilities
    ADD CONSTRAINT vulnerabilities_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_archive_export_uploads
    ADD CONSTRAINT vulnerability_archive_export_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY vulnerability_archive_exports
    ADD CONSTRAINT vulnerability_archive_exports_pkey PRIMARY KEY (id, partition_number);

ALTER TABLE ONLY vulnerability_archived_records
    ADD CONSTRAINT vulnerability_archived_records_pkey PRIMARY KEY (id, date);

ALTER TABLE ONLY vulnerability_archives
    ADD CONSTRAINT vulnerability_archives_pkey PRIMARY KEY (id, date);

ALTER TABLE ONLY vulnerability_export_part_uploads
    ADD CONSTRAINT vulnerability_export_part_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY vulnerability_export_parts
    ADD CONSTRAINT vulnerability_export_parts_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_export_uploads
    ADD CONSTRAINT vulnerability_export_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY vulnerability_exports
    ADD CONSTRAINT vulnerability_exports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_external_issue_links
    ADD CONSTRAINT vulnerability_external_issue_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_feedback
    ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_finding_evidences
    ADD CONSTRAINT vulnerability_finding_evidences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_finding_links
    ADD CONSTRAINT vulnerability_finding_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_finding_signatures
    ADD CONSTRAINT vulnerability_finding_signatures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_findings_remediations
    ADD CONSTRAINT vulnerability_findings_remediations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_flags
    ADD CONSTRAINT vulnerability_flags_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_historical_statistics
    ADD CONSTRAINT vulnerability_historical_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_identifiers
    ADD CONSTRAINT vulnerability_identifiers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_issue_links
    ADD CONSTRAINT vulnerability_issue_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_management_policy_rules
    ADD CONSTRAINT vulnerability_management_policy_rules_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_merge_request_links
    ADD CONSTRAINT vulnerability_merge_request_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_namespace_historical_statistics
    ADD CONSTRAINT vulnerability_namespace_historical_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_namespace_statistics
    ADD CONSTRAINT vulnerability_namespace_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_occurrence_identifiers
    ADD CONSTRAINT vulnerability_occurrence_identifiers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_occurrences
    ADD CONSTRAINT vulnerability_occurrences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_partial_scans
    ADD CONSTRAINT vulnerability_partial_scans_pkey PRIMARY KEY (scan_id);

ALTER TABLE ONLY vulnerability_reads
    ADD CONSTRAINT vulnerability_reads_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_remediation_uploads
    ADD CONSTRAINT vulnerability_remediation_uploads_pkey PRIMARY KEY (id, model_type);

ALTER TABLE ONLY vulnerability_remediations
    ADD CONSTRAINT vulnerability_remediations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_representation_information
    ADD CONSTRAINT vulnerability_representation_information_pkey PRIMARY KEY (vulnerability_id);

ALTER TABLE ONLY vulnerability_scanners
    ADD CONSTRAINT vulnerability_scanners_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_severity_overrides
    ADD CONSTRAINT vulnerability_severity_overrides_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_state_transitions
    ADD CONSTRAINT vulnerability_state_transitions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_statistics
    ADD CONSTRAINT vulnerability_statistics_pkey PRIMARY KEY (id);

ALTER TABLE ONLY vulnerability_user_mentions
    ADD CONSTRAINT vulnerability_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY web_hook_logs_daily
    ADD CONSTRAINT web_hook_logs_daily_pkey PRIMARY KEY (id, created_at);

ALTER TABLE ONLY web_hooks
    ADD CONSTRAINT web_hooks_pkey PRIMARY KEY (id);

ALTER TABLE ONLY webauthn_registrations
    ADD CONSTRAINT webauthn_registrations_pkey PRIMARY KEY (id);

ALTER TABLE ONLY wiki_page_meta
    ADD CONSTRAINT wiki_page_meta_pkey PRIMARY KEY (id);

ALTER TABLE ONLY wiki_page_meta_user_mentions
    ADD CONSTRAINT wiki_page_meta_user_mentions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY wiki_page_slugs
    ADD CONSTRAINT wiki_page_slugs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY wiki_repository_states
    ADD CONSTRAINT wiki_repository_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_colors
    ADD CONSTRAINT work_item_colors_pkey PRIMARY KEY (issue_id);

ALTER TABLE ONLY work_item_current_statuses
    ADD CONSTRAINT work_item_current_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_custom_lifecycle_statuses
    ADD CONSTRAINT work_item_custom_lifecycle_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT work_item_custom_lifecycles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_custom_statuses
    ADD CONSTRAINT work_item_custom_statuses_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT work_item_dates_sources_pkey PRIMARY KEY (issue_id);

ALTER TABLE ONLY work_item_hierarchy_restrictions
    ADD CONSTRAINT work_item_hierarchy_restrictions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_number_field_values
    ADD CONSTRAINT work_item_number_field_values_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_parent_links
    ADD CONSTRAINT work_item_parent_links_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_progresses
    ADD CONSTRAINT work_item_progresses_pkey PRIMARY KEY (issue_id);

ALTER TABLE ONLY work_item_related_link_restrictions
    ADD CONSTRAINT work_item_related_link_restrictions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_select_field_values
    ADD CONSTRAINT work_item_select_field_values_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_text_field_values
    ADD CONSTRAINT work_item_text_field_values_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_type_custom_fields
    ADD CONSTRAINT work_item_type_custom_fields_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_type_custom_lifecycles
    ADD CONSTRAINT work_item_type_custom_lifecycles_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_type_user_preferences
    ADD CONSTRAINT work_item_type_user_preferences_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_types
    ADD CONSTRAINT work_item_types_pkey PRIMARY KEY (id);

ALTER TABLE ONLY work_item_weights_sources
    ADD CONSTRAINT work_item_weights_sources_pkey PRIMARY KEY (work_item_id);

ALTER TABLE ONLY work_item_widget_definitions
    ADD CONSTRAINT work_item_widget_definitions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY workspace_agentk_states
    ADD CONSTRAINT workspace_agentk_states_pkey PRIMARY KEY (id);

ALTER TABLE ONLY workspace_tokens
    ADD CONSTRAINT workspace_tokens_pkey PRIMARY KEY (id);

ALTER TABLE ONLY workspace_variables
    ADD CONSTRAINT workspace_variables_pkey PRIMARY KEY (id);

ALTER TABLE ONLY workspaces_agent_config_versions
    ADD CONSTRAINT workspaces_agent_config_versions_pkey PRIMARY KEY (id);

ALTER TABLE ONLY workspaces_agent_configs
    ADD CONSTRAINT workspaces_agent_configs_pkey PRIMARY KEY (id);

ALTER TABLE ONLY workspaces
    ADD CONSTRAINT workspaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY x509_certificates
    ADD CONSTRAINT x509_certificates_pkey PRIMARY KEY (id);

ALTER TABLE ONLY x509_commit_signatures
    ADD CONSTRAINT x509_commit_signatures_pkey PRIMARY KEY (id);

ALTER TABLE ONLY x509_issuers
    ADD CONSTRAINT x509_issuers_pkey PRIMARY KEY (id);

ALTER TABLE ONLY xray_reports
    ADD CONSTRAINT xray_reports_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zentao_tracker_data
    ADD CONSTRAINT zentao_tracker_data_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zoekt_enabled_namespaces
    ADD CONSTRAINT zoekt_enabled_namespaces_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zoekt_indices
    ADD CONSTRAINT zoekt_indices_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zoekt_nodes
    ADD CONSTRAINT zoekt_nodes_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zoekt_replicas
    ADD CONSTRAINT zoekt_replicas_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zoekt_repositories
    ADD CONSTRAINT zoekt_repositories_pkey PRIMARY KEY (id);

ALTER TABLE ONLY zoekt_tasks
    ADD CONSTRAINT zoekt_tasks_pkey PRIMARY KEY (id, partition_id);

ALTER TABLE ONLY zoom_meetings
    ADD CONSTRAINT zoom_meetings_pkey PRIMARY KEY (id);

CREATE INDEX index_issue_stage_events_project_duration ON ONLY analytics_cycle_analytics_issue_stage_events USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_000925dbd7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ON ONLY virtual_registries_packages_maven_cache_entries USING btree (relative_path, object_storage_key);

CREATE UNIQUE INDEX index_0051c4d20c ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 USING btree (relative_path, object_storage_key);

CREATE INDEX index_merge_request_stage_events_project_duration ON ONLY analytics_cycle_analytics_merge_request_stage_events USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_006f943df6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_issue_stage_events_for_consistency_check ON ONLY analytics_cycle_analytics_issue_stage_events USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_009e6c1133 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE UNIQUE INDEX index_0264b93cfb ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 USING btree (relative_path, object_storage_key);

CREATE INDEX index_02749b504c ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_merge_request_stage_events_group_duration ON ONLY analytics_cycle_analytics_merge_request_stage_events USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_0287f5ba09 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_03aa30a758 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_issue_stage_events_group_duration ON ONLY analytics_cycle_analytics_issue_stage_events USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_055179c3ea ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_061fe00461 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_070cef72c3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_issue_search_data_on_namespace_id ON ONLY issue_search_data USING btree (namespace_id);

CREATE INDEX index_08b7071d9b ON gitlab_partitions_static.issue_search_data_41 USING btree (namespace_id);

CREATE INDEX index_08e3cfc564 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_merge_request_stage_events_group_in_progress_duration ON ONLY analytics_cycle_analytics_merge_request_stage_events USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_09af45dd6f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_09fe0c1886 ON gitlab_partitions_static.issue_search_data_01 USING btree (namespace_id);

CREATE INDEX index_0c153e2eae ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_issue_stage_events_group_in_progress_duration ON ONLY analytics_cycle_analytics_issue_stage_events USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_0ca85f3d71 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_issue_stage_events_project_in_progress_duration ON ONLY analytics_cycle_analytics_issue_stage_events USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_0d837a5dda ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_0e98daa03c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_0f28a65451 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_10588dbff0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_106d7d97e8 ON gitlab_partitions_static.issue_search_data_27 USING btree (namespace_id);

CREATE INDEX index_1076a9a98a ON gitlab_partitions_static.issue_search_data_10 USING btree (namespace_id);

CREATE INDEX index_107e123e17 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_1230a7a402 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_142c4e7ea4 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_merge_request_stage_events_project_in_progress_duration ON ONLY analytics_cycle_analytics_merge_request_stage_events USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_14e4fa1d7d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_14f3645821 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_16627b455e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_17fa2812c5 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_19aa18ccc9 ON gitlab_partitions_static.issue_search_data_45 USING btree (namespace_id);

CREATE INDEX index_19f4ed8614 ON gitlab_partitions_static.issue_search_data_33 USING btree (namespace_id);

CREATE INDEX index_1a0388713a ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_1a349ed064 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_1af932a3c7 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_1b0ea30bdb ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_1b47bbbb6a ON gitlab_partitions_static.issue_search_data_52 USING btree (namespace_id);

CREATE INDEX index_1f6c3faabe ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_1f8af04ed1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE UNIQUE INDEX index_1fa613e160 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 USING btree (relative_path, object_storage_key);

CREATE INDEX index_201c5ddbe9 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_20353089e0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_mr_stage_events_for_consistency_check ON ONLY analytics_cycle_analytics_merge_request_stage_events USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_203dd694bc ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_206349925b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_208e7ef042 ON gitlab_partitions_static.issue_search_data_48 USING btree (namespace_id);

CREATE INDEX index_2098118748 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_20c6491c6e ON gitlab_partitions_static.issue_search_data_29 USING btree (namespace_id);

CREATE INDEX index_21db459e34 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_21e262390a ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_2208bd7d7f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_223592b4a1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_22acc9ab11 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_22ed8f01dd ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_234d38a657 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_23783dc748 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_241e9a574c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE UNIQUE INDEX index_2439930f8c ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 USING btree (relative_path, object_storage_key);

CREATE UNIQUE INDEX index_2442d1fbd9 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 USING btree (relative_path, object_storage_key);

CREATE INDEX index_24ac321751 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_25e2aaee9b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_2653e7eeb8 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_2745f5a388 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_27739b516b ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 USING btree (relative_path, object_storage_key);

CREATE INDEX index_27759556bc ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_27d7ad78d8 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_281840d2d1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2945cf4c6d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_296f64df5c ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_2ad4b4fdbc ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2b7c0a294e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2bac9d64a0 ON gitlab_partitions_static.issue_search_data_38 USING btree (namespace_id);

CREATE INDEX index_2c6422f668 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2dfcdbe81e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2e1054b181 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_2e6991d05b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2f80c360c3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_2fc271c673 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_2fcfd0dc70 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_3005c75335 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_3206c1e6af ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_3249505125 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_331eb67441 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_34a8b08081 ON gitlab_partitions_static.issue_search_data_40 USING btree (namespace_id);

CREATE INDEX index_3640194b77 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_372160a706 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_389dd3c9fc ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_38a538234e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_39625b8a41 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_399dc06649 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_3a10b315c0 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_3a7d21a6ee ON gitlab_partitions_static.issue_search_data_19 USING btree (namespace_id);

CREATE INDEX index_3a8848c00b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_3b09ab5902 ON gitlab_partitions_static.issue_search_data_12 USING btree (namespace_id);

CREATE INDEX index_3bc2eedca5 ON gitlab_partitions_static.issue_search_data_59 USING btree (namespace_id);

CREATE INDEX index_3c2a3a6ac9 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_3dbde77b8b ON gitlab_partitions_static.issue_search_data_58 USING btree (namespace_id);

CREATE INDEX index_3e6be332b7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4137a6fac3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_41a1c3a4c6 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_435802dd01 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_436fa9ad5f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_43aff761b5 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 USING btree (relative_path, object_storage_key);

CREATE INDEX index_453a659cb6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_46b989b294 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4717e7049b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_47638677a3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4810ac88f5 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_482a09e0ee ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_491b4b749e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4a243772d7 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4b1793a4c4 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4b22560035 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4c2645eef2 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4c9d14f978 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4d04210a95 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4d4f2f7de6 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4db5aa5872 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_4dead6f314 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4e6ce1c371 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4ea50d3a5b ON gitlab_partitions_static.issue_search_data_24 USING btree (namespace_id);

CREATE UNIQUE INDEX index_4efb1529af ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 USING btree (relative_path, object_storage_key);

CREATE INDEX index_4f2eb7a06b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_4f6fc34e57 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_50272372ba ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_5034eae5ff ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_50c09f6e04 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5111e3e7e7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_52ea79bf8e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_541cc045fc ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_5445e466ee ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_551676e972 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_56281bfb73 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_5660b1b38e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_584c1e6fb0 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_5913107510 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_5968e77935 ON gitlab_partitions_static.issue_search_data_46 USING btree (namespace_id);

CREATE INDEX index_59a8209ab6 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_59ce40fcc4 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_59cfd5bc9a ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_5a5f39d824 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5b613b5fcf ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5b944f308d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_5bc2f32084 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_5bfa62771b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_5c4053b63d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5db09170d4 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_5e46aea379 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_5e78c2eac1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_5ee060202f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5f24f6ead2 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5f96b344e2 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_5fb1867c41 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_5fe1d00845 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_60e3480f23 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6137e27484 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_620fe77c99 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_625ed9e965 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_64e3a1dfa1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_64eb4cf8bd ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_6578d04baa ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_6580ecb2db ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_66a736da09 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_680d7ab4a6 ON gitlab_partitions_static.issue_search_data_06 USING btree (namespace_id);

CREATE INDEX index_682eba05f6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_69bdcf213e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6a39f6d5ac ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_6add8e74cf ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6b1ce61c8f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6b431c9952 ON gitlab_partitions_static.issue_search_data_23 USING btree (namespace_id);

CREATE INDEX index_6bf2b9282c ON gitlab_partitions_static.issue_search_data_22 USING btree (namespace_id);

CREATE INDEX index_6cfb391b86 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_6daa12da84 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 USING btree (relative_path, object_storage_key);

CREATE INDEX index_6e560c1a4d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_6e64aa1646 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_6e6c2e6a1d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6ea423bbd1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_6ec4c4afd4 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6f4e0abe54 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_6fa47e1334 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_708d792ae9 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_70c657954b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_713f462d76 ON gitlab_partitions_static.issue_search_data_57 USING btree (namespace_id);

CREATE INDEX index_71c0e45eca ON gitlab_partitions_static.issue_search_data_39 USING btree (namespace_id);

CREATE INDEX index_71c2b26944 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_72027c157f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_739845f617 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_74addd1240 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_75dc81d1d7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_765b0cd8db ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_77096a1dc6 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_77c6293242 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_77f67bf238 ON gitlab_partitions_static.issue_search_data_02 USING btree (namespace_id);

CREATE INDEX index_7822759674 ON gitlab_partitions_static.issue_search_data_56 USING btree (namespace_id);

CREATE INDEX index_7a0b7ffadf ON gitlab_partitions_static.issue_search_data_07 USING btree (namespace_id);

CREATE INDEX index_7b7c85eceb ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_7da2307d2e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_7ead2300ca ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_7ecb5b68b4 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_7f543eed8d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_7f8a80dd47 ON gitlab_partitions_static.issue_search_data_49 USING btree (namespace_id);

CREATE INDEX index_80305b1eed ON gitlab_partitions_static.issue_search_data_42 USING btree (namespace_id);

CREATE INDEX index_807671c4be ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_807fa83fc0 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_80a81ac235 ON gitlab_partitions_static.issue_search_data_53 USING btree (namespace_id);

CREATE INDEX index_80c65daf20 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_81b31eafac ON gitlab_partitions_static.issue_search_data_63 USING btree (namespace_id);

CREATE INDEX index_81b9cf594f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_82c675952c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_831e7f124f ON gitlab_partitions_static.issue_search_data_43 USING btree (namespace_id);

CREATE INDEX index_837a193bf2 ON gitlab_partitions_static.issue_search_data_55 USING btree (namespace_id);

CREATE INDEX index_837cc295f1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_83c5049b3e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_83edf231b8 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_844abd2888 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_8464227c80 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_8685d7c69c ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_8688b40056 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_876145d1d5 ON gitlab_partitions_static.issue_search_data_51 USING btree (namespace_id);

CREATE INDEX index_87d40fb9f9 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_88b40d6740 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_89c49cf697 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_89c79afe5c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_8a0fc3de4f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_8a8eb06b9a ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_8b1b6b03b4 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_8b9f9a19a4 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_8c8835ac5e ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 USING btree (relative_path, object_storage_key);

CREATE INDEX index_8fb48e72ce ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_907e12b7ba ON gitlab_partitions_static.issue_search_data_54 USING btree (namespace_id);

CREATE INDEX index_918bb2ebbb ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_91c432a4bd ON gitlab_partitions_static.issue_search_data_16 USING btree (namespace_id);

CREATE INDEX index_91d5e4e3df ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_9201b952a0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_927796f71d ON gitlab_partitions_static.issue_search_data_50 USING btree (namespace_id);

CREATE INDEX index_92c09e352b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_9490e0e0b7 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_9555c2ae92 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_95a353f50b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_971af9481e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_994aa245b7 ON gitlab_partitions_static.issue_search_data_61 USING btree (namespace_id);

CREATE INDEX index_9955b1dc59 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_9a2eb72a3b ON gitlab_partitions_static.issue_search_data_21 USING btree (namespace_id);

CREATE INDEX index_9b8e89ae41 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_9d0e953ab3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_9ee83b068b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a016d4ed08 ON gitlab_partitions_static.issue_search_data_36 USING btree (namespace_id);

CREATE INDEX index_a1a9dc36c1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a2d9f185a5 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a3feed3097 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a46b7b7f26 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_a4f5106804 ON gitlab_partitions_static.issue_search_data_11 USING btree (namespace_id);

CREATE UNIQUE INDEX index_a5d8ab0218 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 USING btree (relative_path, object_storage_key);

CREATE INDEX index_a6999c65c9 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a6c68d16b2 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_a8276a450f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_a849f1bbcc ON gitlab_partitions_static.issue_search_data_62 USING btree (namespace_id);

CREATE INDEX index_a88f20fc98 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a8fe03fe34 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_a9424aa392 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a99cee1904 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_a9b1763c36 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_a9ba23c88e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_a9deff2159 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_aa92d75d85 ON gitlab_partitions_static.issue_search_data_04 USING btree (namespace_id);

CREATE INDEX index_aabc184267 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ab22231a16 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_abbdf80ab1 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_aca42d7cff ON gitlab_partitions_static.issue_search_data_44 USING btree (namespace_id);

CREATE INDEX index_ad55e8b11c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_adc159c3fe ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_aed7f7b10c ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_aee84adb5b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_af8368d587 ON gitlab_partitions_static.issue_search_data_31 USING btree (namespace_id);

CREATE INDEX index_b1dda405af ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_b24e8538c8 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_b286c595e8 ON gitlab_partitions_static.issue_search_data_05 USING btree (namespace_id);

CREATE INDEX index_b377ac6784 ON gitlab_partitions_static.issue_search_data_20 USING btree (namespace_id);

CREATE INDEX index_b3b64068e7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_b3c4c9a53f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_b4b2bba753 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_b607012614 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_b6cc38a848 ON gitlab_partitions_static.issue_search_data_08 USING btree (namespace_id);

CREATE INDEX index_b748a3e0a6 ON gitlab_partitions_static.issue_search_data_15 USING btree (namespace_id);

CREATE INDEX index_b7f21460bb ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_b83fe1306b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_bb41d5837a ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 USING btree (relative_path, object_storage_key);

CREATE INDEX index_bb6defaa27 ON gitlab_partitions_static.issue_search_data_34 USING btree (namespace_id);

CREATE INDEX index_bc189e47ab ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_bca83177ef ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_bcaa8dcd34 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_bcae2cf631 ON gitlab_partitions_static.issue_search_data_00 USING btree (namespace_id);

CREATE INDEX index_be0a028bcc ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_beaa329ca0 ON gitlab_partitions_static.issue_search_data_47 USING btree (namespace_id);

CREATE INDEX index_bedd7e160b ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_bee2b94a80 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_bf1809b19e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_c02f569fba ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_c08e669dfa ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_c09bb66559 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c119f5b92e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c17dae3605 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c1cdd90d0d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c2b951bf20 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c3a2cf8b3b ON gitlab_partitions_static.issue_search_data_32 USING btree (namespace_id);

CREATE INDEX index_c42b2e7eae ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_c435d904ce ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_c473921734 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c546bb0736 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c59cde6209 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c66758baa7 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_c6ea8a0e26 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_c7ac8595d3 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE UNIQUE INDEX index_c7fa6f402d ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 USING btree (relative_path, object_storage_key);

CREATE INDEX index_c8bbf2b334 ON gitlab_partitions_static.issue_search_data_26 USING btree (namespace_id);

CREATE INDEX index_c8c4219c0a ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_c971e6c5ce ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_c9b14a3d9f ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_cb0e4510aa ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 USING btree (relative_path, object_storage_key);

CREATE INDEX index_cb222425ed ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_cbb61ea269 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_cc0ba6343b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ccb4f5c5a6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_cd2b2939a4 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_cda41e106e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_ce87cbaf2d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_cfa4237c83 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_d01ea0126a ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_d03e9cdfae ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_d0d285c264 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_d17b82ddd9 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_d1c24d8199 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_d1c6c67ec1 ON gitlab_partitions_static.issue_search_data_60 USING btree (namespace_id);

CREATE INDEX index_d27b4c84e7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_d2fe918e83 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_d35c969634 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_d3b6418940 ON gitlab_partitions_static.issue_search_data_17 USING btree (namespace_id);

CREATE INDEX index_d493a5c171 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_d6047ee813 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_d69c2485f4 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_d70379e22c ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_d87775b2e7 ON gitlab_partitions_static.issue_search_data_35 USING btree (namespace_id);

CREATE INDEX index_d8fa9793ad ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_d9384b768d ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_db2753330c ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_db6477916f ON gitlab_partitions_static.issue_search_data_28 USING btree (namespace_id);

CREATE INDEX index_dc571ba649 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_dc7ca9eb1d ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 USING btree (relative_path, object_storage_key);

CREATE INDEX index_de0334da63 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_df62a8c50e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_e1a4f994d8 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_e38489ea98 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_e3d1fd5b19 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_e3d6234929 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_e54adf9acb ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_e6405afea0 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_e64588e276 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_e716b8ac3f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_e73bc5ba6a ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_e8f3a327b2 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_ea0c2d3361 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ea1b583157 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_eadcc94c4e ON gitlab_partitions_static.issue_search_data_03 USING btree (namespace_id);

CREATE INDEX index_eb558957f0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_eb5a7f918a ON gitlab_partitions_static.issue_search_data_09 USING btree (namespace_id);

CREATE INDEX index_ec25d494e6 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ece25b5987 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_ed094a4f13 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ed6dbac8c0 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id);

CREATE INDEX index_ee4c549a2d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ef6a48bd29 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_ef7be2ae94 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_efa25b26bd ON gitlab_partitions_static.issue_search_data_25 USING btree (namespace_id);

CREATE INDEX index_f06b4c7a23 ON gitlab_partitions_static.issue_search_data_30 USING btree (namespace_id);

CREATE INDEX index_f0cdd09a5e ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f112fae8ac ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_f1c3d14cdc ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_f256d3f6a1 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f2848acfc7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 USING btree (stage_event_hash_id, group_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_f3d7d86e09 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f402f6a388 ON gitlab_partitions_static.issue_search_data_14 USING btree (namespace_id);

CREATE INDEX index_f415dc2abd ON gitlab_partitions_static.issue_search_data_18 USING btree (namespace_id);

CREATE INDEX index_f47327ec1f ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE UNIQUE INDEX index_f586c952e6 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 USING btree (relative_path, object_storage_key);

CREATE INDEX index_f5f0e8eefd ON gitlab_partitions_static.issue_search_data_37 USING btree (namespace_id);

CREATE INDEX index_f6b0d458a3 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_f705dc8541 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f76e8a5304 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f836021e1e ON gitlab_partitions_static.issue_search_data_13 USING btree (namespace_id);

CREATE INDEX index_f86acdc2ff ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f86f73056d ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_f878aab8e3 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f902c261ce ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 USING btree (stage_event_hash_id, project_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_f91599d825 ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 USING btree (stage_event_hash_id, group_id, end_event_timestamp, merge_request_id);

CREATE INDEX index_fbccc855cf ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 USING btree (stage_event_hash_id, group_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_fbf2d3310b ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_fccbe45c32 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_fee429223e ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 USING btree (stage_event_hash_id, project_id, end_event_timestamp, merge_request_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ff00c038cc ON gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 USING btree (stage_event_hash_id, project_id, start_event_timestamp, merge_request_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_ff39be5400 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 USING btree (stage_event_hash_id, project_id, end_event_timestamp, issue_id, start_event_timestamp) WHERE (end_event_timestamp IS NOT NULL);

CREATE INDEX index_ff8741d8d7 ON gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 USING btree (stage_event_hash_id, group_id, start_event_timestamp, issue_id) WHERE ((end_event_timestamp IS NULL) AND (state_id = 1));

CREATE INDEX index_issue_search_data_on_issue_id ON ONLY issue_search_data USING btree (issue_id);

CREATE INDEX issue_search_data_00_issue_id_idx ON gitlab_partitions_static.issue_search_data_00 USING btree (issue_id);

CREATE INDEX index_issue_search_data_on_search_vector ON ONLY issue_search_data USING gin (search_vector);

CREATE INDEX issue_search_data_00_search_vector_idx ON gitlab_partitions_static.issue_search_data_00 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_01_issue_id_idx ON gitlab_partitions_static.issue_search_data_01 USING btree (issue_id);

CREATE INDEX issue_search_data_01_search_vector_idx ON gitlab_partitions_static.issue_search_data_01 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_02_issue_id_idx ON gitlab_partitions_static.issue_search_data_02 USING btree (issue_id);

CREATE INDEX issue_search_data_02_search_vector_idx ON gitlab_partitions_static.issue_search_data_02 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_03_issue_id_idx ON gitlab_partitions_static.issue_search_data_03 USING btree (issue_id);

CREATE INDEX issue_search_data_03_search_vector_idx ON gitlab_partitions_static.issue_search_data_03 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_04_issue_id_idx ON gitlab_partitions_static.issue_search_data_04 USING btree (issue_id);

CREATE INDEX issue_search_data_04_search_vector_idx ON gitlab_partitions_static.issue_search_data_04 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_05_issue_id_idx ON gitlab_partitions_static.issue_search_data_05 USING btree (issue_id);

CREATE INDEX issue_search_data_05_search_vector_idx ON gitlab_partitions_static.issue_search_data_05 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_06_issue_id_idx ON gitlab_partitions_static.issue_search_data_06 USING btree (issue_id);

CREATE INDEX issue_search_data_06_search_vector_idx ON gitlab_partitions_static.issue_search_data_06 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_07_issue_id_idx ON gitlab_partitions_static.issue_search_data_07 USING btree (issue_id);

CREATE INDEX issue_search_data_07_search_vector_idx ON gitlab_partitions_static.issue_search_data_07 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_08_issue_id_idx ON gitlab_partitions_static.issue_search_data_08 USING btree (issue_id);

CREATE INDEX issue_search_data_08_search_vector_idx ON gitlab_partitions_static.issue_search_data_08 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_09_issue_id_idx ON gitlab_partitions_static.issue_search_data_09 USING btree (issue_id);

CREATE INDEX issue_search_data_09_search_vector_idx ON gitlab_partitions_static.issue_search_data_09 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_10_issue_id_idx ON gitlab_partitions_static.issue_search_data_10 USING btree (issue_id);

CREATE INDEX issue_search_data_10_search_vector_idx ON gitlab_partitions_static.issue_search_data_10 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_11_issue_id_idx ON gitlab_partitions_static.issue_search_data_11 USING btree (issue_id);

CREATE INDEX issue_search_data_11_search_vector_idx ON gitlab_partitions_static.issue_search_data_11 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_12_issue_id_idx ON gitlab_partitions_static.issue_search_data_12 USING btree (issue_id);

CREATE INDEX issue_search_data_12_search_vector_idx ON gitlab_partitions_static.issue_search_data_12 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_13_issue_id_idx ON gitlab_partitions_static.issue_search_data_13 USING btree (issue_id);

CREATE INDEX issue_search_data_13_search_vector_idx ON gitlab_partitions_static.issue_search_data_13 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_14_issue_id_idx ON gitlab_partitions_static.issue_search_data_14 USING btree (issue_id);

CREATE INDEX issue_search_data_14_search_vector_idx ON gitlab_partitions_static.issue_search_data_14 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_15_issue_id_idx ON gitlab_partitions_static.issue_search_data_15 USING btree (issue_id);

CREATE INDEX issue_search_data_15_search_vector_idx ON gitlab_partitions_static.issue_search_data_15 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_16_issue_id_idx ON gitlab_partitions_static.issue_search_data_16 USING btree (issue_id);

CREATE INDEX issue_search_data_16_search_vector_idx ON gitlab_partitions_static.issue_search_data_16 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_17_issue_id_idx ON gitlab_partitions_static.issue_search_data_17 USING btree (issue_id);

CREATE INDEX issue_search_data_17_search_vector_idx ON gitlab_partitions_static.issue_search_data_17 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_18_issue_id_idx ON gitlab_partitions_static.issue_search_data_18 USING btree (issue_id);

CREATE INDEX issue_search_data_18_search_vector_idx ON gitlab_partitions_static.issue_search_data_18 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_19_issue_id_idx ON gitlab_partitions_static.issue_search_data_19 USING btree (issue_id);

CREATE INDEX issue_search_data_19_search_vector_idx ON gitlab_partitions_static.issue_search_data_19 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_20_issue_id_idx ON gitlab_partitions_static.issue_search_data_20 USING btree (issue_id);

CREATE INDEX issue_search_data_20_search_vector_idx ON gitlab_partitions_static.issue_search_data_20 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_21_issue_id_idx ON gitlab_partitions_static.issue_search_data_21 USING btree (issue_id);

CREATE INDEX issue_search_data_21_search_vector_idx ON gitlab_partitions_static.issue_search_data_21 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_22_issue_id_idx ON gitlab_partitions_static.issue_search_data_22 USING btree (issue_id);

CREATE INDEX issue_search_data_22_search_vector_idx ON gitlab_partitions_static.issue_search_data_22 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_23_issue_id_idx ON gitlab_partitions_static.issue_search_data_23 USING btree (issue_id);

CREATE INDEX issue_search_data_23_search_vector_idx ON gitlab_partitions_static.issue_search_data_23 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_24_issue_id_idx ON gitlab_partitions_static.issue_search_data_24 USING btree (issue_id);

CREATE INDEX issue_search_data_24_search_vector_idx ON gitlab_partitions_static.issue_search_data_24 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_25_issue_id_idx ON gitlab_partitions_static.issue_search_data_25 USING btree (issue_id);

CREATE INDEX issue_search_data_25_search_vector_idx ON gitlab_partitions_static.issue_search_data_25 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_26_issue_id_idx ON gitlab_partitions_static.issue_search_data_26 USING btree (issue_id);

CREATE INDEX issue_search_data_26_search_vector_idx ON gitlab_partitions_static.issue_search_data_26 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_27_issue_id_idx ON gitlab_partitions_static.issue_search_data_27 USING btree (issue_id);

CREATE INDEX issue_search_data_27_search_vector_idx ON gitlab_partitions_static.issue_search_data_27 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_28_issue_id_idx ON gitlab_partitions_static.issue_search_data_28 USING btree (issue_id);

CREATE INDEX issue_search_data_28_search_vector_idx ON gitlab_partitions_static.issue_search_data_28 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_29_issue_id_idx ON gitlab_partitions_static.issue_search_data_29 USING btree (issue_id);

CREATE INDEX issue_search_data_29_search_vector_idx ON gitlab_partitions_static.issue_search_data_29 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_30_issue_id_idx ON gitlab_partitions_static.issue_search_data_30 USING btree (issue_id);

CREATE INDEX issue_search_data_30_search_vector_idx ON gitlab_partitions_static.issue_search_data_30 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_31_issue_id_idx ON gitlab_partitions_static.issue_search_data_31 USING btree (issue_id);

CREATE INDEX issue_search_data_31_search_vector_idx ON gitlab_partitions_static.issue_search_data_31 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_32_issue_id_idx ON gitlab_partitions_static.issue_search_data_32 USING btree (issue_id);

CREATE INDEX issue_search_data_32_search_vector_idx ON gitlab_partitions_static.issue_search_data_32 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_33_issue_id_idx ON gitlab_partitions_static.issue_search_data_33 USING btree (issue_id);

CREATE INDEX issue_search_data_33_search_vector_idx ON gitlab_partitions_static.issue_search_data_33 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_34_issue_id_idx ON gitlab_partitions_static.issue_search_data_34 USING btree (issue_id);

CREATE INDEX issue_search_data_34_search_vector_idx ON gitlab_partitions_static.issue_search_data_34 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_35_issue_id_idx ON gitlab_partitions_static.issue_search_data_35 USING btree (issue_id);

CREATE INDEX issue_search_data_35_search_vector_idx ON gitlab_partitions_static.issue_search_data_35 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_36_issue_id_idx ON gitlab_partitions_static.issue_search_data_36 USING btree (issue_id);

CREATE INDEX issue_search_data_36_search_vector_idx ON gitlab_partitions_static.issue_search_data_36 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_37_issue_id_idx ON gitlab_partitions_static.issue_search_data_37 USING btree (issue_id);

CREATE INDEX issue_search_data_37_search_vector_idx ON gitlab_partitions_static.issue_search_data_37 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_38_issue_id_idx ON gitlab_partitions_static.issue_search_data_38 USING btree (issue_id);

CREATE INDEX issue_search_data_38_search_vector_idx ON gitlab_partitions_static.issue_search_data_38 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_39_issue_id_idx ON gitlab_partitions_static.issue_search_data_39 USING btree (issue_id);

CREATE INDEX issue_search_data_39_search_vector_idx ON gitlab_partitions_static.issue_search_data_39 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_40_issue_id_idx ON gitlab_partitions_static.issue_search_data_40 USING btree (issue_id);

CREATE INDEX issue_search_data_40_search_vector_idx ON gitlab_partitions_static.issue_search_data_40 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_41_issue_id_idx ON gitlab_partitions_static.issue_search_data_41 USING btree (issue_id);

CREATE INDEX issue_search_data_41_search_vector_idx ON gitlab_partitions_static.issue_search_data_41 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_42_issue_id_idx ON gitlab_partitions_static.issue_search_data_42 USING btree (issue_id);

CREATE INDEX issue_search_data_42_search_vector_idx ON gitlab_partitions_static.issue_search_data_42 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_43_issue_id_idx ON gitlab_partitions_static.issue_search_data_43 USING btree (issue_id);

CREATE INDEX issue_search_data_43_search_vector_idx ON gitlab_partitions_static.issue_search_data_43 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_44_issue_id_idx ON gitlab_partitions_static.issue_search_data_44 USING btree (issue_id);

CREATE INDEX issue_search_data_44_search_vector_idx ON gitlab_partitions_static.issue_search_data_44 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_45_issue_id_idx ON gitlab_partitions_static.issue_search_data_45 USING btree (issue_id);

CREATE INDEX issue_search_data_45_search_vector_idx ON gitlab_partitions_static.issue_search_data_45 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_46_issue_id_idx ON gitlab_partitions_static.issue_search_data_46 USING btree (issue_id);

CREATE INDEX issue_search_data_46_search_vector_idx ON gitlab_partitions_static.issue_search_data_46 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_47_issue_id_idx ON gitlab_partitions_static.issue_search_data_47 USING btree (issue_id);

CREATE INDEX issue_search_data_47_search_vector_idx ON gitlab_partitions_static.issue_search_data_47 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_48_issue_id_idx ON gitlab_partitions_static.issue_search_data_48 USING btree (issue_id);

CREATE INDEX issue_search_data_48_search_vector_idx ON gitlab_partitions_static.issue_search_data_48 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_49_issue_id_idx ON gitlab_partitions_static.issue_search_data_49 USING btree (issue_id);

CREATE INDEX issue_search_data_49_search_vector_idx ON gitlab_partitions_static.issue_search_data_49 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_50_issue_id_idx ON gitlab_partitions_static.issue_search_data_50 USING btree (issue_id);

CREATE INDEX issue_search_data_50_search_vector_idx ON gitlab_partitions_static.issue_search_data_50 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_51_issue_id_idx ON gitlab_partitions_static.issue_search_data_51 USING btree (issue_id);

CREATE INDEX issue_search_data_51_search_vector_idx ON gitlab_partitions_static.issue_search_data_51 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_52_issue_id_idx ON gitlab_partitions_static.issue_search_data_52 USING btree (issue_id);

CREATE INDEX issue_search_data_52_search_vector_idx ON gitlab_partitions_static.issue_search_data_52 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_53_issue_id_idx ON gitlab_partitions_static.issue_search_data_53 USING btree (issue_id);

CREATE INDEX issue_search_data_53_search_vector_idx ON gitlab_partitions_static.issue_search_data_53 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_54_issue_id_idx ON gitlab_partitions_static.issue_search_data_54 USING btree (issue_id);

CREATE INDEX issue_search_data_54_search_vector_idx ON gitlab_partitions_static.issue_search_data_54 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_55_issue_id_idx ON gitlab_partitions_static.issue_search_data_55 USING btree (issue_id);

CREATE INDEX issue_search_data_55_search_vector_idx ON gitlab_partitions_static.issue_search_data_55 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_56_issue_id_idx ON gitlab_partitions_static.issue_search_data_56 USING btree (issue_id);

CREATE INDEX issue_search_data_56_search_vector_idx ON gitlab_partitions_static.issue_search_data_56 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_57_issue_id_idx ON gitlab_partitions_static.issue_search_data_57 USING btree (issue_id);

CREATE INDEX issue_search_data_57_search_vector_idx ON gitlab_partitions_static.issue_search_data_57 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_58_issue_id_idx ON gitlab_partitions_static.issue_search_data_58 USING btree (issue_id);

CREATE INDEX issue_search_data_58_search_vector_idx ON gitlab_partitions_static.issue_search_data_58 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_59_issue_id_idx ON gitlab_partitions_static.issue_search_data_59 USING btree (issue_id);

CREATE INDEX issue_search_data_59_search_vector_idx ON gitlab_partitions_static.issue_search_data_59 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_60_issue_id_idx ON gitlab_partitions_static.issue_search_data_60 USING btree (issue_id);

CREATE INDEX issue_search_data_60_search_vector_idx ON gitlab_partitions_static.issue_search_data_60 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_61_issue_id_idx ON gitlab_partitions_static.issue_search_data_61 USING btree (issue_id);

CREATE INDEX issue_search_data_61_search_vector_idx ON gitlab_partitions_static.issue_search_data_61 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_62_issue_id_idx ON gitlab_partitions_static.issue_search_data_62 USING btree (issue_id);

CREATE INDEX issue_search_data_62_search_vector_idx ON gitlab_partitions_static.issue_search_data_62 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX issue_search_data_63_issue_id_idx ON gitlab_partitions_static.issue_search_data_63 USING btree (issue_id);

CREATE INDEX issue_search_data_63_search_vector_idx ON gitlab_partitions_static.issue_search_data_63 USING gin (search_vector) WITH (fastupdate='false');

CREATE INDEX index_on_namespace_descendants_outdated ON ONLY namespace_descendants USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_00_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_00 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_01_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_01 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_02_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_02 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_03_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_03 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_04_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_04 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_05_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_05 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_06_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_06 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_07_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_07 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_08_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_08 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_09_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_09 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_10_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_10 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_11_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_11 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_12_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_12 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_13_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_13 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_14_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_14 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_15_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_15 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_16_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_16 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_17_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_17 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_18_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_18 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_19_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_19 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_20_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_20 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_21_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_21 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_22_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_22 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_23_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_23 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_24_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_24 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_25_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_25 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_26_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_26 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_27_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_27 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_28_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_28 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_29_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_29 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_30_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_30 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX namespace_descendants_31_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_31 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL);

CREATE INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ON ONLY virtual_registries_packages_maven_cache_entries USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mav_upstream_id_relative_path_idx10 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mav_upstream_id_relative_path_idx11 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mav_upstream_id_relative_path_idx12 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mav_upstream_id_relative_path_idx13 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mav_upstream_id_relative_path_idx14 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mav_upstream_id_relative_path_idx15 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx1 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx2 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx3 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx4 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx5 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx6 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx7 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx8 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX virtual_registries_packages_mave_upstream_id_relative_path_idx9 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ON ONLY virtual_registries_packages_maven_cache_entries USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven__upstream_id_created_at_idx10 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven__upstream_id_created_at_idx11 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven__upstream_id_created_at_idx12 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven__upstream_id_created_at_idx13 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven__upstream_id_created_at_idx14 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven__upstream_id_created_at_idx15 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx1 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx2 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx3 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx4 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx5 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx6 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx7 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx8 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_c_upstream_id_created_at_idx9 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX virtual_registries_packages_maven_ca_upstream_id_created_at_idx ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 USING btree (upstream_id, created_at) WHERE (status = 0);

CREATE INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ON ONLY virtual_registries_packages_maven_cache_entries USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_e_group_id_status_idx10 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_e_group_id_status_idx11 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_e_group_id_status_idx12 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_e_group_id_status_idx13 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_e_group_id_status_idx14 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_e_group_id_status_idx15 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx1 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx2 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx3 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx4 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx5 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx6 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx7 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx8 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_en_group_id_status_idx9 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 USING btree (group_id, status);

CREATE INDEX virtual_registries_packages_maven_cache_ent_group_id_status_idx ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 USING btree (group_id, status);

CREATE INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ON ONLY virtual_registries_packages_maven_cache_entries USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_ent_relative_path_idx10 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_ent_relative_path_idx11 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_ent_relative_path_idx12 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_ent_relative_path_idx13 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_ent_relative_path_idx14 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_ent_relative_path_idx15 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx1 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx2 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx3 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx4 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx5 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx6 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx7 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx8 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entr_relative_path_idx9 ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_cache_entri_relative_path_idx ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 USING gin (relative_path gin_trgm_ops);

CREATE INDEX virtual_registries_packages_maven_upstream_id_relative_path_idx ON gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00 USING btree (upstream_id, relative_path) WHERE (status = 2);

CREATE INDEX index_uploads_9ba88c4165_on_checksum ON ONLY uploads_9ba88c4165 USING btree (checksum);

CREATE INDEX abuse_report_uploads_checksum_idx ON abuse_report_uploads USING btree (checksum);

CREATE INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ON ONLY uploads_9ba88c4165 USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX abuse_report_uploads_model_id_model_type_uploader_created_a_idx ON abuse_report_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX index_uploads_9ba88c4165_on_namespace_id ON ONLY uploads_9ba88c4165 USING btree (namespace_id);

CREATE INDEX abuse_report_uploads_namespace_id_idx ON abuse_report_uploads USING btree (namespace_id);

CREATE INDEX index_uploads_9ba88c4165_on_organization_id ON ONLY uploads_9ba88c4165 USING btree (organization_id);

CREATE INDEX abuse_report_uploads_organization_id_idx ON abuse_report_uploads USING btree (organization_id);

CREATE INDEX index_uploads_9ba88c4165_on_project_id ON ONLY uploads_9ba88c4165 USING btree (project_id);

CREATE INDEX abuse_report_uploads_project_id_idx ON abuse_report_uploads USING btree (project_id);

CREATE INDEX index_uploads_9ba88c4165_on_store ON ONLY uploads_9ba88c4165 USING btree (store);

CREATE INDEX abuse_report_uploads_store_idx ON abuse_report_uploads USING btree (store);

CREATE INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ON ONLY uploads_9ba88c4165 USING btree (uploaded_by_user_id);

CREATE INDEX abuse_report_uploads_uploaded_by_user_id_idx ON abuse_report_uploads USING btree (uploaded_by_user_id);

CREATE INDEX index_uploads_9ba88c4165_on_uploader_and_path ON ONLY uploads_9ba88c4165 USING btree (uploader, path);

CREATE INDEX abuse_report_uploads_uploader_path_idx ON abuse_report_uploads USING btree (uploader, path);

CREATE INDEX achievement_uploads_checksum_idx ON achievement_uploads USING btree (checksum);

CREATE INDEX achievement_uploads_model_id_model_type_uploader_created_at_idx ON achievement_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX achievement_uploads_namespace_id_idx ON achievement_uploads USING btree (namespace_id);

CREATE INDEX achievement_uploads_organization_id_idx ON achievement_uploads USING btree (organization_id);

CREATE INDEX achievement_uploads_project_id_idx ON achievement_uploads USING btree (project_id);

CREATE INDEX achievement_uploads_store_idx ON achievement_uploads USING btree (store);

CREATE INDEX achievement_uploads_uploaded_by_user_id_idx ON achievement_uploads USING btree (uploaded_by_user_id);

CREATE INDEX achievement_uploads_uploader_path_idx ON achievement_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX add_default_user_assignment_to_user_preferences ON user_preferences USING btree (default_duo_add_on_assignment_id);

CREATE INDEX ai_vectorizable_file_uploads_checksum_idx ON ai_vectorizable_file_uploads USING btree (checksum);

CREATE INDEX ai_vectorizable_file_uploads_model_id_model_type_uploader_c_idx ON ai_vectorizable_file_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX ai_vectorizable_file_uploads_namespace_id_idx ON ai_vectorizable_file_uploads USING btree (namespace_id);

CREATE INDEX ai_vectorizable_file_uploads_organization_id_idx ON ai_vectorizable_file_uploads USING btree (organization_id);

CREATE INDEX ai_vectorizable_file_uploads_project_id_idx ON ai_vectorizable_file_uploads USING btree (project_id);

CREATE INDEX ai_vectorizable_file_uploads_store_idx ON ai_vectorizable_file_uploads USING btree (store);

CREATE INDEX ai_vectorizable_file_uploads_uploaded_by_user_id_idx ON ai_vectorizable_file_uploads USING btree (uploaded_by_user_id);

CREATE INDEX ai_vectorizable_file_uploads_uploader_path_idx ON ai_vectorizable_file_uploads USING btree (uploader, path);

CREATE INDEX alert_management_alert_metric_image_upl_uploaded_by_user_id_idx ON alert_management_alert_metric_image_uploads USING btree (uploaded_by_user_id);

CREATE INDEX alert_management_alert_metric_image_uploads_checksum_idx ON alert_management_alert_metric_image_uploads USING btree (checksum);

CREATE INDEX alert_management_alert_metric_image_uploads_namespace_id_idx ON alert_management_alert_metric_image_uploads USING btree (namespace_id);

CREATE INDEX alert_management_alert_metric_image_uploads_organization_id_idx ON alert_management_alert_metric_image_uploads USING btree (organization_id);

CREATE INDEX alert_management_alert_metric_image_uploads_project_id_idx ON alert_management_alert_metric_image_uploads USING btree (project_id);

CREATE INDEX alert_management_alert_metric_image_uploads_store_idx ON alert_management_alert_metric_image_uploads USING btree (store);

CREATE INDEX alert_management_alert_metric_image_uploads_uploader_path_idx ON alert_management_alert_metric_image_uploads USING btree (uploader, path);

CREATE INDEX alert_management_alert_metric_model_id_model_type_uploader__idx ON alert_management_alert_metric_image_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX analytics_index_audit_events_part_on_created_at_and_author_id ON ONLY audit_events USING btree (created_at, author_id);

CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING btree (created_at, author_id);

CREATE INDEX analytics_repository_languages_on_project_id ON analytics_language_trend_repository_languages USING btree (project_id);

CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_project_rules USING btree (project_id) WHERE (rule_type = 3);

CREATE INDEX appearance_uploads_checksum_idx ON appearance_uploads USING btree (checksum);

CREATE INDEX appearance_uploads_model_id_model_type_uploader_created_at_idx ON appearance_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX appearance_uploads_namespace_id_idx ON appearance_uploads USING btree (namespace_id);

CREATE INDEX appearance_uploads_organization_id_idx ON appearance_uploads USING btree (organization_id);

CREATE INDEX appearance_uploads_project_id_idx ON appearance_uploads USING btree (project_id);

CREATE INDEX appearance_uploads_store_idx ON appearance_uploads USING btree (store);

CREATE INDEX appearance_uploads_uploaded_by_user_id_idx ON appearance_uploads USING btree (uploaded_by_user_id);

CREATE INDEX appearance_uploads_uploader_path_idx ON appearance_uploads USING btree (uploader, path);

CREATE INDEX bulk_import_export_upload_upl_model_id_model_type_uploader__idx ON bulk_import_export_upload_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX bulk_import_export_upload_uploads_checksum_idx ON bulk_import_export_upload_uploads USING btree (checksum);

CREATE INDEX bulk_import_export_upload_uploads_namespace_id_idx ON bulk_import_export_upload_uploads USING btree (namespace_id);

CREATE INDEX bulk_import_export_upload_uploads_organization_id_idx ON bulk_import_export_upload_uploads USING btree (organization_id);

CREATE INDEX bulk_import_export_upload_uploads_project_id_idx ON bulk_import_export_upload_uploads USING btree (project_id);

CREATE INDEX bulk_import_export_upload_uploads_store_idx ON bulk_import_export_upload_uploads USING btree (store);

CREATE INDEX bulk_import_export_upload_uploads_uploaded_by_user_id_idx ON bulk_import_export_upload_uploads USING btree (uploaded_by_user_id);

CREATE INDEX bulk_import_export_upload_uploads_uploader_path_idx ON bulk_import_export_upload_uploads USING btree (uploader, path);

CREATE INDEX bulk_import_export_uploads_batch_id ON bulk_import_export_uploads USING btree (batch_id);

CREATE UNIQUE INDEX bulk_import_trackers_uniq_relation_by_entity ON bulk_import_trackers USING btree (bulk_import_entity_id, relation);

CREATE INDEX ca_aggregations_last_consistency_check_updated_at ON analytics_cycle_analytics_aggregations USING btree (last_consistency_check_updated_at NULLS FIRST) WHERE (enabled IS TRUE);

CREATE INDEX ca_aggregations_last_full_run_at ON analytics_cycle_analytics_aggregations USING btree (last_full_run_at NULLS FIRST) WHERE (enabled IS TRUE);

CREATE INDEX ca_aggregations_last_incremental_run_at ON analytics_cycle_analytics_aggregations USING btree (last_incremental_run_at NULLS FIRST) WHERE (enabled IS TRUE);

CREATE UNIQUE INDEX ci_job_token_scope_links_source_and_target_project_direction ON ci_job_token_project_scope_links USING btree (source_project_id, target_project_id, direction);

CREATE INDEX ci_pipeline_artifacts_on_expire_at_for_removal ON ci_pipeline_artifacts USING btree (expire_at) WHERE ((locked = 0) AND (expire_at IS NOT NULL));

CREATE INDEX index_ci_runner_taggings_on_runner_id_and_runner_type ON ONLY ci_runner_taggings USING btree (runner_id, runner_type);

CREATE INDEX ci_runner_taggings_group_type_runner_id_runner_type_idx ON ci_runner_taggings_group_type USING btree (runner_id, runner_type);

CREATE INDEX index_ci_runner_taggings_on_sharding_key_id ON ONLY ci_runner_taggings USING btree (sharding_key_id);

CREATE INDEX ci_runner_taggings_group_type_sharding_key_id_idx ON ci_runner_taggings_group_type USING btree (sharding_key_id);

CREATE UNIQUE INDEX index_ci_runner_taggings_on_tag_id_runner_id_and_runner_type ON ONLY ci_runner_taggings USING btree (tag_id, runner_id, runner_type);

CREATE UNIQUE INDEX ci_runner_taggings_group_type_tag_id_runner_id_runner_type_idx ON ci_runner_taggings_group_type USING btree (tag_id, runner_id, runner_type);

CREATE UNIQUE INDEX ci_runner_taggings_instance_ty_tag_id_runner_id_runner_type_idx ON ci_runner_taggings_instance_type USING btree (tag_id, runner_id, runner_type);

CREATE INDEX ci_runner_taggings_instance_type_runner_id_runner_type_idx ON ci_runner_taggings_instance_type USING btree (runner_id, runner_type);

CREATE INDEX ci_runner_taggings_instance_type_sharding_key_id_idx ON ci_runner_taggings_instance_type USING btree (sharding_key_id);

CREATE UNIQUE INDEX ci_runner_taggings_project_typ_tag_id_runner_id_runner_type_idx ON ci_runner_taggings_project_type USING btree (tag_id, runner_id, runner_type);

CREATE INDEX ci_runner_taggings_project_type_runner_id_runner_type_idx ON ci_runner_taggings_project_type USING btree (runner_id, runner_type);

CREATE INDEX ci_runner_taggings_project_type_sharding_key_id_idx ON ci_runner_taggings_project_type USING btree (sharding_key_id);

CREATE INDEX code_owner_approval_required ON protected_branches USING btree (project_id, code_owner_approval_required) WHERE (code_owner_approval_required = true);

CREATE UNIQUE INDEX commit_user_mentions_on_commit_id_and_note_id_unique_index ON commit_user_mentions USING btree (commit_id, note_id);

CREATE UNIQUE INDEX custom_email_unique_constraint ON service_desk_settings USING btree (custom_email);

CREATE UNIQUE INDEX dast_scanner_profiles_builds_on_ci_build_id ON dast_scanner_profiles_builds USING btree (ci_build_id);

CREATE UNIQUE INDEX dast_site_profiles_builds_on_ci_build_id ON dast_site_profiles_builds USING btree (ci_build_id);

CREATE INDEX dependency_list_export_part_u_model_id_model_type_uploader__idx ON dependency_list_export_part_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX dependency_list_export_part_uploads_checksum_idx ON dependency_list_export_part_uploads USING btree (checksum);

CREATE INDEX dependency_list_export_part_uploads_namespace_id_idx ON dependency_list_export_part_uploads USING btree (namespace_id);

CREATE INDEX dependency_list_export_part_uploads_organization_id_idx ON dependency_list_export_part_uploads USING btree (organization_id);

CREATE INDEX dependency_list_export_part_uploads_project_id_idx ON dependency_list_export_part_uploads USING btree (project_id);

CREATE INDEX dependency_list_export_part_uploads_store_idx ON dependency_list_export_part_uploads USING btree (store);

CREATE INDEX dependency_list_export_part_uploads_uploaded_by_user_id_idx ON dependency_list_export_part_uploads USING btree (uploaded_by_user_id);

CREATE INDEX dependency_list_export_part_uploads_uploader_path_idx ON dependency_list_export_part_uploads USING btree (uploader, path);

CREATE INDEX dependency_list_export_upload_model_id_model_type_uploader__idx ON dependency_list_export_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX dependency_list_export_uploads_checksum_idx ON dependency_list_export_uploads USING btree (checksum);

CREATE INDEX dependency_list_export_uploads_namespace_id_idx ON dependency_list_export_uploads USING btree (namespace_id);

CREATE INDEX dependency_list_export_uploads_organization_id_idx ON dependency_list_export_uploads USING btree (organization_id);

CREATE INDEX dependency_list_export_uploads_project_id_idx ON dependency_list_export_uploads USING btree (project_id);

CREATE INDEX dependency_list_export_uploads_store_idx ON dependency_list_export_uploads USING btree (store);

CREATE INDEX dependency_list_export_uploads_uploaded_by_user_id_idx ON dependency_list_export_uploads USING btree (uploaded_by_user_id);

CREATE INDEX dependency_list_export_uploads_uploader_path_idx ON dependency_list_export_uploads USING btree (uploader, path);

CREATE INDEX design_management_action_uplo_model_id_model_type_uploader__idx ON design_management_action_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX design_management_action_uploads_checksum_idx ON design_management_action_uploads USING btree (checksum);

CREATE INDEX design_management_action_uploads_namespace_id_idx ON design_management_action_uploads USING btree (namespace_id);

CREATE INDEX design_management_action_uploads_organization_id_idx ON design_management_action_uploads USING btree (organization_id);

CREATE INDEX design_management_action_uploads_project_id_idx ON design_management_action_uploads USING btree (project_id);

CREATE INDEX design_management_action_uploads_store_idx ON design_management_action_uploads USING btree (store);

CREATE INDEX design_management_action_uploads_uploaded_by_user_id_idx ON design_management_action_uploads USING btree (uploaded_by_user_id);

CREATE INDEX design_management_action_uploads_uploader_path_idx ON design_management_action_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX design_management_designs_versions_uniqueness ON design_management_designs_versions USING btree (design_id, version_id);

CREATE UNIQUE INDEX design_user_mentions_on_design_id_and_note_id_unique_index ON design_user_mentions USING btree (design_id, note_id);

CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user_mentions USING btree (epic_id, note_id);

CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL);

CREATE UNIQUE INDEX finding_evidences_on_unique_vulnerability_occurrence_id ON vulnerability_finding_evidences USING btree (vulnerability_occurrence_id);

CREATE UNIQUE INDEX finding_link_name_url_idx ON vulnerability_finding_links USING btree (vulnerability_occurrence_id, name, url);

CREATE UNIQUE INDEX finding_link_url_idx ON vulnerability_finding_links USING btree (vulnerability_occurrence_id, url) WHERE (name IS NULL);

CREATE INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ON ONLY ci_runner_machines USING btree (contacted_at DESC, id DESC);

CREATE INDEX group_type_ci_runner_machines_687967fa8a_contacted_at_id_idx ON group_type_ci_runner_machines USING btree (contacted_at DESC, id DESC);

CREATE INDEX index_ci_runner_machines_on_created_at_and_id_desc ON ONLY ci_runner_machines USING btree (created_at, id DESC);

CREATE INDEX group_type_ci_runner_machines_687967fa8a_created_at_id_idx ON group_type_ci_runner_machines USING btree (created_at, id DESC);

CREATE INDEX index_ci_runner_machines_on_sharding_key_id_when_not_null ON ONLY ci_runner_machines USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX group_type_ci_runner_machines_687967fa8a_sharding_key_id_idx ON group_type_ci_runner_machines USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX index_ci_runner_machines_on_version ON ONLY ci_runner_machines USING btree (version);

CREATE INDEX group_type_ci_runner_machines_687967fa8a_version_idx ON group_type_ci_runner_machines USING btree (version);

CREATE INDEX index_ci_runner_machines_on_major_version ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);

CREATE INDEX group_type_ci_runner_machines_6_substring_version_runner_id_idx ON group_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);

CREATE INDEX index_ci_runner_machines_on_minor_version ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);

CREATE INDEX group_type_ci_runner_machines__substring_version_runner_id_idx1 ON group_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);

CREATE INDEX index_ci_runner_machines_on_patch_version ON ONLY ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);

CREATE INDEX group_type_ci_runner_machines__substring_version_runner_id_idx2 ON group_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);

CREATE UNIQUE INDEX index_ci_runner_machines_on_runner_id_and_type_and_system_xid ON ONLY ci_runner_machines USING btree (runner_id, runner_type, system_xid);

CREATE UNIQUE INDEX group_type_ci_runner_machines_runner_id_runner_type_system__idx ON group_type_ci_runner_machines USING btree (runner_id, runner_type, system_xid);

CREATE UNIQUE INDEX index_ci_runners_on_token_encrypted_and_runner_type ON ONLY ci_runners USING btree (token_encrypted, runner_type);

CREATE UNIQUE INDEX group_type_ci_runners_e59bb2812_token_encrypted_runner_type_idx ON group_type_ci_runners USING btree (token_encrypted, runner_type);

CREATE INDEX index_ci_runners_on_active_and_id ON ONLY ci_runners USING btree (active, id);

CREATE INDEX group_type_ci_runners_e59bb2812d_active_id_idx ON group_type_ci_runners USING btree (active, id);

CREATE INDEX index_ci_runners_on_contacted_at_and_id_desc ON ONLY ci_runners USING btree (contacted_at, id DESC);

CREATE INDEX group_type_ci_runners_e59bb2812d_contacted_at_id_idx ON group_type_ci_runners USING btree (contacted_at, id DESC);

CREATE INDEX index_ci_runners_on_contacted_at_and_id_where_inactive ON ONLY ci_runners USING btree (contacted_at DESC, id DESC) WHERE (active = false);

CREATE INDEX group_type_ci_runners_e59bb2812d_contacted_at_id_idx1 ON group_type_ci_runners USING btree (contacted_at DESC, id DESC) WHERE (active = false);

CREATE INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ON ONLY ci_runners USING btree (contacted_at DESC, id DESC);

CREATE INDEX group_type_ci_runners_e59bb2812d_contacted_at_id_idx2 ON group_type_ci_runners USING btree (contacted_at DESC, id DESC);

CREATE INDEX index_ci_runners_on_created_at_and_id_desc ON ONLY ci_runners USING btree (created_at, id DESC);

CREATE INDEX group_type_ci_runners_e59bb2812d_created_at_id_idx ON group_type_ci_runners USING btree (created_at, id DESC);

CREATE INDEX index_ci_runners_on_created_at_and_id_where_inactive ON ONLY ci_runners USING btree (created_at DESC, id DESC) WHERE (active = false);

CREATE INDEX group_type_ci_runners_e59bb2812d_created_at_id_idx1 ON group_type_ci_runners USING btree (created_at DESC, id DESC) WHERE (active = false);

CREATE INDEX index_ci_runners_on_created_at_desc_and_id_desc ON ONLY ci_runners USING btree (created_at DESC, id DESC);

CREATE INDEX group_type_ci_runners_e59bb2812d_created_at_id_idx2 ON group_type_ci_runners USING btree (created_at DESC, id DESC);

CREATE INDEX index_ci_runners_on_creator_id_where_creator_id_not_null ON ONLY ci_runners USING btree (creator_id) WHERE (creator_id IS NOT NULL);

CREATE INDEX group_type_ci_runners_e59bb2812d_creator_id_idx ON group_type_ci_runners USING btree (creator_id) WHERE (creator_id IS NOT NULL);

CREATE INDEX index_ci_runners_on_description_trigram ON ONLY ci_runners USING gin (description gin_trgm_ops);

CREATE INDEX group_type_ci_runners_e59bb2812d_description_idx ON group_type_ci_runners USING gin (description gin_trgm_ops);

CREATE INDEX index_ci_runners_on_locked ON ONLY ci_runners USING btree (locked);

CREATE INDEX group_type_ci_runners_e59bb2812d_locked_idx ON group_type_ci_runners USING btree (locked);

CREATE INDEX index_ci_runners_on_sharding_key_id_when_not_null ON ONLY ci_runners USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX group_type_ci_runners_e59bb2812d_sharding_key_id_idx ON group_type_ci_runners USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX index_ci_runners_on_token_expires_at_and_id_desc ON ONLY ci_runners USING btree (token_expires_at, id DESC);

CREATE INDEX group_type_ci_runners_e59bb2812d_token_expires_at_id_idx ON group_type_ci_runners USING btree (token_expires_at, id DESC);

CREATE INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ON ONLY ci_runners USING btree (token_expires_at DESC, id DESC);

CREATE INDEX group_type_ci_runners_e59bb2812d_token_expires_at_id_idx1 ON group_type_ci_runners USING btree (token_expires_at DESC, id DESC);

CREATE UNIQUE INDEX index_ci_runners_on_token_and_runner_type_when_token_not_null ON ONLY ci_runners USING btree (token, runner_type) WHERE (token IS NOT NULL);

CREATE UNIQUE INDEX group_type_ci_runners_e59bb2812d_token_runner_type_idx ON group_type_ci_runners USING btree (token, runner_type) WHERE (token IS NOT NULL);

CREATE UNIQUE INDEX i_affected_packages_unique_for_upsert ON pm_affected_packages USING btree (pm_advisory_id, purl_type, package_name, distro_version);

CREATE INDEX i_batched_background_migration_job_transition_logs_on_job_id ON ONLY batched_background_migration_job_transition_logs USING btree (batched_background_migration_job_id);

CREATE UNIQUE INDEX i_bulk_import_export_batches_id_batch_number ON bulk_import_export_batches USING btree (export_id, batch_number);

CREATE UNIQUE INDEX i_bulk_import_trackers_id_batch_number ON bulk_import_batch_trackers USING btree (tracker_id, batch_number);

CREATE UNIQUE INDEX i_ci_job_token_group_scope_links_on_source_and_target_project ON ci_job_token_group_scope_links USING btree (source_project_id, target_group_id);

CREATE INDEX i_compliance_frameworks_on_id_and_created_at ON compliance_management_frameworks USING btree (id, created_at, pipeline_configuration_full_path);

CREATE INDEX i_compliance_standards_adherence_on_namespace_id_and_proj_id ON project_compliance_standards_adherence USING btree (namespace_id, project_id DESC, id DESC);

CREATE INDEX i_compliance_violations_for_export ON merge_requests_compliance_violations USING btree (target_project_id, id);

CREATE INDEX i_compliance_violations_on_project_id_merged_at_and_id ON merge_requests_compliance_violations USING btree (target_project_id, merged_at, id);

CREATE INDEX i_compliance_violations_on_project_id_reason_and_id ON merge_requests_compliance_violations USING btree (target_project_id, reason, id);

CREATE INDEX i_compliance_violations_on_project_id_severity_and_id ON merge_requests_compliance_violations USING btree (target_project_id, severity_level DESC, id DESC);

CREATE INDEX i_compliance_violations_on_project_id_title_and_id ON merge_requests_compliance_violations USING btree (target_project_id, title, id);

CREATE UNIQUE INDEX i_container_protection_unique_project_repository_path_pattern ON container_registry_protection_rules USING btree (project_id, repository_path_pattern);

CREATE INDEX i_custom_email_verifications_on_triggered_at_and_state_started ON service_desk_custom_email_verifications USING btree (triggered_at) WHERE (state = 0);

CREATE INDEX i_dast_pre_scan_verification_steps_on_pre_scan_verification_id ON dast_pre_scan_verification_steps USING btree (dast_pre_scan_verification_id);

CREATE INDEX i_dast_profiles_tags_on_scanner_profiles_id ON dast_profiles_tags USING btree (dast_profile_id);

CREATE UNIQUE INDEX i_duo_workflows_events_on_correlation_id ON duo_workflows_events USING btree (correlation_id_value);

CREATE INDEX i_gitlab_subscription_histories_on_namespace_change_type_plan ON gitlab_subscription_histories USING btree (namespace_id, change_type, hosted_plan_id);

CREATE UNIQUE INDEX i_maven_reg_upstreams_on_upstream_and_registry_ids ON virtual_registries_packages_maven_registry_upstreams USING btree (upstream_id, registry_id);

CREATE INDEX i_namespace_cluster_agent_mappings_on_cluster_agent_id ON namespace_cluster_agent_mappings USING btree (cluster_agent_id);

CREATE INDEX i_namespace_cluster_agent_mappings_on_creator_id ON namespace_cluster_agent_mappings USING btree (creator_id);

CREATE INDEX i_organization_cluster_agent_mappings_on_creator_id ON organization_cluster_agent_mappings USING btree (creator_id);

CREATE INDEX i_organization_cluster_agent_mappings_on_organization_id ON organization_cluster_agent_mappings USING btree (organization_id);

CREATE UNIQUE INDEX i_organization_cluster_agent_mappings_unique_cluster_agent_id ON organization_cluster_agent_mappings USING btree (cluster_agent_id);

CREATE UNIQUE INDEX i_packages_unique_project_id_package_type_package_name_pattern ON packages_protection_rules USING btree (project_id, package_type, package_name_pattern);

CREATE INDEX i_pkgs_deb_file_meta_on_updated_at_package_file_id_when_unknown ON packages_debian_file_metadata USING btree (updated_at, package_file_id) WHERE (file_type = 1);

CREATE UNIQUE INDEX i_pm_licenses_on_spdx_identifier ON pm_licenses USING btree (spdx_identifier);

CREATE UNIQUE INDEX i_pm_package_version_licenses_join_ids ON pm_package_version_licenses USING btree (pm_package_version_id, pm_license_id);

CREATE UNIQUE INDEX i_pm_package_versions_on_package_id_and_version ON pm_package_versions USING btree (pm_package_id, version);

CREATE UNIQUE INDEX i_pm_packages_purl_type_and_name ON pm_packages USING btree (purl_type, name);

CREATE INDEX i_project_compliance_violations_on_namespace_id_created_at_id ON project_compliance_violations USING btree (namespace_id, created_at DESC, id DESC);

CREATE INDEX i_project_requirement_statuses_on_namespace_id_framework_id ON project_requirement_compliance_statuses USING btree (namespace_id, compliance_framework_id, id);

CREATE INDEX i_project_requirement_statuses_on_namespace_id_project_id ON project_requirement_compliance_statuses USING btree (namespace_id, project_id, id);

CREATE INDEX i_project_requirement_statuses_on_namespace_id_requirement_id ON project_requirement_compliance_statuses USING btree (namespace_id, compliance_requirement_id, id);

CREATE INDEX i_project_requirement_statuses_on_namespace_id_updated_at_id ON project_requirement_compliance_statuses USING btree (namespace_id, updated_at DESC, id DESC);

CREATE INDEX i_protected_branch_unprotect_access_levels_protected_branch_nam ON protected_branch_unprotect_access_levels USING btree (protected_branch_namespace_id);

CREATE INDEX i_protected_branch_unprotect_access_levels_protected_branch_pro ON protected_branch_unprotect_access_levels USING btree (protected_branch_project_id);

CREATE INDEX i_resource_iteration_events_on_triggered_by_id ON resource_iteration_events USING btree (triggered_by_id);

CREATE UNIQUE INDEX i_sbom_occurrences_vulnerabilities_on_occ_id_and_vuln_id ON sbom_occurrences_vulnerabilities USING btree (sbom_occurrence_id, vulnerability_id);

CREATE INDEX i_software_license_policies_on_custom_software_license_id ON software_license_policies USING btree (custom_software_license_id);

CREATE UNIQUE INDEX i_uniq_external_control_name_per_requirement ON compliance_requirements_controls USING btree (compliance_requirement_id, external_control_name) WHERE ((external_control_name IS NOT NULL) AND (external_control_name <> ''::text));

CREATE INDEX i_vuln_occurrences_on_proj_report_loc_dep_pkg_ver_file_img ON vulnerability_occurrences USING btree (project_id, report_type, ((((location -> 'dependency'::text) -> 'package'::text) ->> 'name'::text)), (((location -> 'dependency'::text) ->> 'version'::text)), COALESCE((location ->> 'file'::text), (location ->> 'image'::text))) WHERE (report_type = ANY (ARRAY[2, 1]));

CREATE INDEX idx_abuse_reports_user_id_status_and_category ON abuse_reports USING btree (user_id, status, category);

CREATE INDEX idx_addon_purchases_on_last_refreshed_at_desc_nulls_last ON subscription_add_on_purchases USING btree (last_assigned_users_refreshed_at DESC NULLS LAST);

CREATE INDEX idx_ai_active_context_code_enabled_namespaces_namespace_id ON ONLY p_ai_active_context_code_enabled_namespaces USING btree (namespace_id);

CREATE UNIQUE INDEX idx_ai_catalog_item_version_unique ON ai_catalog_item_versions USING btree (ai_catalog_item_id, version);

CREATE INDEX idx_ai_code_repository_project_id_state ON ONLY p_ai_active_context_code_repositories USING btree (project_id, state);

CREATE UNIQUE INDEX idx_ai_usage_events_unique_tuple ON ONLY ai_usage_events USING btree (namespace_id, user_id, event, "timestamp");

CREATE INDEX idx_alert_management_alerts_on_created_at_project_id_with_issue ON alert_management_alerts USING btree (created_at, project_id) WHERE (issue_id IS NOT NULL);

CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id);

CREATE INDEX idx_analytics_devops_adoption_snapshots_finalized ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time) WHERE (recorded_at >= end_time);

CREATE INDEX idx_approval_merge_request_rules_approved_approvers_project_id ON approval_merge_request_rules_approved_approvers USING btree (project_id);

CREATE INDEX idx_approval_merge_request_rules_on_mr_id_config_id_and_id ON approval_merge_request_rules USING btree (merge_request_id, security_orchestration_policy_configuration_id, id);

CREATE INDEX idx_approval_merge_request_rules_on_scan_result_policy_id ON approval_merge_request_rules USING btree (scan_result_policy_id);

CREATE INDEX idx_approval_mr_rules_on_config_id_and_id_and_updated_at ON approval_merge_request_rules USING btree (security_orchestration_policy_configuration_id, id, updated_at);

CREATE INDEX idx_approval_policy_rule_project_links_on_project_id_and_id ON approval_policy_rule_project_links USING btree (project_id, id);

CREATE INDEX idx_approval_policy_rules_security_policy_id_id ON approval_policy_rules USING btree (security_policy_id, id);

CREATE INDEX idx_approval_project_rules_on_config_id_and_policy_rule_id ON approval_project_rules USING btree (security_orchestration_policy_configuration_id, approval_policy_rule_id);

CREATE INDEX idx_approval_project_rules_on_configuration_id_and_id ON approval_project_rules USING btree (security_orchestration_policy_configuration_id, id);

CREATE INDEX idx_approval_project_rules_on_scan_result_policy_id ON approval_project_rules USING btree (scan_result_policy_id);

CREATE INDEX idx_audit_events_namespace_event_type_filters_on_group_id ON audit_events_group_streaming_event_type_filters USING btree (namespace_id);

CREATE INDEX idx_audit_events_part_on_entity_id_desc_author_id_created_at ON ONLY audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at);

CREATE INDEX idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id ON award_emoji USING btree (user_id, name, awardable_type, awardable_id);

CREATE INDEX idx_branch_rules_mr_approval_settings_on_project_id ON projects_branch_rules_merge_request_approval_settings USING btree (project_id);

CREATE UNIQUE INDEX idx_branch_rules_mr_approval_settings_on_protected_branch_id ON projects_branch_rules_merge_request_approval_settings USING btree (protected_branch_id);

CREATE INDEX idx_build_artifacts_size_refreshes_state_updated_at ON project_build_artifacts_size_refreshes USING btree (state, updated_at);

CREATE INDEX idx_catalog_resource_cpmt_last_usages_on_cpmt_project_id ON catalog_resource_component_last_usages USING btree (component_project_id);

CREATE UNIQUE INDEX idx_ci_job_token_authorizations_on_accessed_and_origin_project ON ci_job_token_authorizations USING btree (accessed_project_id, origin_project_id);

CREATE INDEX idx_ci_running_builds_on_runner_type_and_owner_xid_and_id ON ci_running_builds USING btree (runner_type, runner_owner_namespace_xid, runner_id);

CREATE INDEX idx_compliance_requirements_controls_on_namespace_id ON compliance_requirements_controls USING btree (namespace_id);

CREATE INDEX idx_compliance_requirements_controls_on_requirement_id ON compliance_requirements_controls USING btree (compliance_requirement_id);

CREATE INDEX idx_compliance_security_policies_on_framework_id ON compliance_framework_security_policies USING btree (framework_id);

CREATE INDEX idx_compliance_security_policies_on_policy_configuration_id ON compliance_framework_security_policies USING btree (policy_configuration_id);

CREATE INDEX idx_compliance_security_policies_on_security_policy_and_id ON compliance_framework_security_policies USING btree (security_policy_id, id);

CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at ON container_expiration_policies USING btree (project_id, next_run_at) WHERE (enabled = true);

CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled);

CREATE INDEX idx_container_registry_protection_tag_rules_on_min_access_level ON container_registry_protection_tag_rules USING btree (project_id, minimum_access_level_for_push, minimum_access_level_for_delete);

CREATE INDEX idx_container_repos_on_exp_cleanup_status_project_id_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, project_id, expiration_policy_started_at);

CREATE INDEX idx_cpmt_last_usages_on_catalog_resource_id ON catalog_resource_component_last_usages USING btree (catalog_resource_id);

CREATE UNIQUE INDEX idx_custom_field_select_options_on_custom_field_id_lower_value ON custom_field_select_options USING btree (custom_field_id, lower(value));

CREATE UNIQUE INDEX idx_custom_fields_on_namespace_id_and_lower_name ON custom_fields USING btree (namespace_id, lower(name));

CREATE INDEX idx_custom_software_licenses_lower_name ON custom_software_licenses USING btree (lower(name));

CREATE INDEX idx_deletions_on_project_id_and_id_where_pending ON ONLY p_batched_git_ref_updates_deletions USING btree (project_id, id) WHERE (status = 1);

CREATE INDEX idx_dep_proxy_pkgs_settings_enabled_maven_on_project_id ON dependency_proxy_packages_settings USING btree (project_id) WHERE ((enabled = true) AND (maven_external_registry_url IS NOT NULL));

CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace);

CREATE INDEX idx_description_versions_on_namespace_id ON description_versions USING btree (namespace_id);

CREATE INDEX idx_devops_adoption_segments_namespace_end_time ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time);

CREATE INDEX idx_devops_adoption_segments_namespace_recorded_at ON analytics_devops_adoption_snapshots USING btree (namespace_id, recorded_at);

CREATE UNIQUE INDEX idx_devops_adoption_segments_namespaces_pair ON analytics_devops_adoption_segments USING btree (display_namespace_id, namespace_id);

CREATE INDEX idx_elastic_reindexing_slices_on_elastic_reindexing_subtask_id ON elastic_reindexing_slices USING btree (elastic_reindexing_subtask_id);

CREATE INDEX idx_enabled_pkgs_cleanup_policies_on_next_run_at_project_id ON packages_cleanup_policies USING btree (next_run_at, project_id) WHERE (keep_n_duplicated_package_files <> 'all'::text);

CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_merge_requests USING btree (environment_id, merge_request_id);

CREATE UNIQUE INDEX idx_external_audit_event_destination_id_key_uniq ON audit_events_streaming_headers USING btree (key, external_audit_event_destination_id);

CREATE INDEX idx_external_status_checks_on_id_and_project_id ON external_status_checks USING btree (id, project_id);

CREATE INDEX idx_gitlab_hosted_runner_monthly_usages_on_billing_month_year ON ci_gitlab_hosted_runner_monthly_usages USING btree (EXTRACT(year FROM billing_month));

CREATE INDEX idx_gpg_keys_on_user_externally_verified ON gpg_keys USING btree (user_id) WHERE (externally_verified = true);

CREATE INDEX idx_group_audit_events_on_author_id_created_at_id ON ONLY group_audit_events USING btree (author_id, created_at, id);

CREATE INDEX idx_group_audit_events_on_group_id_author_created_at_id ON ONLY group_audit_events USING btree (group_id, author_id, created_at, id DESC);

CREATE INDEX idx_group_audit_events_on_project_created_at_id ON ONLY group_audit_events USING btree (group_id, created_at, id);

CREATE INDEX idx_headers_instance_external_audit_event_destination_id ON instance_audit_events_streaming_headers USING btree (instance_external_audit_event_destination_id);

CREATE INDEX idx_hosted_runner_usage_on_namespace_billing_month ON ci_gitlab_hosted_runner_monthly_usages USING btree (root_namespace_id, billing_month);

CREATE INDEX idx_hosted_runner_usage_on_project_billing_month ON ci_gitlab_hosted_runner_monthly_usages USING btree (project_id, billing_month);

CREATE UNIQUE INDEX idx_hosted_runner_usage_unique ON ci_gitlab_hosted_runner_monthly_usages USING btree (runner_id, billing_month, root_namespace_id, project_id);

CREATE INDEX idx_import_export_uploads_updated_at_id_import_file ON import_export_uploads USING btree (updated_at, id) WHERE (import_file IS NOT NULL);

CREATE UNIQUE INDEX idx_import_placeholder_memberships_on_source_user_group_id ON import_placeholder_memberships USING btree (source_user_id, group_id);

CREATE INDEX idx_import_placeholder_memberships_on_source_user_id_and_id ON import_placeholder_memberships USING btree (source_user_id, id);

CREATE UNIQUE INDEX idx_import_placeholder_memberships_on_source_user_project_id ON import_placeholder_memberships USING btree (source_user_id, project_id);

CREATE INDEX idx_import_source_user_placeholder_references_on_user_model_id ON import_source_user_placeholder_references USING btree (source_user_id, model, user_reference_column, alias_version, id);

CREATE INDEX idx_incident_management_pending_alert_escalations_on_project_id ON ONLY incident_management_pending_alert_escalations USING btree (project_id);

CREATE INDEX idx_incident_management_pending_issue_esc_on_namespace_id ON ONLY incident_management_pending_issue_escalations USING btree (namespace_id);

CREATE INDEX idx_incident_management_timeline_event_tag_links_on_project_id ON incident_management_timeline_event_tag_links USING btree (project_id);

CREATE INDEX idx_installable_conan_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id) WHERE ((package_type = 3) AND (status = ANY (ARRAY[0, 1])));

CREATE INDEX idx_installable_helm_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id);

CREATE INDEX idx_installable_npm_pkgs_on_project_id_name_version_id ON packages_packages USING btree (project_id, name, version, id) WHERE ((package_type = 2) AND (status = 0));

CREATE INDEX idx_instance_audit_events_on_author_id_created_at_id ON ONLY instance_audit_events USING btree (author_id, created_at, id);

CREATE UNIQUE INDEX idx_instance_external_audit_event_destination_id_key_uniq ON instance_audit_events_streaming_headers USING btree (instance_external_audit_event_destination_id, key);

CREATE UNIQUE INDEX idx_instance_runner_usage_unique ON ci_instance_runner_monthly_usages USING btree (runner_id, billing_month, root_namespace_id, project_id);

CREATE INDEX idx_issues_on_health_status_not_null ON issues USING btree (health_status) WHERE (health_status IS NOT NULL);

CREATE INDEX idx_issues_on_project_id_and_created_at_and_id_and_state_id ON issues USING btree (project_id, created_at, id, state_id);

CREATE INDEX idx_issues_on_project_id_and_due_date_and_id_and_state_id ON issues USING btree (project_id, due_date, id, state_id) WHERE (due_date IS NOT NULL);

CREATE INDEX idx_issues_on_project_id_and_rel_position_and_id_and_state_id ON issues USING btree (project_id, relative_position, id, state_id);

CREATE INDEX idx_issues_on_project_id_and_updated_at_and_id_and_state_id ON issues USING btree (project_id, updated_at, id, state_id);

CREATE INDEX idx_issues_on_project_work_item_type_closed_at_where_closed ON issues USING btree (project_id, work_item_type_id, closed_at) WHERE (state_id = 2);

CREATE UNIQUE INDEX idx_jira_connect_subscriptions_on_installation_id_namespace_id ON jira_connect_subscriptions USING btree (jira_connect_installation_id, namespace_id);

CREATE INDEX idx_keys_expires_at_and_before_expiry_notification_undelivered ON keys USING btree (date(timezone('UTC'::text, expires_at)), before_expiry_notification_delivered_at) WHERE (before_expiry_notification_delivered_at IS NULL);

CREATE UNIQUE INDEX idx_lifecycle_statuses_on_lifecycle_and_status ON work_item_custom_lifecycle_statuses USING btree (lifecycle_id, status_id);

CREATE INDEX idx_member_roles_on_base_access_level ON member_roles USING btree (base_access_level);

CREATE INDEX idx_members_created_at_user_id_invite_token ON members USING btree (created_at) WHERE ((invite_token IS NOT NULL) AND (user_id IS NULL));

CREATE UNIQUE INDEX idx_members_deletion_schedules_on_namespace_id_and_user_id ON members_deletion_schedules USING btree (namespace_id, user_id);

CREATE INDEX idx_members_on_user_and_source_and_source_type_and_member_role ON members USING btree (user_id, source_id, source_type, member_role_id);

CREATE INDEX idx_merge_request_metrics_on_merged_by_project_and_mr ON merge_request_metrics USING btree (merged_by_id, target_project_id, merge_request_id);

CREATE INDEX idx_merge_requests_on_id_and_merge_jid ON merge_requests USING btree (id, merge_jid) WHERE ((merge_jid IS NOT NULL) AND (state_id = 4));

CREATE INDEX idx_merge_requests_on_merged_state ON merge_requests USING btree (id) WHERE (state_id = 3);

CREATE INDEX idx_merge_requests_on_source_project_and_branch_state_opened ON merge_requests USING btree (source_project_id, source_branch) WHERE (state_id = 1);

CREATE INDEX idx_merge_requests_on_unmerged_state_id ON merge_requests USING btree (id) WHERE (state_id <> 3);

CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_commit_diff_files USING btree (merge_request_context_commit_id, sha);

CREATE INDEX idx_mrs_on_target_id_and_created_at_and_state_id ON merge_requests USING btree (target_project_id, state_id, created_at, id);

CREATE UNIQUE INDEX idx_namespace_feature_settings_on_namespace_id_and_feature ON ai_namespace_feature_settings USING btree (namespace_id, feature);

CREATE INDEX idx_namespace_hostname_import_type_id_source_name_and_username ON import_source_users USING btree (namespace_id, source_hostname, import_type, id) WHERE ((source_name IS NULL) OR (source_username IS NULL));

CREATE UNIQUE INDEX idx_namespace_settings_on_default_compliance_framework_id ON namespace_settings USING btree (default_compliance_framework_id);

CREATE INDEX idx_namespace_settings_on_last_dormant_members_review_at ON namespace_settings USING btree (last_dormant_member_review_at) WHERE (remove_dormant_members = true);

CREATE UNIQUE INDEX idx_o11y_log_issue_conn_on_issue_id_logs_search_metadata ON observability_logs_issues_connections USING btree (issue_id, service_name, severity_number, log_timestamp, log_fingerprint, trace_identifier);

CREATE UNIQUE INDEX idx_o11y_metric_issue_conn_on_issue_id_metric_type_name ON observability_metrics_issues_connections USING btree (issue_id, metric_type, metric_name);

CREATE UNIQUE INDEX idx_o11y_trace_issue_conn_on_issue_id_trace_identifier ON observability_traces_issues_connections USING btree (issue_id, trace_identifier);

CREATE INDEX idx_oauth_access_grants_on_organization_id ON oauth_access_grants USING btree (organization_id);

CREATE INDEX idx_oauth_access_tokens_on_organization_id ON oauth_access_tokens USING btree (organization_id);

CREATE INDEX idx_oauth_device_grants_on_organization_id ON oauth_device_grants USING btree (organization_id);

CREATE INDEX idx_oauth_openid_requests_on_organization_id ON oauth_openid_requests USING btree (organization_id);

CREATE UNIQUE INDEX idx_on_approval_group_rules_any_approver_type ON approval_group_rules USING btree (group_id, rule_type) WHERE (rule_type = 4);

CREATE UNIQUE INDEX idx_on_approval_group_rules_group_id_type_name ON approval_group_rules USING btree (group_id, rule_type, name);

CREATE UNIQUE INDEX idx_on_approval_group_rules_groups_rule_group ON approval_group_rules_groups USING btree (approval_group_rule_id, group_id);

CREATE UNIQUE INDEX idx_on_approval_group_rules_protected_branch ON approval_group_rules_protected_branches USING btree (approval_group_rule_id, protected_branch_id);

CREATE INDEX idx_on_approval_group_rules_security_orch_policy ON approval_group_rules USING btree (security_orchestration_policy_configuration_id);

CREATE UNIQUE INDEX idx_on_approval_group_rules_users_rule_user ON approval_group_rules_users USING btree (approval_group_rule_id, user_id);

CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name);

CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_external_url ON external_approval_rules USING btree (project_id, external_url);

CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_name ON external_approval_rules USING btree (project_id, name);

CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_external_url ON external_status_checks USING btree (project_id, external_url);

CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_name ON external_status_checks USING btree (project_id, name);

CREATE UNIQUE INDEX idx_on_packages_conan_recipe_revisions_package_id_revision ON packages_conan_recipe_revisions USING btree (package_id, revision);

CREATE INDEX idx_on_project_id_created_at_for_compliance_framework_settings ON project_compliance_framework_settings USING btree (project_id, created_at);

CREATE INDEX idx_on_protected_branch ON approval_group_rules_protected_branches USING btree (protected_branch_id);

CREATE INDEX idx_open_issues_on_project_and_confidential_and_author_and_id ON issues USING btree (project_id, confidential, author_id, id) WHERE (state_id = 1);

CREATE INDEX idx_p_ai_active_context_code_repositories_enabled_namespace_id ON ONLY p_ai_active_context_code_repositories USING btree (enabled_namespace_id);

CREATE INDEX idx_p_ci_finished_pipeline_ch_sync_evts_on_project_namespace_id ON ONLY p_ci_finished_pipeline_ch_sync_events USING btree (project_namespace_id);

CREATE INDEX idx_p_sent_notifications_on_issue_email_participant_id ON ONLY sent_notifications_7abbf02cb6 USING btree (issue_email_participant_id);

CREATE INDEX idx_p_sent_notifications_on_namespace_id ON ONLY sent_notifications_7abbf02cb6 USING btree (namespace_id);

CREATE INDEX idx_p_sent_notifications_on_noteable_type_noteable_id_and_id ON ONLY sent_notifications_7abbf02cb6 USING btree (noteable_id, id) WHERE ((noteable_type)::text = 'Issue'::text);

CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id);

CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON packages_debian_project_component_files USING btree (architecture_id);

CREATE INDEX idx_packages_dependencies_on_name_version_pattern_project_id ON packages_dependencies USING btree (name, version_pattern, project_id);

CREATE INDEX idx_packages_nuget_metadata_on_pkg_id_and_normalized_version ON packages_nuget_metadata USING btree (package_id, normalized_version);

CREATE INDEX idx_packages_on_project_id_name_id_version_when_installable_npm ON packages_packages USING btree (project_id, name, id, version) WHERE ((package_type = 2) AND (status = ANY (ARRAY[0, 1])));

CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 7) AND (status <> 4));

CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_golang ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 8) AND (status <> 4));

CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_helm ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 11) AND (status <> 4));

CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_maven ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 1) AND (status <> 4));

CREATE UNIQUE INDEX idx_packages_on_project_id_name_version_unique_when_npm ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 2) AND (status <> 4));

CREATE INDEX idx_packages_packages_on_npm_scope_and_project_id ON packages_packages USING btree (split_part((name)::text, '/'::text, 1), project_id) WHERE ((package_type = 2) AND ("position"((name)::text, '/'::text) > 0) AND (status = ANY (ARRAY[0, 3])) AND (version IS NOT NULL));

CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type);

CREATE INDEX idx_pat_last_used_ips_on_pat_id ON personal_access_token_last_used_ips USING btree (personal_access_token_id);

CREATE INDEX idx_personal_access_tokens_on_previous_personal_access_token_id ON personal_access_tokens USING btree (previous_personal_access_token_id);

CREATE INDEX idx_pipeline_execution_schedules_on_project_id ON security_pipeline_execution_project_schedules USING btree (project_id);

CREATE INDEX idx_pipeline_execution_schedules_security_policy_id_and_id ON security_pipeline_execution_project_schedules USING btree (security_policy_id, id);

CREATE INDEX idx_pkgs_composer_pkgs_on_creator_id ON packages_composer_packages USING btree (creator_id);

CREATE INDEX idx_pkgs_composer_pkgs_on_project_id ON packages_composer_packages USING btree (project_id);

CREATE INDEX idx_pkgs_conan_file_metadata_on_pkg_file_id_when_recipe_file ON packages_conan_file_metadata USING btree (package_file_id) WHERE (conan_file_type = 1);

CREATE INDEX idx_pkgs_conan_metadata_on_pkg_file_id_when_null_rec_rev ON packages_conan_file_metadata USING btree (package_file_id) WHERE (recipe_revision_id IS NULL);

CREATE INDEX idx_pkgs_conan_recipe_rev_on_id_and_revision ON packages_conan_recipe_revisions USING btree (id, revision);

CREATE INDEX idx_pkgs_debian_group_distribution_keys_on_distribution_id ON packages_debian_group_distribution_keys USING btree (distribution_id);

CREATE INDEX idx_pkgs_debian_project_distribution_keys_on_distribution_id ON packages_debian_project_distribution_keys USING btree (distribution_id);

CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type);

CREATE INDEX idx_pkgs_installable_package_files_on_package_id_id_file_name ON packages_package_files USING btree (package_id, id, file_name) WHERE (status = 0);

CREATE INDEX idx_pkgs_npm_metadata_caches_on_id_and_project_id_and_status ON packages_npm_metadata_caches USING btree (id) WHERE ((project_id IS NULL) AND (status = 0));

CREATE INDEX idx_pkgs_nuget_symbols_on_lowercase_signature_and_file_name ON packages_nuget_symbols USING btree (lower(signature), lower(file));

CREATE INDEX idx_pkgs_nuget_symbols_on_lowercase_signature_and_file_path ON packages_nuget_symbols USING btree (lower(signature), lower(file_path));

CREATE INDEX idx_pkgs_on_project_id_name_version_on_installable_terraform ON packages_packages USING btree (project_id, name, version, id) WHERE ((package_type = 12) AND (status = ANY (ARRAY[0, 1])));

CREATE INDEX idx_pkgs_project_id_lower_name_when_nuget_installable_version ON packages_packages USING btree (project_id, lower((name)::text)) WHERE ((package_type = 4) AND (version IS NOT NULL) AND (status = ANY (ARRAY[0, 1])));

CREATE INDEX idx_policy_violations_on_project_id_policy_rule_id_and_id ON scan_result_policy_violations USING btree (project_id, approval_policy_rule_id, id);

CREATE UNIQUE INDEX idx_proj_comp_viol_issues_on_viol_id_issue_id ON project_compliance_violations_issues USING btree (project_compliance_violation_id, issue_id);

CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_cloud_last_sync_at, project_id) WHERE (jira_dvcs_cloud_last_sync_at IS NOT NULL);

CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_server_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_server_last_sync_at, project_id) WHERE (jira_dvcs_server_last_sync_at IS NOT NULL);

CREATE INDEX idx_project_audit_events_on_author_id_created_at_id ON ONLY project_audit_events USING btree (author_id, created_at, id);

CREATE INDEX idx_project_audit_events_on_project_created_at_id ON ONLY project_audit_events USING btree (project_id, created_at, id);

CREATE INDEX idx_project_audit_events_on_project_id_author_created_at_id ON ONLY project_audit_events USING btree (project_id, author_id, created_at, id DESC);

CREATE INDEX idx_project_compliance_violations_on_control_id ON project_compliance_violations USING btree (compliance_requirements_control_id);

CREATE INDEX idx_project_compliance_violations_on_project_id ON project_compliance_violations USING btree (project_id);

CREATE INDEX idx_project_control_compliance_status_on_requirement_status_id ON project_control_compliance_statuses USING btree (requirement_status_id);

CREATE INDEX idx_project_control_statuses_on_namespace_id ON project_control_compliance_statuses USING btree (namespace_id);

CREATE INDEX idx_project_control_statuses_on_project_id ON project_control_compliance_statuses USING btree (project_id);

CREATE INDEX idx_project_control_statuses_on_requirement_id ON project_control_compliance_statuses USING btree (compliance_requirement_id);

CREATE INDEX idx_project_namespace_id_from_namespace_path_timestamp_and_id ON ONLY ai_code_suggestion_events USING btree ((("substring"(namespace_path, '([0-9]+)[^0-9]*$'::text))::bigint), "timestamp", id);

CREATE INDEX idx_project_repository_check_partial ON projects USING btree (repository_storage, created_at) WHERE (last_repository_check_at IS NULL);

CREATE INDEX idx_project_requirement_statuses_on_framework_id ON project_requirement_compliance_statuses USING btree (compliance_framework_id);

CREATE INDEX idx_projects_api_created_at_id_for_archived ON projects USING btree (created_at, id) WHERE ((archived = true) AND (pending_delete = false) AND (hidden = false));

CREATE INDEX idx_projects_api_created_at_id_for_archived_vis20 ON projects USING btree (created_at, id) WHERE ((archived = true) AND (visibility_level = 20) AND (pending_delete = false) AND (hidden = false));

CREATE INDEX idx_projects_api_created_at_id_for_vis10 ON projects USING btree (created_at, id) WHERE ((visibility_level = 10) AND (pending_delete = false) AND (hidden = false));

CREATE INDEX idx_projects_id_created_at_disable_overriding_approvers_false ON projects USING btree (id, created_at) WHERE ((disable_overriding_approvers_per_merge_request = false) OR (disable_overriding_approvers_per_merge_request IS NULL));

CREATE INDEX idx_projects_id_created_at_disable_overriding_approvers_true ON projects USING btree (id, created_at) WHERE (disable_overriding_approvers_per_merge_request = true);

CREATE INDEX idx_projects_on_repository_storage_last_repository_updated_at ON projects USING btree (id, repository_storage, last_repository_updated_at);

CREATE INDEX idx_protected_branch_merge_access_levels_protected_branch_names ON protected_branch_merge_access_levels USING btree (protected_branch_namespace_id);

CREATE INDEX idx_protected_branch_merge_access_levels_protected_branch_proje ON protected_branch_merge_access_levels USING btree (protected_branch_project_id);

CREATE INDEX idx_reminder_frequency_on_work_item_progresses ON work_item_progresses USING btree (reminder_frequency);

CREATE INDEX idx_resource_iteration_events_on_namespace_id ON resource_iteration_events USING btree (namespace_id);

CREATE INDEX idx_resource_milestone_events_on_namespace_id ON resource_milestone_events USING btree (namespace_id);

CREATE UNIQUE INDEX idx_sbom_components_on_name_purl_type_component_type_and_org_id ON sbom_components USING btree (name, purl_type, component_type, organization_id);

CREATE INDEX idx_sbom_graph_paths_project_created ON sbom_graph_paths USING btree (project_id, created_at);

CREATE INDEX idx_sbom_graph_paths_project_path_length_created ON sbom_graph_paths USING btree (project_id, path_length, created_at);

CREATE INDEX idx_sbom_occurr_on_project_component_version_input_file_path ON sbom_occurrences USING btree (project_id, component_version_id, input_file_path);

CREATE INDEX idx_sbom_occurr_on_traversal_ids_and_comp_name_and_comp_ver_id ON sbom_occurrences USING btree (traversal_ids, component_name COLLATE "C", component_version_id);

CREATE INDEX idx_sbom_occurrences_on_project_id_and_source_id ON sbom_occurrences USING btree (project_id, source_id);

CREATE INDEX idx_scan_result_policies_on_configuration_id_id_updated_at ON scan_result_policies USING btree (security_orchestration_policy_configuration_id, id, updated_at);

CREATE INDEX idx_scan_result_policy_violations_on_policy_id_and_id ON scan_result_policy_violations USING btree (scan_result_policy_id, id);

CREATE INDEX idx_secret_detect_token_on_project_id ON secret_detection_token_statuses USING btree (project_id);

CREATE INDEX idx_security_pipeline_execution_project_schedules_next_run_at ON security_pipeline_execution_project_schedules USING btree (next_run_at, id);

CREATE INDEX idx_security_policies_config_id_policy_index ON security_policies USING btree (security_orchestration_policy_configuration_id, policy_index);

CREATE INDEX idx_security_policy_project_links_on_project_id_and_id ON security_policy_project_links USING btree (project_id, id);

CREATE UNIQUE INDEX idx_security_scans_on_build_and_scan_type ON security_scans USING btree (build_id, scan_type);

CREATE INDEX idx_security_scans_on_scan_type ON security_scans USING btree (scan_type);

CREATE INDEX idx_slack_integrations_scopes_on_slack_api_scope_id ON slack_integrations_scopes USING btree (slack_api_scope_id);

CREATE UNIQUE INDEX idx_software_license_policies_unique_on_custom_license_project ON software_license_policies USING btree (project_id, custom_software_license_id, scan_result_policy_id);

CREATE UNIQUE INDEX idx_software_license_policies_unique_on_project_and_scan_policy ON software_license_policies USING btree (project_id, software_license_id, scan_result_policy_id);

CREATE INDEX idx_software_licenses_lower_name ON software_licenses USING btree (lower((name)::text));

CREATE INDEX idx_status_check_responses_on_id_and_status ON status_check_responses USING btree (id, status);

CREATE INDEX idx_streaming_group_namespace_filters_on_namespace_id ON audit_events_streaming_group_namespace_filters USING btree (namespace_id);

CREATE INDEX idx_streaming_headers_on_external_audit_event_destination_id ON audit_events_streaming_headers USING btree (external_audit_event_destination_id);

CREATE INDEX idx_streaming_instance_namespace_filters_on_namespace_id ON audit_events_streaming_instance_namespace_filters USING btree (namespace_id);

CREATE INDEX idx_subscription_add_on_purchases_on_started_on_and_expires_on ON subscription_add_on_purchases USING btree (started_at, expires_on);

CREATE INDEX idx_subscription_add_on_purchases_on_subscription_add_on_id ON subscription_add_on_purchases USING btree (subscription_add_on_id);

CREATE INDEX idx_subscription_seat_assignments_namespace_last_activity_on ON subscription_seat_assignments USING btree (namespace_id, last_activity_on, created_at);

CREATE INDEX idx_test_reports_on_issue_id_created_at_and_id ON requirements_management_test_reports USING btree (issue_id, created_at, id);

CREATE INDEX idx_unarchived_occurrences_for_aggregation_severity_nulls_first ON sbom_occurrences USING btree (traversal_ids, highest_severity NULLS FIRST, component_id, component_version_id) WHERE (archived = false);

CREATE UNIQUE INDEX idx_uniq_analytics_dashboards_pointers_on_project_id ON analytics_dashboards_pointers USING btree (project_id);

CREATE UNIQUE INDEX idx_unique_ai_code_repository_connection_namespace_id ON ONLY p_ai_active_context_code_enabled_namespaces USING btree (connection_id, namespace_id);

CREATE UNIQUE INDEX idx_unique_ai_code_repository_connection_project_id ON ONLY p_ai_active_context_code_repositories USING btree (connection_id, project_id);

CREATE UNIQUE INDEX idx_usages_on_cmpt_used_by_project_cmpt_and_last_used_date ON catalog_resource_component_last_usages USING btree (component_id, used_by_project_id, last_used_date);

CREATE INDEX idx_user_add_on_assignment_versions_on_item_id ON subscription_user_add_on_assignment_versions USING btree (item_id);

CREATE INDEX idx_user_add_on_assignment_versions_on_organization_id ON subscription_user_add_on_assignment_versions USING btree (organization_id);

CREATE INDEX idx_user_add_on_assignments_on_add_on_purchase_id_and_id ON subscription_user_add_on_assignments USING btree (add_on_purchase_id, id);

CREATE INDEX idx_user_audit_events_on_author_id_created_at_id ON ONLY user_audit_events USING btree (author_id, created_at, id);

CREATE INDEX idx_user_audit_events_on_project_created_at_id ON ONLY user_audit_events USING btree (user_id, created_at, id);

CREATE INDEX idx_user_audit_events_on_user_id_author_created_at_id ON ONLY user_audit_events USING btree (user_id, author_id, created_at, id DESC);

CREATE INDEX idx_user_credit_card_validations_on_holder_name_hash ON user_credit_card_validations USING btree (holder_name_hash);

CREATE INDEX idx_user_credit_card_validations_on_similar_to_meta_data ON user_credit_card_validations USING btree (expiration_date_hash, last_digits_hash, network_hash, credit_card_validated_at);

CREATE INDEX idx_user_details_on_provisioned_by_group_id_user_id ON user_details USING btree (provisioned_by_group_id, user_id);

CREATE INDEX idx_user_member_roles_on_member_role_id ON user_member_roles USING btree (member_role_id);

CREATE UNIQUE INDEX idx_user_member_roles_on_user_id_unique ON user_member_roles USING btree (user_id);

CREATE INDEX idx_vuln_reads_for_filtering ON vulnerability_reads USING btree (project_id, state, dismissal_reason, severity DESC, vulnerability_id DESC NULLS LAST);

CREATE UNIQUE INDEX idx_vuln_signatures_uniqueness_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, algorithm_type, signature_sha);

CREATE INDEX idx_vulnerabilities_on_project_id_and_id_active_cis_dft_branch ON vulnerabilities USING btree (project_id, id) WHERE ((report_type = 7) AND (state = ANY (ARRAY[1, 4])) AND (present_on_default_branch IS TRUE));

CREATE INDEX idx_vulnerabilities_partial_devops_adoption_and_default_branch ON vulnerabilities USING btree (project_id, created_at, present_on_default_branch) WHERE (state <> 1);

CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue ON vulnerability_external_issue_links USING btree (vulnerability_id, external_type, external_project_key, external_issue_key);

CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_link_type ON vulnerability_external_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 1);

CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_issue_id ON vulnerability_issue_links USING btree (vulnerability_id, issue_id);

CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_type ON vulnerability_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 2);

CREATE INDEX idx_vulnerability_reads_for_traversal_ids_queries_srt_severity ON vulnerability_reads USING btree (state, report_type, severity, traversal_ids, vulnerability_id) WHERE (archived = false);

CREATE INDEX idx_vulnerability_reads_project_id_scanner_id_vulnerability_id ON vulnerability_reads USING btree (project_id, scanner_id, vulnerability_id);

CREATE INDEX idx_vulnerability_statistics_on_traversal_ids_and_letter_grade ON vulnerability_statistics USING btree (traversal_ids, letter_grade) WHERE (archived = false);

CREATE UNIQUE INDEX idx_wi_current_statuses_on_wi_id_custom_status_id_unique ON work_item_current_statuses USING btree (work_item_id, custom_status_id);

CREATE UNIQUE INDEX idx_wi_current_statuses_on_wi_id_system_def_status_id_unique ON work_item_current_statuses USING btree (work_item_id, system_defined_status_id);

CREATE INDEX idx_wi_custom_lifecycle_statuses_on_namespace_id ON work_item_custom_lifecycle_statuses USING btree (namespace_id);

CREATE INDEX idx_wi_custom_lifecycle_statuses_on_status_id ON work_item_custom_lifecycle_statuses USING btree (status_id);

CREATE INDEX idx_wi_custom_lifecycles_on_closed_status_id ON work_item_custom_lifecycles USING btree (default_closed_status_id);

CREATE INDEX idx_wi_custom_lifecycles_on_duplicate_status_id ON work_item_custom_lifecycles USING btree (default_duplicate_status_id);

CREATE INDEX idx_wi_custom_lifecycles_on_open_status_id ON work_item_custom_lifecycles USING btree (default_open_status_id);

CREATE UNIQUE INDEX idx_wi_number_values_on_work_item_id_custom_field_id ON work_item_number_field_values USING btree (work_item_id, custom_field_id);

CREATE INDEX idx_wi_select_field_values_on_custom_field_select_option_id ON work_item_select_field_values USING btree (custom_field_select_option_id);

CREATE UNIQUE INDEX idx_wi_select_values_on_wi_custom_field_id_select_option_id ON work_item_select_field_values USING btree (work_item_id, custom_field_id, custom_field_select_option_id);

CREATE UNIQUE INDEX idx_wi_text_values_on_work_item_id_custom_field_id ON work_item_text_field_values USING btree (work_item_id, custom_field_id);

CREATE UNIQUE INDEX idx_wi_type_custom_fields_on_ns_id_wi_type_id_custom_field_id ON work_item_type_custom_fields USING btree (namespace_id, work_item_type_id, custom_field_id);

CREATE INDEX idx_wi_type_custom_lifecycles_on_lifecycle_id ON work_item_type_custom_lifecycles USING btree (lifecycle_id);

CREATE UNIQUE INDEX idx_wi_type_custom_lifecycles_on_namespace_type_lifecycle ON work_item_type_custom_lifecycles USING btree (namespace_id, work_item_type_id, lifecycle_id);

CREATE INDEX idx_wi_type_custom_lifecycles_on_work_item_type_id ON work_item_type_custom_lifecycles USING btree (work_item_type_id);

CREATE INDEX idx_workflows_status_updated_at_id ON duo_workflows_workflows USING btree (status, updated_at, id);

CREATE INDEX idx_zoekt_last_indexed_at_gt_used_storage_bytes_updated_at ON zoekt_indices USING btree (used_storage_bytes_updated_at) WHERE (last_indexed_at >= used_storage_bytes_updated_at);

CREATE INDEX idx_zoekt_repositories_on_zoekt_index_id_and_size_bytes ON zoekt_repositories USING btree (zoekt_index_id, size_bytes);

CREATE INDEX idx_zoekt_repositories_on_zoekt_index_id_and_state ON zoekt_repositories USING btree (zoekt_index_id, state);

CREATE INDEX import_export_upload_uploads_checksum_idx ON import_export_upload_uploads USING btree (checksum);

CREATE INDEX import_export_upload_uploads_model_id_model_type_uploader_c_idx ON import_export_upload_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX import_export_upload_uploads_namespace_id_idx ON import_export_upload_uploads USING btree (namespace_id);

CREATE INDEX import_export_upload_uploads_organization_id_idx ON import_export_upload_uploads USING btree (organization_id);

CREATE INDEX import_export_upload_uploads_project_id_idx ON import_export_upload_uploads USING btree (project_id);

CREATE INDEX import_export_upload_uploads_store_idx ON import_export_upload_uploads USING btree (store);

CREATE INDEX import_export_upload_uploads_uploaded_by_user_id_idx ON import_export_upload_uploads USING btree (uploaded_by_user_id);

CREATE INDEX import_export_upload_uploads_uploader_path_idx ON import_export_upload_uploads USING btree (uploader, path);

CREATE INDEX index_ci_runner_machines_on_executor_type ON ONLY ci_runner_machines USING btree (executor_type);

CREATE INDEX index_012094097c ON instance_type_ci_runner_machines USING btree (executor_type);

CREATE INDEX index_ci_runner_taggings_on_organization_id ON ONLY ci_runner_taggings USING btree (organization_id);

CREATE INDEX index_03bce7b65b ON ci_runner_taggings_group_type USING btree (organization_id);

CREATE INDEX index_ci_runner_machines_on_ip_address ON ONLY ci_runner_machines USING btree (ip_address);

CREATE INDEX index_053d12f7ee ON project_type_ci_runner_machines USING btree (ip_address);

CREATE INDEX index_ci_runners_on_organization_id ON ONLY ci_runners USING btree (organization_id);

CREATE INDEX index_11eb9d1747 ON project_type_ci_runners USING btree (organization_id);

CREATE INDEX index_ci_runner_machines_on_organization_id ON ONLY ci_runner_machines USING btree (organization_id);

CREATE INDEX index_8cc4cbb7d2 ON group_type_ci_runner_machines USING btree (organization_id);

CREATE INDEX index_8f3cd552cd ON ci_runner_taggings_instance_type USING btree (organization_id);

CREATE INDEX index_92f173730f ON instance_type_ci_runners USING btree (organization_id);

CREATE INDEX index_934f0e59cf ON ci_runner_taggings_project_type USING btree (organization_id);

CREATE INDEX index_a3343eff0d ON group_type_ci_runners USING btree (organization_id);

CREATE INDEX index_aa3b4fe8c6 ON group_type_ci_runner_machines USING btree (executor_type);

CREATE INDEX index_abuse_events_on_abuse_report_id ON abuse_events USING btree (abuse_report_id);

CREATE INDEX index_abuse_events_on_category_and_source ON abuse_events USING btree (category, source);

CREATE INDEX index_abuse_events_on_user_id ON abuse_events USING btree (user_id);

CREATE INDEX index_abuse_report_assignees_on_abuse_report_id ON abuse_report_assignees USING btree (abuse_report_id);

CREATE UNIQUE INDEX index_abuse_report_assignees_on_user_id_and_abuse_report_id ON abuse_report_assignees USING btree (user_id, abuse_report_id);

CREATE INDEX index_abuse_report_events_on_abuse_report_id ON abuse_report_events USING btree (abuse_report_id);

CREATE INDEX index_abuse_report_events_on_user_id ON abuse_report_events USING btree (user_id);

CREATE INDEX index_abuse_report_label_links_on_abuse_report_label_id ON abuse_report_label_links USING btree (abuse_report_label_id);

CREATE UNIQUE INDEX index_abuse_report_label_links_on_report_id_and_label_id ON abuse_report_label_links USING btree (abuse_report_id, abuse_report_label_id);

CREATE INDEX index_abuse_report_labels_on_description_trigram ON abuse_report_labels USING gin (description gin_trgm_ops);

CREATE UNIQUE INDEX index_abuse_report_labels_on_title ON abuse_report_labels USING btree (title);

CREATE INDEX index_abuse_report_labels_on_title_trigram ON abuse_report_labels USING gin (title gin_trgm_ops);

CREATE INDEX index_abuse_report_notes_on_abuse_report_id ON abuse_report_notes USING btree (abuse_report_id);

CREATE INDEX index_abuse_report_notes_on_author_id ON abuse_report_notes USING btree (author_id);

CREATE INDEX index_abuse_report_notes_on_resolved_by_id ON abuse_report_notes USING btree (resolved_by_id);

CREATE INDEX index_abuse_report_notes_on_updated_by_id ON abuse_report_notes USING btree (updated_by_id);

CREATE UNIQUE INDEX index_abuse_report_user_mentions_on_abuse_report_id_and_note_id ON abuse_report_user_mentions USING btree (abuse_report_id, note_id);

CREATE INDEX index_abuse_report_user_mentions_on_note_id ON abuse_report_user_mentions USING btree (note_id);

CREATE INDEX index_abuse_reports_on_assignee_id ON abuse_reports USING btree (assignee_id);

CREATE INDEX index_abuse_reports_on_resolved_by_id ON abuse_reports USING btree (resolved_by_id);

CREATE INDEX index_abuse_reports_on_status_and_created_at ON abuse_reports USING btree (status, created_at);

CREATE INDEX index_abuse_reports_on_status_and_id ON abuse_reports USING btree (status, id);

CREATE INDEX index_abuse_reports_on_status_and_updated_at ON abuse_reports USING btree (status, updated_at);

CREATE INDEX index_abuse_reports_on_status_category_and_id ON abuse_reports USING btree (status, category, id);

CREATE INDEX index_abuse_reports_on_status_reporter_id_and_id ON abuse_reports USING btree (status, reporter_id, id);

CREATE INDEX index_abuse_trust_scores_on_user_id_and_source_and_created_at ON abuse_trust_scores USING btree (user_id, source, created_at);

CREATE UNIQUE INDEX "index_achievements_on_namespace_id_LOWER_name" ON achievements USING btree (namespace_id, lower(name));

CREATE UNIQUE INDEX index_active_context_connections_single_active ON ai_active_context_connections USING btree (active) WHERE (active = true);

CREATE UNIQUE INDEX index_activity_pub_releases_sub_on_project_id_inbox_url ON activity_pub_releases_subscriptions USING btree (project_id, lower(subscriber_inbox_url));

CREATE UNIQUE INDEX index_activity_pub_releases_sub_on_project_id_sub_url ON activity_pub_releases_subscriptions USING btree (project_id, lower(subscriber_url));

CREATE UNIQUE INDEX index_add_on_purchases_on_add_on_id_and_namespace_id_not_null ON subscription_add_on_purchases USING btree (subscription_add_on_id, namespace_id) WHERE (namespace_id IS NOT NULL);

CREATE UNIQUE INDEX index_add_on_purchases_on_add_on_id_and_namespace_id_null ON subscription_add_on_purchases USING btree (subscription_add_on_id) WHERE (namespace_id IS NULL);

CREATE INDEX index_add_on_purchases_on_organization_id ON subscription_add_on_purchases USING btree (organization_id);

CREATE UNIQUE INDEX index_admin_roles_on_name ON admin_roles USING btree (name);

CREATE INDEX index_agent_activity_events_on_agent_id_and_recorded_at_and_id ON agent_activity_events USING btree (agent_id, recorded_at, id);

CREATE INDEX index_agent_activity_events_on_agent_project_id ON agent_activity_events USING btree (agent_project_id);

CREATE INDEX index_agent_activity_events_on_agent_token_id ON agent_activity_events USING btree (agent_token_id) WHERE (agent_token_id IS NOT NULL);

CREATE INDEX index_agent_activity_events_on_merge_request_id ON agent_activity_events USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL);

CREATE INDEX index_agent_activity_events_on_project_id ON agent_activity_events USING btree (project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX index_agent_activity_events_on_user_id ON agent_activity_events USING btree (user_id) WHERE (user_id IS NOT NULL);

CREATE UNIQUE INDEX index_agent_group_authorizations_on_agent_id_and_group_id ON agent_group_authorizations USING btree (agent_id, group_id);

CREATE INDEX index_agent_group_authorizations_on_group_id ON agent_group_authorizations USING btree (group_id);

CREATE UNIQUE INDEX index_agent_organization_authorizations_on_agent_id ON agent_organization_authorizations USING btree (agent_id);

CREATE INDEX index_agent_organization_authorizations_on_organization_id ON agent_organization_authorizations USING btree (organization_id);

CREATE UNIQUE INDEX index_agent_project_authorizations_on_agent_id_and_project_id ON agent_project_authorizations USING btree (agent_id, project_id);

CREATE INDEX index_agent_project_authorizations_on_project_id ON agent_project_authorizations USING btree (project_id);

CREATE UNIQUE INDEX index_agent_user_access_on_agent_id_and_group_id ON agent_user_access_group_authorizations USING btree (agent_id, group_id);

CREATE UNIQUE INDEX index_agent_user_access_on_agent_id_and_project_id ON agent_user_access_project_authorizations USING btree (agent_id, project_id);

CREATE INDEX index_agent_user_access_on_group_id ON agent_user_access_group_authorizations USING btree (group_id);

CREATE INDEX index_agent_user_access_on_project_id ON agent_user_access_project_authorizations USING btree (project_id);

CREATE UNIQUE INDEX index_ai_active_context_connections_on_name ON ai_active_context_connections USING btree (name);

CREATE INDEX index_ai_active_context_migrations_on_connection_and_status ON ai_active_context_migrations USING btree (connection_id, status);

CREATE UNIQUE INDEX index_ai_active_context_migrations_on_connection_and_version ON ai_active_context_migrations USING btree (connection_id, version);

CREATE INDEX index_ai_agent_version_attachments_on_ai_agent_version_id ON ai_agent_version_attachments USING btree (ai_agent_version_id);

CREATE INDEX index_ai_agent_version_attachments_on_ai_vectorizable_file_id ON ai_agent_version_attachments USING btree (ai_vectorizable_file_id);

CREATE INDEX index_ai_agent_version_attachments_on_project_id ON ai_agent_version_attachments USING btree (project_id);

CREATE INDEX index_ai_agent_versions_on_agent_id ON ai_agent_versions USING btree (agent_id);

CREATE INDEX index_ai_agent_versions_on_project_id ON ai_agent_versions USING btree (project_id);

CREATE UNIQUE INDEX index_ai_agents_on_project_id_and_name ON ai_agents USING btree (project_id, name);

CREATE INDEX index_ai_catalog_item_consumers_on_ai_catalog_item_id ON ai_catalog_item_consumers USING btree (ai_catalog_item_id);

CREATE INDEX index_ai_catalog_item_consumers_on_group_id ON ai_catalog_item_consumers USING btree (group_id);

CREATE INDEX index_ai_catalog_item_consumers_on_organization_id ON ai_catalog_item_consumers USING btree (organization_id);

CREATE INDEX index_ai_catalog_item_consumers_on_project_id ON ai_catalog_item_consumers USING btree (project_id);

CREATE INDEX index_ai_catalog_item_versions_on_organization_id ON ai_catalog_item_versions USING btree (organization_id);

CREATE INDEX index_ai_catalog_items_on_item_type ON ai_catalog_items USING btree (item_type);

CREATE INDEX index_ai_catalog_items_on_organization_id ON ai_catalog_items USING btree (organization_id);

CREATE INDEX index_ai_catalog_items_on_project_id ON ai_catalog_items USING btree (project_id);

CREATE INDEX index_ai_catalog_items_on_public ON ai_catalog_items USING btree (public);

CREATE INDEX index_ai_catalog_items_where_deleted_at_is_null ON ai_catalog_items USING btree (deleted_at) WHERE (deleted_at IS NULL);

CREATE INDEX index_ai_code_suggestion_events_on_organization_id ON ONLY ai_code_suggestion_events USING btree (organization_id);

CREATE INDEX index_ai_code_suggestion_events_on_user_id ON ONLY ai_code_suggestion_events USING btree (user_id);

CREATE INDEX index_ai_conversation_messages_on_agent_version_id ON ai_conversation_messages USING btree (agent_version_id);

CREATE INDEX index_ai_conversation_messages_on_message_xid ON ai_conversation_messages USING btree (message_xid);

CREATE INDEX index_ai_conversation_messages_on_organization_id ON ai_conversation_messages USING btree (organization_id);

CREATE INDEX index_ai_conversation_messages_on_thread_id_and_created_at ON ai_conversation_messages USING btree (thread_id, created_at);

CREATE INDEX index_ai_conversation_threads_on_created_at ON ai_conversation_threads USING btree (created_at);

CREATE INDEX index_ai_conversation_threads_on_last_updated_at ON ai_conversation_threads USING btree (last_updated_at);

CREATE INDEX index_ai_conversation_threads_on_organization_id ON ai_conversation_threads USING btree (organization_id);

CREATE INDEX index_ai_conversation_threads_on_user_id_and_last_updated_at ON ai_conversation_threads USING btree (user_id, last_updated_at);

CREATE INDEX index_ai_duo_chat_events_on_organization_id ON ONLY ai_duo_chat_events USING btree (organization_id);

CREATE INDEX index_ai_duo_chat_events_on_personal_namespace_id ON ONLY ai_duo_chat_events USING btree (personal_namespace_id);

CREATE INDEX index_ai_duo_chat_events_on_user_id ON ONLY ai_duo_chat_events USING btree (user_id);

CREATE INDEX index_ai_feature_settings_on_ai_self_hosted_model_id ON ai_feature_settings USING btree (ai_self_hosted_model_id);

CREATE UNIQUE INDEX index_ai_feature_settings_on_feature ON ai_feature_settings USING btree (feature);

CREATE UNIQUE INDEX index_ai_self_hosted_models_on_name ON ai_self_hosted_models USING btree (name);

CREATE INDEX index_ai_settings_on_amazon_q_oauth_application_id ON ai_settings USING btree (amazon_q_oauth_application_id);

CREATE INDEX index_ai_settings_on_amazon_q_service_account_user_id ON ai_settings USING btree (amazon_q_service_account_user_id);

CREATE INDEX index_ai_settings_on_duo_workflow_oauth_application_id ON ai_settings USING btree (duo_workflow_oauth_application_id);

CREATE INDEX index_ai_settings_on_duo_workflow_service_account_user_id ON ai_settings USING btree (duo_workflow_service_account_user_id);

CREATE UNIQUE INDEX index_ai_settings_on_singleton ON ai_settings USING btree (singleton);

CREATE INDEX index_ai_troubleshoot_job_events_on_job_id ON ONLY ai_troubleshoot_job_events USING btree (job_id);

CREATE INDEX index_ai_troubleshoot_job_events_on_project_id ON ONLY ai_troubleshoot_job_events USING btree (project_id);

CREATE INDEX index_ai_troubleshoot_job_events_on_user_id ON ONLY ai_troubleshoot_job_events USING btree (user_id);

CREATE INDEX index_ai_usage_events_on_namespace_id_timestamp_and_id ON ONLY ai_usage_events USING btree (namespace_id, "timestamp", id);

CREATE INDEX index_ai_usage_events_on_organization_id ON ONLY ai_usage_events USING btree (organization_id);

CREATE INDEX index_ai_usage_events_on_user_id ON ONLY ai_usage_events USING btree (user_id);

CREATE INDEX index_ai_vectorizable_files_on_project_id ON ai_vectorizable_files USING btree (project_id);

CREATE INDEX index_alert_assignees_on_alert_id ON alert_management_alert_assignees USING btree (alert_id);

CREATE UNIQUE INDEX index_alert_assignees_on_user_id_and_alert_id ON alert_management_alert_assignees USING btree (user_id, alert_id);

CREATE INDEX index_alert_management_alert_assignees_on_project_id ON alert_management_alert_assignees USING btree (project_id);

CREATE INDEX index_alert_management_alert_metric_images_on_alert_id ON alert_management_alert_metric_images USING btree (alert_id);

CREATE INDEX index_alert_management_alert_metric_images_on_project_id ON alert_management_alert_metric_images USING btree (project_id);

CREATE INDEX index_alert_management_alert_user_mentions_on_project_id ON alert_management_alert_user_mentions USING btree (project_id);

CREATE INDEX index_alert_management_alerts_on_domain ON alert_management_alerts USING btree (domain);

CREATE INDEX index_alert_management_alerts_on_environment_id ON alert_management_alerts USING btree (environment_id) WHERE (environment_id IS NOT NULL);

CREATE INDEX index_alert_management_alerts_on_issue_id ON alert_management_alerts USING btree (issue_id);

CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_iid ON alert_management_alerts USING btree (project_id, iid);

CREATE INDEX index_alert_management_alerts_on_prometheus_alert_id ON alert_management_alerts USING btree (prometheus_alert_id) WHERE (prometheus_alert_id IS NOT NULL);

CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id ON alert_management_alert_user_mentions USING btree (alert_management_alert_id) WHERE (note_id IS NULL);

CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id_and_note_id ON alert_management_alert_user_mentions USING btree (alert_management_alert_id, note_id);

CREATE UNIQUE INDEX index_alert_user_mentions_on_note_id ON alert_management_alert_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);

CREATE INDEX index_alerts_on_project_id_domain_status ON alert_management_alerts USING btree (project_id, domain, status);

CREATE INDEX index_allowed_email_domains_on_group_id ON allowed_email_domains USING btree (group_id);

CREATE INDEX index_analytics_ca_group_stages_on_end_event_label_id ON analytics_cycle_analytics_group_stages USING btree (end_event_label_id);

CREATE INDEX index_analytics_ca_group_stages_on_relative_position ON analytics_cycle_analytics_group_stages USING btree (relative_position);

CREATE INDEX index_analytics_ca_group_stages_on_start_event_label_id ON analytics_cycle_analytics_group_stages USING btree (start_event_label_id);

CREATE INDEX index_analytics_ca_group_stages_on_value_stream_id ON analytics_cycle_analytics_group_stages USING btree (group_value_stream_id);

CREATE UNIQUE INDEX index_analytics_ca_group_value_streams_on_group_id_and_name ON analytics_cycle_analytics_group_value_streams USING btree (group_id, name);

CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true);

CREATE INDEX index_analytics_cycle_analytics_stage_aggregations_on_group_id ON analytics_cycle_analytics_stage_aggregations USING btree (group_id);

CREATE INDEX index_analytics_cycle_analytics_value_stream_settings_on_namesp ON analytics_cycle_analytics_value_stream_settings USING btree (namespace_id);

CREATE UNIQUE INDEX index_analytics_dashboards_pointers_on_namespace_id ON analytics_dashboards_pointers USING btree (namespace_id);

CREATE INDEX index_analytics_dashboards_pointers_on_target_project_id ON analytics_dashboards_pointers USING btree (target_project_id);

CREATE UNIQUE INDEX index_analyzer_namespace_statuses_status ON analyzer_namespace_statuses USING btree (namespace_id, analyzer_type);

CREATE INDEX index_analyzer_namespace_statuses_traversal_ids ON analyzer_namespace_statuses USING btree (traversal_ids);

CREATE INDEX index_analyzer_project_statuses_build_id ON analyzer_project_statuses USING btree (build_id);

CREATE UNIQUE INDEX index_analyzer_project_statuses_status ON analyzer_project_statuses USING btree (project_id, analyzer_type);

CREATE INDEX index_analyzer_project_statuses_traversal_ids ON analyzer_project_statuses USING btree (traversal_ids);

CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON application_settings USING btree (custom_project_templates_group_id);

CREATE INDEX index_application_settings_on_file_template_project_id ON application_settings USING btree (file_template_project_id);

CREATE UNIQUE INDEX index_application_settings_on_push_rule_id ON application_settings USING btree (push_rule_id);

CREATE INDEX index_application_settings_on_usage_stats_set_by_user_id ON application_settings USING btree (usage_stats_set_by_user_id);

CREATE INDEX index_application_settings_web_ide_oauth_application_id ON application_settings USING btree (web_ide_oauth_application_id);

CREATE INDEX index_approval_group_rules_groups_on_group_id ON approval_group_rules_groups USING btree (group_id);

CREATE INDEX index_approval_group_rules_on_approval_policy_rule_id ON approval_group_rules USING btree (approval_policy_rule_id);

CREATE INDEX index_approval_group_rules_on_scan_result_policy_id ON approval_group_rules USING btree (scan_result_policy_id);

CREATE INDEX index_approval_group_rules_protected_branches_on_group_id ON approval_group_rules_protected_branches USING btree (group_id);

CREATE INDEX index_approval_group_rules_users_on_group_id ON approval_group_rules_users USING btree (group_id);

CREATE INDEX index_approval_group_rules_users_on_user_id ON approval_group_rules_users USING btree (user_id);

CREATE UNIQUE INDEX index_approval_merge_request_rule_sources_1 ON approval_merge_request_rule_sources USING btree (approval_merge_request_rule_id);

CREATE INDEX index_approval_merge_request_rule_sources_2 ON approval_merge_request_rule_sources USING btree (approval_project_rule_id);

CREATE INDEX index_approval_merge_request_rule_sources_on_project_id ON approval_merge_request_rule_sources USING btree (project_id);

CREATE UNIQUE INDEX index_approval_merge_request_rules_approved_approvers_1 ON approval_merge_request_rules_approved_approvers USING btree (approval_merge_request_rule_id, user_id);

CREATE INDEX index_approval_merge_request_rules_approved_approvers_2 ON approval_merge_request_rules_approved_approvers USING btree (user_id);

CREATE UNIQUE INDEX index_approval_merge_request_rules_groups_1 ON approval_merge_request_rules_groups USING btree (approval_merge_request_rule_id, group_id);

CREATE INDEX index_approval_merge_request_rules_groups_2 ON approval_merge_request_rules_groups USING btree (group_id);

CREATE INDEX index_approval_merge_request_rules_on_approval_policy_rule_id ON approval_merge_request_rules USING btree (approval_policy_rule_id);

CREATE INDEX index_approval_merge_request_rules_on_project_id ON approval_merge_request_rules USING btree (project_id);

CREATE UNIQUE INDEX index_approval_merge_request_rules_users_1 ON approval_merge_request_rules_users USING btree (approval_merge_request_rule_id, user_id);

CREATE INDEX index_approval_merge_request_rules_users_2 ON approval_merge_request_rules_users USING btree (user_id);

CREATE INDEX index_approval_mr_rules_on_project_id_policy_rule_id_and_id ON approval_merge_request_rules USING btree (security_orchestration_policy_configuration_id, approval_policy_rule_id, id);

CREATE UNIQUE INDEX index_approval_policy_rule_on_project_and_rule ON approval_policy_rule_project_links USING btree (approval_policy_rule_id, project_id);

CREATE INDEX index_approval_policy_rules_on_policy_management_project_id ON approval_policy_rules USING btree (security_policy_management_project_id);

CREATE UNIQUE INDEX index_approval_policy_rules_on_unique_policy_rule_index ON approval_policy_rules USING btree (security_policy_id, rule_index);

CREATE UNIQUE INDEX index_approval_project_rules_groups_1 ON approval_project_rules_groups USING btree (approval_project_rule_id, group_id);

CREATE INDEX index_approval_project_rules_groups_2 ON approval_project_rules_groups USING btree (group_id);

CREATE INDEX index_approval_project_rules_on_approval_policy_rule_id ON approval_project_rules USING btree (approval_policy_rule_id);

CREATE INDEX index_approval_project_rules_on_id_with_regular_type ON approval_project_rules USING btree (id) WHERE (rule_type = 0);

CREATE INDEX index_approval_project_rules_on_project_id_and_rule_type ON approval_project_rules USING btree (project_id, rule_type);

CREATE INDEX index_approval_project_rules_on_project_id_config_id_and_id ON approval_project_rules USING btree (security_orchestration_policy_configuration_id, project_id, id);

CREATE INDEX index_approval_project_rules_on_rule_type ON approval_project_rules USING btree (rule_type);

CREATE INDEX index_approval_project_rules_protected_branches_on_project_id ON approval_project_rules_protected_branches USING btree (project_id);

CREATE INDEX index_approval_project_rules_protected_branches_pb_id ON approval_project_rules_protected_branches USING btree (protected_branch_id);

CREATE INDEX index_approval_project_rules_report_type ON approval_project_rules USING btree (report_type);

CREATE UNIQUE INDEX index_approval_project_rules_users_1 ON approval_project_rules_users USING btree (approval_project_rule_id, user_id);

CREATE INDEX index_approval_project_rules_users_2 ON approval_project_rules_users USING btree (user_id);

CREATE INDEX index_approval_project_rules_users_on_project_id ON approval_project_rules_users USING btree (project_id);

CREATE UNIQUE INDEX index_approval_rule_name_for_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id, name) WHERE ((rule_type = 2) AND (section IS NULL));

CREATE UNIQUE INDEX index_approval_rule_name_for_sectional_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id, name, section) WHERE (rule_type = 2);

CREATE INDEX index_approval_rule_on_protected_environment_id ON protected_environment_approval_rules USING btree (protected_environment_id);

CREATE INDEX index_approval_rules_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id) WHERE (rule_type = 2);

CREATE INDEX index_approvals_on_merge_request_id_and_created_at ON approvals USING btree (merge_request_id, created_at);

CREATE INDEX index_approvals_on_project_id ON approvals USING btree (project_id);

CREATE UNIQUE INDEX index_approvals_on_user_id_and_merge_request_id ON approvals USING btree (user_id, merge_request_id);

CREATE INDEX index_approver_groups_on_group_id ON approver_groups USING btree (group_id);

CREATE INDEX index_approver_groups_on_target_id_and_target_type ON approver_groups USING btree (target_id, target_type);

CREATE INDEX index_approvers_on_target_id_and_target_type ON approvers USING btree (target_id, target_type);

CREATE INDEX index_approvers_on_user_id ON approvers USING btree (user_id);

CREATE INDEX index_arkose_sessions_on_session_xid ON arkose_sessions USING btree (session_xid);

CREATE INDEX index_arkose_sessions_on_user_id ON arkose_sessions USING btree (user_id);

CREATE INDEX index_arkose_sessions_on_verified_at ON arkose_sessions USING btree (verified_at);

CREATE UNIQUE INDEX index_atlassian_identities_on_extern_uid ON atlassian_identities USING btree (extern_uid);

CREATE UNIQUE INDEX index_audit_events_external_audit_on_verification_token ON audit_events_external_audit_event_destinations USING btree (verification_token);

CREATE INDEX index_audit_events_instance_namespace_filters_on_namespace_id ON audit_events_streaming_http_instance_namespace_filters USING btree (namespace_id);

CREATE INDEX index_audit_events_on_entity_id_and_entity_type_and_created_at ON ONLY audit_events USING btree (entity_id, entity_type, created_at, id);

CREATE INDEX index_audit_events_streaming_event_type_filters_on_group_id ON audit_events_streaming_event_type_filters USING btree (group_id);

CREATE INDEX index_audit_events_streaming_headers_on_group_id ON audit_events_streaming_headers USING btree (group_id);

CREATE INDEX index_authentication_events_on_provider ON authentication_events USING btree (provider);

CREATE INDEX index_authentication_events_on_user_and_ip_address_and_result ON authentication_events USING btree (user_id, ip_address, result);

CREATE UNIQUE INDEX index_automation_rules_namespace_id_name ON automation_rules USING btree (namespace_id, lower(name));

CREATE INDEX index_automation_rules_namespace_id_permanently_disabled ON automation_rules USING btree (namespace_id, permanently_disabled);

CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON award_emoji USING btree (awardable_type, awardable_id);

CREATE UNIQUE INDEX index_aws_roles_on_role_external_id ON aws_roles USING btree (role_external_id);

CREATE UNIQUE INDEX index_aws_roles_on_user_id ON aws_roles USING btree (user_id);

CREATE INDEX index_background_migration_jobs_for_partitioning_migrations ON background_migration_jobs USING btree (((arguments ->> 2))) WHERE (class_name = 'Gitlab::Database::PartitioningMigrationHelpers::BackfillPartitionedTable'::text);

CREATE INDEX index_background_migration_jobs_on_class_name_and_arguments ON background_migration_jobs USING btree (class_name, arguments);

CREATE INDEX index_background_migration_jobs_on_class_name_and_status_and_id ON background_migration_jobs USING btree (class_name, status, id);

CREATE INDEX index_badges_on_group_id ON badges USING btree (group_id);

CREATE INDEX index_badges_on_project_id ON badges USING btree (project_id);

CREATE INDEX index_batch_trackers_on_tracker_id_status ON bulk_import_batch_trackers USING btree (tracker_id, status);

CREATE INDEX index_batched_background_migrations_on_status ON batched_background_migrations USING btree (status);

CREATE UNIQUE INDEX index_batched_background_migrations_on_unique_configuration ON batched_background_migrations USING btree (job_class_name, table_name, column_name, job_arguments);

CREATE INDEX index_batched_jobs_by_batched_migration_id_and_id ON batched_background_migration_jobs USING btree (batched_background_migration_id, id);

CREATE INDEX index_batched_jobs_on_batched_migration_id_and_status ON batched_background_migration_jobs USING btree (batched_background_migration_id, status);

CREATE UNIQUE INDEX index_batched_migrations_on_gl_schema_and_unique_configuration ON batched_background_migrations USING btree (gitlab_schema, job_class_name, table_name, column_name, job_arguments);

CREATE INDEX index_board_assignees_on_assignee_id ON board_assignees USING btree (assignee_id);

CREATE UNIQUE INDEX index_board_assignees_on_board_id_and_assignee_id ON board_assignees USING btree (board_id, assignee_id);

CREATE INDEX index_board_assignees_on_group_id ON board_assignees USING btree (group_id);

CREATE INDEX index_board_assignees_on_project_id ON board_assignees USING btree (project_id);

CREATE INDEX index_board_group_recent_visits_on_board_id ON board_group_recent_visits USING btree (board_id);

CREATE INDEX index_board_group_recent_visits_on_group_id ON board_group_recent_visits USING btree (group_id);

CREATE UNIQUE INDEX index_board_group_recent_visits_on_user_group_and_board ON board_group_recent_visits USING btree (user_id, group_id, board_id);

CREATE UNIQUE INDEX index_board_labels_on_board_id_and_label_id ON board_labels USING btree (board_id, label_id);

CREATE INDEX index_board_labels_on_group_id ON board_labels USING btree (group_id);

CREATE INDEX index_board_labels_on_label_id ON board_labels USING btree (label_id);

CREATE INDEX index_board_labels_on_project_id ON board_labels USING btree (project_id);

CREATE INDEX index_board_project_recent_visits_on_board_id ON board_project_recent_visits USING btree (board_id);

CREATE INDEX index_board_project_recent_visits_on_project_id ON board_project_recent_visits USING btree (project_id);

CREATE UNIQUE INDEX index_board_project_recent_visits_on_user_project_and_board ON board_project_recent_visits USING btree (user_id, project_id, board_id);

CREATE INDEX index_board_user_preferences_on_board_id ON board_user_preferences USING btree (board_id);

CREATE INDEX index_board_user_preferences_on_group_id ON board_user_preferences USING btree (group_id);

CREATE INDEX index_board_user_preferences_on_project_id ON board_user_preferences USING btree (project_id);

CREATE UNIQUE INDEX index_board_user_preferences_on_user_id_and_board_id ON board_user_preferences USING btree (user_id, board_id);

CREATE INDEX index_boards_epic_board_labels_on_epic_board_id ON boards_epic_board_labels USING btree (epic_board_id);

CREATE INDEX index_boards_epic_board_labels_on_group_id ON boards_epic_board_labels USING btree (group_id);

CREATE INDEX index_boards_epic_board_labels_on_label_id ON boards_epic_board_labels USING btree (label_id);

CREATE UNIQUE INDEX index_boards_epic_board_positions_on_epic_board_id_and_epic_id ON boards_epic_board_positions USING btree (epic_board_id, epic_id);

CREATE INDEX index_boards_epic_board_positions_on_epic_id ON boards_epic_board_positions USING btree (epic_id);

CREATE INDEX index_boards_epic_board_positions_on_group_id ON boards_epic_board_positions USING btree (group_id);

CREATE INDEX index_boards_epic_board_positions_on_scoped_relative_position ON boards_epic_board_positions USING btree (epic_board_id, epic_id, relative_position);

CREATE INDEX index_boards_epic_board_recent_visits_on_epic_board_id ON boards_epic_board_recent_visits USING btree (epic_board_id);

CREATE INDEX index_boards_epic_board_recent_visits_on_group_id ON boards_epic_board_recent_visits USING btree (group_id);

CREATE INDEX index_boards_epic_boards_on_group_id ON boards_epic_boards USING btree (group_id);

CREATE INDEX index_boards_epic_list_user_preferences_on_epic_list_id ON boards_epic_list_user_preferences USING btree (epic_list_id);

CREATE INDEX index_boards_epic_list_user_preferences_on_group_id ON boards_epic_list_user_preferences USING btree (group_id);

CREATE INDEX index_boards_epic_lists_on_epic_board_id ON boards_epic_lists USING btree (epic_board_id);

CREATE UNIQUE INDEX index_boards_epic_lists_on_epic_board_id_and_label_id ON boards_epic_lists USING btree (epic_board_id, label_id) WHERE (list_type = 1);

CREATE INDEX index_boards_epic_lists_on_group_id ON boards_epic_lists USING btree (group_id);

CREATE INDEX index_boards_epic_lists_on_label_id ON boards_epic_lists USING btree (label_id);

CREATE UNIQUE INDEX index_boards_epic_user_preferences_on_board_user_epic_unique ON boards_epic_user_preferences USING btree (board_id, user_id, epic_id);

CREATE INDEX index_boards_epic_user_preferences_on_epic_id ON boards_epic_user_preferences USING btree (epic_id);

CREATE INDEX index_boards_epic_user_preferences_on_group_id ON boards_epic_user_preferences USING btree (group_id);

CREATE INDEX index_boards_epic_user_preferences_on_user_id ON boards_epic_user_preferences USING btree (user_id);

CREATE INDEX index_boards_on_group_id ON boards USING btree (group_id);

CREATE INDEX index_boards_on_iteration_cadence_id ON boards USING btree (iteration_cadence_id);

CREATE INDEX index_boards_on_iteration_id ON boards USING btree (iteration_id);

CREATE INDEX index_boards_on_milestone_id ON boards USING btree (milestone_id);

CREATE INDEX index_boards_on_project_id ON boards USING btree (project_id);

CREATE UNIQUE INDEX index_branch_rule_squash_options_on_protected_branch_id ON projects_branch_rules_squash_options USING btree (protected_branch_id);

CREATE UNIQUE INDEX index_broadcast_dismissals_on_user_id_and_broadcast_message_id ON user_broadcast_message_dismissals USING btree (user_id, broadcast_message_id);

CREATE INDEX index_broadcast_message_on_ends_at_and_broadcast_type_and_id ON broadcast_messages USING btree (ends_at, broadcast_type, id);

CREATE INDEX index_bulk_import_batch_trackers_on_tracker_id_and_updated_at ON bulk_import_batch_trackers USING btree (tracker_id, updated_at);

CREATE INDEX index_bulk_import_configurations_on_bulk_import_id ON bulk_import_configurations USING btree (bulk_import_id);

CREATE INDEX index_bulk_import_configurations_on_organization_id ON bulk_import_configurations USING btree (organization_id);

CREATE INDEX index_bulk_import_entities_for_stale_status ON bulk_import_entities USING btree (updated_at, id) WHERE (status = ANY (ARRAY[0, 1]));

CREATE INDEX index_bulk_import_entities_on_bulk_import_id_and_status ON bulk_import_entities USING btree (bulk_import_id, status);

CREATE INDEX index_bulk_import_entities_on_namespace_id ON bulk_import_entities USING btree (namespace_id);

CREATE INDEX index_bulk_import_entities_on_organization_id ON bulk_import_entities USING btree (organization_id);

CREATE INDEX index_bulk_import_entities_on_parent_id ON bulk_import_entities USING btree (parent_id);

CREATE INDEX index_bulk_import_entities_on_project_id ON bulk_import_entities USING btree (project_id);

CREATE INDEX index_bulk_import_export_batches_on_group_id ON bulk_import_export_batches USING btree (group_id);

CREATE INDEX index_bulk_import_export_batches_on_project_id ON bulk_import_export_batches USING btree (project_id);

CREATE INDEX index_bulk_import_export_uploads_on_export_id ON bulk_import_export_uploads USING btree (export_id);

CREATE INDEX index_bulk_import_export_uploads_on_group_id ON bulk_import_export_uploads USING btree (group_id);

CREATE INDEX index_bulk_import_export_uploads_on_project_id ON bulk_import_export_uploads USING btree (project_id);

CREATE INDEX index_bulk_import_exports_on_group_id ON bulk_import_exports USING btree (group_id);

CREATE INDEX index_bulk_import_exports_on_project_id ON bulk_import_exports USING btree (project_id);

CREATE INDEX index_bulk_import_exports_on_user_id ON bulk_import_exports USING btree (user_id);

CREATE INDEX index_bulk_import_failures_on_bulk_import_entity_id ON bulk_import_failures USING btree (bulk_import_entity_id);

CREATE INDEX index_bulk_import_failures_on_correlation_id_value ON bulk_import_failures USING btree (correlation_id_value);

CREATE INDEX index_bulk_import_failures_on_namespace_id ON bulk_import_failures USING btree (namespace_id);

CREATE INDEX index_bulk_import_failures_on_organization_id ON bulk_import_failures USING btree (organization_id);

CREATE INDEX index_bulk_import_failures_on_project_id ON bulk_import_failures USING btree (project_id);

CREATE INDEX index_bulk_import_trackers_on_namespace_id ON bulk_import_trackers USING btree (namespace_id);

CREATE INDEX index_bulk_import_trackers_on_organization_id ON bulk_import_trackers USING btree (organization_id);

CREATE INDEX index_bulk_import_trackers_on_project_id ON bulk_import_trackers USING btree (project_id);

CREATE INDEX index_bulk_imports_on_organization_id ON bulk_imports USING btree (organization_id);

CREATE INDEX index_bulk_imports_on_updated_at_and_id_for_stale_status ON bulk_imports USING btree (updated_at, id) WHERE (status = ANY (ARRAY[0, 1]));

CREATE INDEX index_bulk_imports_on_user_id ON bulk_imports USING btree (user_id);

CREATE INDEX index_ca_enabled_incomplete_aggregation_stages_on_last_run_at ON analytics_cycle_analytics_stage_aggregations USING btree (last_run_at NULLS FIRST) WHERE ((last_completed_at IS NULL) AND (enabled = true));

CREATE INDEX index_catalog_resource_components_on_catalog_resource_id ON catalog_resource_components USING btree (catalog_resource_id);

CREATE INDEX index_catalog_resource_components_on_project_id ON catalog_resource_components USING btree (project_id);

CREATE INDEX index_catalog_resource_components_on_version_id ON catalog_resource_components USING btree (version_id);

CREATE INDEX index_catalog_resource_versions_on_project_id ON catalog_resource_versions USING btree (project_id);

CREATE INDEX index_catalog_resource_versions_on_published_by_id ON catalog_resource_versions USING btree (published_by_id);

CREATE UNIQUE INDEX index_catalog_resource_versions_on_release_id ON catalog_resource_versions USING btree (release_id);

CREATE INDEX index_catalog_resource_versions_on_resource_id_and_released_at ON catalog_resource_versions USING btree (catalog_resource_id, released_at);

CREATE INDEX index_catalog_resources_on_last_30_day_usage_count ON catalog_resources USING btree (last_30_day_usage_count) WHERE (state = 1);

CREATE INDEX index_catalog_resources_on_last_30_day_usage_count_updated_at ON catalog_resources USING btree (last_30_day_usage_count_updated_at);

CREATE UNIQUE INDEX index_catalog_resources_on_project_id ON catalog_resources USING btree (project_id);

CREATE INDEX index_catalog_resources_on_search_vector ON catalog_resources USING gin (search_vector);

CREATE INDEX index_catalog_resources_on_state ON catalog_resources USING btree (state);

CREATE UNIQUE INDEX index_catalog_verified_namespaces_on_namespace_id ON catalog_verified_namespaces USING btree (namespace_id);

CREATE INDEX index_chat_names_on_team_id_and_chat_id ON chat_names USING btree (team_id, chat_id);

CREATE INDEX index_chat_names_on_user_id ON chat_names USING btree (user_id);

CREATE UNIQUE INDEX index_chat_teams_on_namespace_id ON chat_teams USING btree (namespace_id);

CREATE UNIQUE INDEX index_ci_build_needs_on_build_id_and_name ON ci_build_needs USING btree (build_id, name);

CREATE INDEX index_ci_build_needs_on_project_id ON ci_build_needs USING btree (project_id);

CREATE UNIQUE INDEX index_ci_build_pending_states_on_build_id ON ci_build_pending_states USING btree (build_id);

CREATE INDEX index_ci_build_pending_states_on_project_id ON ci_build_pending_states USING btree (project_id);

CREATE INDEX index_ci_build_report_results_on_project_id ON ci_build_report_results USING btree (project_id);

CREATE UNIQUE INDEX index_ci_build_trace_chunks_on_build_id_and_chunk_index ON ci_build_trace_chunks USING btree (build_id, chunk_index);

CREATE INDEX index_ci_build_trace_chunks_on_project_id ON ci_build_trace_chunks USING btree (project_id);

CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runner_session USING btree (build_id);

CREATE UNIQUE INDEX index_ci_builds_runner_session_on_partition_id_build_id ON ci_builds_runner_session USING btree (partition_id, build_id);

CREATE INDEX index_ci_builds_runner_session_on_project_id ON ci_builds_runner_session USING btree (project_id);

CREATE INDEX index_ci_daily_build_group_report_results_on_group_id ON ci_daily_build_group_report_results USING btree (group_id);

CREATE INDEX index_ci_daily_build_group_report_results_on_last_pipeline_id ON ci_daily_build_group_report_results USING btree (last_pipeline_id);

CREATE INDEX index_ci_daily_build_group_report_results_on_project_and_date ON ci_daily_build_group_report_results USING btree (project_id, date DESC) WHERE ((default_branch = true) AND ((data -> 'coverage'::text) IS NOT NULL));

CREATE INDEX index_ci_deleted_objects_on_pick_up_at ON ci_deleted_objects USING btree (pick_up_at);

CREATE INDEX index_ci_deleted_objects_on_project_id ON ci_deleted_objects USING btree (project_id);

CREATE INDEX index_ci_finished_build_ch_sync_events_for_partitioned_query ON ONLY p_ci_finished_build_ch_sync_events USING btree (((build_id % (100)::bigint)), build_id) WHERE (processed = false);

CREATE INDEX index_ci_finished_pipeline_ch_sync_events_for_partitioned_query ON ONLY p_ci_finished_pipeline_ch_sync_events USING btree (((pipeline_id % (100)::bigint)), pipeline_id) WHERE (processed = false);

CREATE INDEX index_ci_freeze_periods_on_project_id ON ci_freeze_periods USING btree (project_id);

CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key_and_environment ON ci_group_variables USING btree (group_id, key, environment_scope);

CREATE INDEX index_ci_instance_runner_monthly_usages_on_namespace_and_month ON ci_instance_runner_monthly_usages USING btree (root_namespace_id, billing_month);

CREATE INDEX index_ci_instance_runner_monthly_usages_on_project_and_month ON ci_instance_runner_monthly_usages USING btree (project_id, billing_month);

CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON ci_instance_variables USING btree (key);

CREATE INDEX index_ci_job_token_authorizations_on_origin_project_id ON ci_job_token_authorizations USING btree (origin_project_id);

CREATE INDEX index_ci_job_token_group_scope_links_on_added_by_id ON ci_job_token_group_scope_links USING btree (added_by_id);

CREATE INDEX index_ci_job_token_group_scope_links_on_target_group_id ON ci_job_token_group_scope_links USING btree (target_group_id);

CREATE INDEX index_ci_job_token_project_scope_links_on_added_by_id ON ci_job_token_project_scope_links USING btree (added_by_id);

CREATE INDEX index_ci_job_token_project_scope_links_on_target_project_id ON ci_job_token_project_scope_links USING btree (target_project_id);

CREATE INDEX index_ci_job_variables_on_job_id ON ci_job_variables USING btree (job_id);

CREATE UNIQUE INDEX index_ci_job_variables_on_key_and_job_id ON ci_job_variables USING btree (key, job_id);

CREATE INDEX index_ci_job_variables_on_project_id ON ci_job_variables USING btree (project_id);

CREATE INDEX index_ci_minutes_additional_packs_on_namespace_id_purchase_xid ON ci_minutes_additional_packs USING btree (namespace_id, purchase_xid);

CREATE UNIQUE INDEX index_ci_namespace_mirrors_on_namespace_id ON ci_namespace_mirrors USING btree (namespace_id);

CREATE INDEX index_ci_namespace_mirrors_on_traversal_ids_unnest ON ci_namespace_mirrors USING btree ((traversal_ids[1]), (traversal_ids[2]), (traversal_ids[3]), (traversal_ids[4])) INCLUDE (traversal_ids, namespace_id);

CREATE UNIQUE INDEX index_ci_namespace_monthly_usages_on_namespace_id_and_date ON ci_namespace_monthly_usages USING btree (namespace_id, date);

CREATE UNIQUE INDEX index_ci_partitions_on_current_status ON ci_partitions USING btree (status) WHERE (status = 2);

CREATE INDEX index_ci_pending_builds_id_on_protected_partial ON ci_pending_builds USING btree (id) WHERE (protected = true);

CREATE UNIQUE INDEX index_ci_pending_builds_on_build_id ON ci_pending_builds USING btree (build_id);

CREATE INDEX index_ci_pending_builds_on_namespace_id ON ci_pending_builds USING btree (namespace_id);

CREATE UNIQUE INDEX index_ci_pending_builds_on_partition_id_build_id ON ci_pending_builds USING btree (partition_id, build_id);

CREATE INDEX index_ci_pending_builds_on_plan_id ON ci_pending_builds USING btree (plan_id);

CREATE INDEX index_ci_pending_builds_on_project_id ON ci_pending_builds USING btree (project_id);

CREATE INDEX index_ci_pending_builds_on_tag_ids ON ci_pending_builds USING btree (tag_ids) WHERE (cardinality(tag_ids) > 0);

CREATE INDEX index_ci_pipeline_artifacts_failed_verification ON ci_pipeline_artifacts USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_ci_pipeline_artifacts_needs_verification ON ci_pipeline_artifacts USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_ci_pipeline_artifacts_on_expire_at ON ci_pipeline_artifacts USING btree (expire_at);

CREATE UNIQUE INDEX index_ci_pipeline_artifacts_on_pipeline_id_and_file_type ON ci_pipeline_artifacts USING btree (pipeline_id, file_type);

CREATE INDEX index_ci_pipeline_artifacts_on_project_id ON ci_pipeline_artifacts USING btree (project_id);

CREATE INDEX index_ci_pipeline_artifacts_pending_verification ON ci_pipeline_artifacts USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_ci_pipeline_artifacts_verification_state ON ci_pipeline_artifacts USING btree (verification_state);

CREATE INDEX index_ci_pipeline_chat_data_on_chat_name_id ON ci_pipeline_chat_data USING btree (chat_name_id);

CREATE UNIQUE INDEX index_ci_pipeline_chat_data_on_pipeline_id ON ci_pipeline_chat_data USING btree (pipeline_id);

CREATE INDEX index_ci_pipeline_chat_data_on_project_id ON ci_pipeline_chat_data USING btree (project_id);

CREATE INDEX index_ci_pipeline_messages_on_pipeline_id ON ci_pipeline_messages USING btree (pipeline_id);

CREATE INDEX index_ci_pipeline_messages_on_project_id ON ci_pipeline_messages USING btree (project_id);

CREATE INDEX index_ci_pipeline_metadata_on_project_id ON ci_pipeline_metadata USING btree (project_id);

CREATE INDEX index_ci_pipeline_schedule_inputs_on_pipeline_schedule_id ON ci_pipeline_schedule_inputs USING btree (pipeline_schedule_id);

CREATE INDEX index_ci_pipeline_schedule_inputs_on_project_id ON ci_pipeline_schedule_inputs USING btree (project_id);

CREATE INDEX index_ci_pipeline_schedule_variables_on_project_id ON ci_pipeline_schedule_variables USING btree (project_id);

CREATE UNIQUE INDEX index_ci_pipeline_schedule_variables_on_schedule_id_and_key ON ci_pipeline_schedule_variables USING btree (pipeline_schedule_id, key);

CREATE INDEX index_ci_pipeline_schedules_on_id_and_next_run_at_and_active ON ci_pipeline_schedules USING btree (id, next_run_at) WHERE (active = true);

CREATE INDEX index_ci_pipeline_schedules_on_next_run_at_and_active ON ci_pipeline_schedules USING btree (next_run_at, active);

CREATE INDEX index_ci_pipeline_schedules_on_owner_id ON ci_pipeline_schedules USING btree (owner_id);

CREATE INDEX index_ci_pipeline_schedules_on_owner_id_and_id_and_active ON ci_pipeline_schedules USING btree (owner_id, id) WHERE (active = true);

CREATE INDEX index_ci_pipeline_schedules_on_project_id ON ci_pipeline_schedules USING btree (project_id);

CREATE INDEX index_ci_project_mirrors_on_namespace_id ON ci_project_mirrors USING btree (namespace_id);

CREATE UNIQUE INDEX index_ci_project_mirrors_on_project_id ON ci_project_mirrors USING btree (project_id);

CREATE UNIQUE INDEX index_ci_project_monthly_usages_on_project_id_and_date ON ci_project_monthly_usages USING btree (project_id, date);

CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_path ON ci_refs USING btree (project_id, ref_path);

CREATE UNIQUE INDEX index_ci_resource_groups_on_project_id_and_key ON ci_resource_groups USING btree (project_id, key);

CREATE INDEX index_ci_resources_on_build_id ON ci_resources USING btree (build_id);

CREATE INDEX index_ci_resources_on_project_id ON ci_resources USING btree (project_id);

CREATE UNIQUE INDEX index_ci_resources_on_resource_group_id_and_build_id ON ci_resources USING btree (resource_group_id, build_id);

CREATE INDEX index_ci_runner_namespaces_on_namespace_id ON ci_runner_namespaces USING btree (namespace_id);

CREATE UNIQUE INDEX index_ci_runner_namespaces_on_runner_id_and_namespace_id ON ci_runner_namespaces USING btree (runner_id, namespace_id);

CREATE INDEX index_ci_runner_projects_on_project_id ON ci_runner_projects USING btree (project_id);

CREATE UNIQUE INDEX index_ci_runner_versions_on_unique_status_and_version ON ci_runner_versions USING btree (status, version);

CREATE UNIQUE INDEX index_ci_running_builds_on_build_id ON ci_running_builds USING btree (build_id);

CREATE UNIQUE INDEX index_ci_running_builds_on_partition_id_build_id ON ci_running_builds USING btree (partition_id, build_id);

CREATE INDEX index_ci_running_builds_on_project_id ON ci_running_builds USING btree (project_id);

CREATE INDEX index_ci_running_builds_on_runner_id ON ci_running_builds USING btree (runner_id);

CREATE INDEX index_ci_secure_file_states_failed_verification ON ci_secure_file_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_ci_secure_file_states_needs_verification ON ci_secure_file_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_ci_secure_file_states_on_ci_secure_file_id ON ci_secure_file_states USING btree (ci_secure_file_id);

CREATE INDEX index_ci_secure_file_states_on_project_id ON ci_secure_file_states USING btree (project_id);

CREATE INDEX index_ci_secure_file_states_on_verification_state ON ci_secure_file_states USING btree (verification_state);

CREATE INDEX index_ci_secure_file_states_pending_verification ON ci_secure_file_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_ci_secure_files_on_project_id ON ci_secure_files USING btree (project_id);

CREATE INDEX index_ci_sources_pipelines_on_pipeline_id ON ci_sources_pipelines USING btree (pipeline_id);

CREATE INDEX index_ci_sources_pipelines_on_project_id ON ci_sources_pipelines USING btree (project_id);

CREATE INDEX index_ci_sources_pipelines_on_source_job_id ON ci_sources_pipelines USING btree (source_job_id);

CREATE INDEX index_ci_sources_pipelines_on_source_pipeline_id ON ci_sources_pipelines USING btree (source_pipeline_id);

CREATE INDEX index_ci_sources_pipelines_on_source_project_id ON ci_sources_pipelines USING btree (source_project_id);

CREATE INDEX index_ci_sources_projects_on_pipeline_id ON ci_sources_projects USING btree (pipeline_id);

CREATE UNIQUE INDEX index_ci_sources_projects_on_source_project_id_and_pipeline_id ON ci_sources_projects USING btree (source_project_id, pipeline_id);

CREATE INDEX index_ci_subscriptions_projects_author_id ON ci_subscriptions_projects USING btree (author_id);

CREATE INDEX index_ci_subscriptions_projects_on_upstream_project_id ON ci_subscriptions_projects USING btree (upstream_project_id);

CREATE UNIQUE INDEX index_ci_subscriptions_projects_unique_subscription ON ci_subscriptions_projects USING btree (downstream_project_id, upstream_project_id);

CREATE INDEX index_ci_triggers_on_owner_id ON ci_triggers USING btree (owner_id);

CREATE INDEX index_ci_triggers_on_project_id_and_id ON ci_triggers USING btree (project_id, id);

CREATE UNIQUE INDEX index_ci_triggers_on_token ON ci_triggers USING btree (token);

CREATE INDEX index_ci_unit_test_failures_on_build_id ON ci_unit_test_failures USING btree (build_id);

CREATE INDEX index_ci_unit_test_failures_on_project_id ON ci_unit_test_failures USING btree (project_id);

CREATE UNIQUE INDEX index_ci_unit_tests_on_project_id_and_key_hash ON ci_unit_tests USING btree (project_id, key_hash);

CREATE INDEX index_ci_variables_on_key ON ci_variables USING btree (key);

CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_scope ON ci_variables USING btree (project_id, key, environment_scope);

CREATE INDEX index_cicd_settings_on_namespace_id_where_stale_pruning_enabled ON namespace_ci_cd_settings USING btree (namespace_id) WHERE (allow_stale_runner_pruning = true);

CREATE INDEX index_cis_vulnerability_reads_on_cluster_agent_id ON vulnerability_reads USING btree (casted_cluster_agent_id) WHERE (report_type = 7);

CREATE INDEX index_closed_incidents_on_namespace_id_closed_at ON issues USING btree (namespace_id, closed_at) WHERE ((state_id = 2) AND (work_item_type_id = 2));

CREATE INDEX index_cluster_agent_migrations_on_agent_id ON cluster_agent_migrations USING btree (agent_id);

CREATE UNIQUE INDEX index_cluster_agent_migrations_on_cluster_id ON cluster_agent_migrations USING btree (cluster_id);

CREATE INDEX index_cluster_agent_migrations_on_issue_id ON cluster_agent_migrations USING btree (issue_id);

CREATE INDEX index_cluster_agent_migrations_on_project_id ON cluster_agent_migrations USING btree (project_id);

CREATE INDEX index_cluster_agent_tokens_on_agent_id_status_last_used_at ON cluster_agent_tokens USING btree (agent_id, status, last_used_at DESC NULLS LAST);

CREATE INDEX index_cluster_agent_tokens_on_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id);

CREATE INDEX index_cluster_agent_tokens_on_project_id ON cluster_agent_tokens USING btree (project_id);

CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_agent_tokens USING btree (token_encrypted);

CREATE INDEX index_cluster_agent_url_configurations_on_agent_id ON cluster_agent_url_configurations USING btree (agent_id);

CREATE INDEX index_cluster_agent_url_configurations_on_project_id ON cluster_agent_url_configurations USING btree (project_id);

CREATE INDEX index_cluster_agent_url_configurations_on_user_id ON cluster_agent_url_configurations USING btree (created_by_user_id) WHERE (created_by_user_id IS NOT NULL);

CREATE INDEX index_cluster_agents_on_created_by_user_id ON cluster_agents USING btree (created_by_user_id);

CREATE INDEX index_cluster_agents_on_project_id_and_has_vulnerabilities ON cluster_agents USING btree (project_id, has_vulnerabilities);

CREATE UNIQUE INDEX index_cluster_agents_on_project_id_and_name ON cluster_agents USING btree (project_id, name);

CREATE UNIQUE INDEX index_cluster_enabled_grants_on_namespace_id ON cluster_enabled_grants USING btree (namespace_id);

CREATE UNIQUE INDEX index_cluster_groups_on_cluster_id_and_group_id ON cluster_groups USING btree (cluster_id, group_id);

CREATE INDEX index_cluster_groups_on_group_id ON cluster_groups USING btree (group_id);

CREATE UNIQUE INDEX index_cluster_platforms_kubernetes_on_cluster_id ON cluster_platforms_kubernetes USING btree (cluster_id);

CREATE INDEX index_cluster_projects_on_cluster_id ON cluster_projects USING btree (cluster_id);

CREATE INDEX index_cluster_projects_on_project_id ON cluster_projects USING btree (project_id);

CREATE UNIQUE INDEX index_cluster_providers_aws_on_cluster_id ON cluster_providers_aws USING btree (cluster_id);

CREATE INDEX index_cluster_providers_aws_on_cluster_id_and_status ON cluster_providers_aws USING btree (cluster_id, status);

CREATE INDEX index_cluster_providers_gcp_on_cloud_run ON cluster_providers_gcp USING btree (cloud_run);

CREATE UNIQUE INDEX index_cluster_providers_gcp_on_cluster_id ON cluster_providers_gcp USING btree (cluster_id);

CREATE INDEX index_clusters_integration_prometheus_enabled ON clusters_integration_prometheus USING btree (enabled, created_at, cluster_id);

CREATE INDEX index_clusters_kubernetes_namespaces_on_cluster_project_id ON clusters_kubernetes_namespaces USING btree (cluster_project_id);

CREATE INDEX index_clusters_kubernetes_namespaces_on_environment_id ON clusters_kubernetes_namespaces USING btree (environment_id);

CREATE INDEX index_clusters_kubernetes_namespaces_on_project_id ON clusters_kubernetes_namespaces USING btree (project_id);

CREATE UNIQUE INDEX index_clusters_managed_resources_on_build_id ON clusters_managed_resources USING btree (build_id);

CREATE INDEX index_clusters_managed_resources_on_cluster_agent_id ON clusters_managed_resources USING btree (cluster_agent_id);

CREATE INDEX index_clusters_managed_resources_on_environment_id ON clusters_managed_resources USING btree (environment_id);

CREATE INDEX index_clusters_managed_resources_on_project_id ON clusters_managed_resources USING btree (project_id);

CREATE INDEX index_clusters_on_enabled_and_provider_type_and_id ON clusters USING btree (enabled, provider_type, id);

CREATE INDEX index_clusters_on_enabled_cluster_type_id_and_created_at ON clusters USING btree (enabled, cluster_type, id, created_at);

CREATE INDEX index_clusters_on_management_project_id ON clusters USING btree (management_project_id) WHERE (management_project_id IS NOT NULL);

CREATE INDEX index_clusters_on_user_id ON clusters USING btree (user_id);

CREATE UNIQUE INDEX index_commit_user_mentions_on_note_id ON commit_user_mentions USING btree (note_id);

CREATE INDEX index_compliance_framework_security_policies_on_namespace_id ON compliance_framework_security_policies USING btree (namespace_id);

CREATE INDEX index_compliance_framework_security_policies_on_project_id ON compliance_framework_security_policies USING btree (project_id);

CREATE INDEX index_compliance_frameworks_id_where_frameworks_not_null ON compliance_management_frameworks USING btree (id) WHERE (pipeline_configuration_full_path IS NOT NULL);

CREATE INDEX index_compliance_management_frameworks_on_name_trigram ON compliance_management_frameworks USING gin (name gin_trgm_ops);

CREATE INDEX index_compliance_requirements_on_namespace_id ON compliance_requirements USING btree (namespace_id);

CREATE INDEX index_compromised_password_detections_on_user_id ON compromised_password_detections USING btree (user_id);

CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON container_expiration_policies USING btree (next_run_at, enabled);

CREATE INDEX index_container_registry_data_repair_details_on_status ON container_registry_data_repair_details USING btree (status);

CREATE INDEX index_container_repositories_on_next_delete_attempt_at ON container_repositories USING btree (next_delete_attempt_at) WHERE (status = 0);

CREATE INDEX index_container_repositories_on_project_id_and_id ON container_repositories USING btree (project_id, id);

CREATE UNIQUE INDEX index_container_repositories_on_project_id_and_name ON container_repositories USING btree (project_id, name);

CREATE INDEX index_container_repositories_on_status_and_id ON container_repositories USING btree (status, id) WHERE (status IS NOT NULL);

CREATE INDEX index_container_repository_on_name_trigram ON container_repositories USING gin (name gin_trgm_ops);

CREATE INDEX index_container_repository_states_failed_verification ON container_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_container_repository_states_needs_verification ON container_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_container_repository_states_on_project_id ON container_repository_states USING btree (project_id);

CREATE INDEX index_container_repository_states_on_verification_state ON container_repository_states USING btree (verification_state);

CREATE INDEX index_container_repository_states_pending_verification ON container_repository_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE UNIQUE INDEX index_content_blocked_states_on_container_id_commit_sha_path ON content_blocked_states USING btree (container_identifier, commit_sha, path);

CREATE UNIQUE INDEX index_country_access_logs_on_user_id_and_country_code ON country_access_logs USING btree (user_id, country_code);

CREATE UNIQUE INDEX index_coverage_fuzzing_corpuses_on_package_id ON coverage_fuzzing_corpuses USING btree (package_id);

CREATE INDEX index_coverage_fuzzing_corpuses_on_project_id ON coverage_fuzzing_corpuses USING btree (project_id);

CREATE INDEX index_coverage_fuzzing_corpuses_on_user_id ON coverage_fuzzing_corpuses USING btree (user_id);

CREATE INDEX index_created_at_on_codeowner_approval_merge_request_rules ON approval_merge_request_rules USING btree (created_at) WHERE ((rule_type = 2) AND (section <> 'codeowners'::text));

CREATE INDEX index_csv_issue_imports_on_project_id ON csv_issue_imports USING btree (project_id);

CREATE INDEX index_csv_issue_imports_on_user_id ON csv_issue_imports USING btree (user_id);

CREATE INDEX index_custom_emoji_on_creator_id ON custom_emoji USING btree (creator_id);

CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji USING btree (namespace_id, name);

CREATE INDEX index_custom_field_select_options_on_namespace_id ON custom_field_select_options USING btree (namespace_id);

CREATE INDEX index_custom_fields_on_created_by_id ON custom_fields USING btree (created_by_id);

CREATE INDEX index_custom_fields_on_updated_by_id ON custom_fields USING btree (updated_by_id);

CREATE UNIQUE INDEX index_custom_software_licenses_on_project_id_and_name ON custom_software_licenses USING btree (project_id, name);

CREATE INDEX index_customer_relations_contacts_on_group_id ON customer_relations_contacts USING btree (group_id);

CREATE INDEX index_customer_relations_contacts_on_organization_id ON customer_relations_contacts USING btree (organization_id);

CREATE UNIQUE INDEX index_customer_relations_contacts_on_unique_email_per_group ON customer_relations_contacts USING btree (group_id, lower(email), id);

CREATE UNIQUE INDEX index_cycle_analytics_stage_event_hashes_on_org_id_sha_256 ON analytics_cycle_analytics_stage_event_hashes USING btree (organization_id, hash_sha256);

CREATE INDEX index_d2746151f0 ON instance_type_ci_runner_machines USING btree (ip_address);

CREATE INDEX index_d58435d85e ON project_type_ci_runner_machines USING btree (executor_type);

CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name);

CREATE INDEX index_dast_pre_scan_verification_steps_on_project_id ON dast_pre_scan_verification_steps USING btree (project_id);

CREATE UNIQUE INDEX index_dast_pre_scan_verifications_on_ci_pipeline_id ON dast_pre_scan_verifications USING btree (ci_pipeline_id);

CREATE INDEX index_dast_pre_scan_verifications_on_dast_profile_id ON dast_pre_scan_verifications USING btree (dast_profile_id);

CREATE INDEX index_dast_pre_scan_verifications_on_project_id ON dast_pre_scan_verifications USING btree (project_id);

CREATE INDEX index_dast_profile_schedules_active_next_run_at ON dast_profile_schedules USING btree (active, next_run_at);

CREATE UNIQUE INDEX index_dast_profile_schedules_on_dast_profile_id ON dast_profile_schedules USING btree (dast_profile_id);

CREATE INDEX index_dast_profile_schedules_on_project_id ON dast_profile_schedules USING btree (project_id);

CREATE INDEX index_dast_profile_schedules_on_user_id ON dast_profile_schedules USING btree (user_id);

CREATE INDEX index_dast_profiles_on_dast_scanner_profile_id ON dast_profiles USING btree (dast_scanner_profile_id);

CREATE INDEX index_dast_profiles_on_dast_site_profile_id ON dast_profiles USING btree (dast_site_profile_id);

CREATE UNIQUE INDEX index_dast_profiles_on_project_id_and_name ON dast_profiles USING btree (project_id, name);

CREATE UNIQUE INDEX index_dast_profiles_pipelines_on_ci_pipeline_id ON dast_profiles_pipelines USING btree (ci_pipeline_id);

CREATE INDEX index_dast_profiles_pipelines_on_project_id ON dast_profiles_pipelines USING btree (project_id);

CREATE INDEX index_dast_profiles_tags_on_project_id ON dast_profiles_tags USING btree (project_id);

CREATE INDEX index_dast_profiles_tags_on_tag_id ON dast_profiles_tags USING btree (tag_id);

CREATE INDEX index_dast_scanner_profiles_builds_on_project_id ON dast_scanner_profiles_builds USING btree (project_id);

CREATE UNIQUE INDEX index_dast_scanner_profiles_on_project_id_and_name ON dast_scanner_profiles USING btree (project_id, name);

CREATE INDEX index_dast_site_profile_secret_variables_on_project_id ON dast_site_profile_secret_variables USING btree (project_id);

CREATE INDEX index_dast_site_profiles_builds_on_project_id ON dast_site_profiles_builds USING btree (project_id);

CREATE INDEX index_dast_site_profiles_on_dast_site_id ON dast_site_profiles USING btree (dast_site_id);

CREATE UNIQUE INDEX index_dast_site_profiles_on_project_id_and_name ON dast_site_profiles USING btree (project_id, name);

CREATE UNIQUE INDEX index_dast_site_token_on_project_id_and_url ON dast_site_tokens USING btree (project_id, url);

CREATE UNIQUE INDEX index_dast_site_token_on_token ON dast_site_tokens USING btree (token);

CREATE INDEX index_dast_site_tokens_on_project_id ON dast_site_tokens USING btree (project_id);

CREATE INDEX index_dast_site_validations_on_dast_site_token_id ON dast_site_validations USING btree (dast_site_token_id);

CREATE INDEX index_dast_site_validations_on_project_id ON dast_site_validations USING btree (project_id);

CREATE INDEX index_dast_site_validations_on_url_base_and_state ON dast_site_validations USING btree (url_base, state);

CREATE INDEX index_dast_sites_on_dast_site_validation_id ON dast_sites USING btree (dast_site_validation_id);

CREATE UNIQUE INDEX index_dast_sites_on_project_id_and_url ON dast_sites USING btree (project_id, url);

CREATE UNIQUE INDEX index_dep_prox_manifests_on_group_id_file_name_and_status ON dependency_proxy_manifests USING btree (group_id, file_name, status);

CREATE INDEX index_dependency_list_export_parts_on_dependency_list_export_id ON dependency_list_export_parts USING btree (dependency_list_export_id);

CREATE INDEX index_dependency_list_export_parts_on_organization_id ON dependency_list_export_parts USING btree (organization_id);

CREATE INDEX index_dependency_list_exports_on_group_id ON dependency_list_exports USING btree (group_id);

CREATE INDEX index_dependency_list_exports_on_organization_id ON dependency_list_exports USING btree (organization_id);

CREATE INDEX index_dependency_list_exports_on_pipeline_id ON dependency_list_exports USING btree (pipeline_id);

CREATE INDEX index_dependency_list_exports_on_project_id ON dependency_list_exports USING btree (project_id);

CREATE INDEX index_dependency_list_exports_on_user_id ON dependency_list_exports USING btree (user_id);

CREATE INDEX index_dependency_proxy_blob_states_failed_verification ON dependency_proxy_blob_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_dependency_proxy_blob_states_needs_verification ON dependency_proxy_blob_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_dependency_proxy_blob_states_on_dependency_proxy_blob_id ON dependency_proxy_blob_states USING btree (dependency_proxy_blob_id);

CREATE INDEX index_dependency_proxy_blob_states_on_group_id ON dependency_proxy_blob_states USING btree (group_id);

CREATE INDEX index_dependency_proxy_blob_states_on_verification_state ON dependency_proxy_blob_states USING btree (verification_state);

CREATE INDEX index_dependency_proxy_blob_states_pending_verification ON dependency_proxy_blob_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_dependency_proxy_blobs_on_group_id_and_file_name ON dependency_proxy_blobs USING btree (group_id, file_name);

CREATE INDEX index_dependency_proxy_blobs_on_group_id_status_read_at_id ON dependency_proxy_blobs USING btree (group_id, status, read_at, id);

CREATE INDEX index_dependency_proxy_blobs_on_status ON dependency_proxy_blobs USING btree (status);

CREATE INDEX index_dependency_proxy_group_settings_on_group_id ON dependency_proxy_group_settings USING btree (group_id);

CREATE INDEX index_dependency_proxy_manifest_states_on_group_id ON dependency_proxy_manifest_states USING btree (group_id);

CREATE INDEX index_dependency_proxy_manifests_on_group_id_status_read_at_id ON dependency_proxy_manifests USING btree (group_id, status, read_at, id);

CREATE INDEX index_dependency_proxy_manifests_on_status ON dependency_proxy_manifests USING btree (status);

CREATE INDEX index_deploy_key_id_on_protected_branch_push_access_levels ON protected_branch_push_access_levels USING btree (deploy_key_id);

CREATE INDEX index_deploy_keys_projects_on_deploy_key_id ON deploy_keys_projects USING btree (deploy_key_id);

CREATE INDEX index_deploy_keys_projects_on_project_id ON deploy_keys_projects USING btree (project_id);

CREATE INDEX index_deploy_tokens_on_creator_id ON deploy_tokens USING btree (creator_id);

CREATE INDEX index_deploy_tokens_on_group_id ON deploy_tokens USING btree (group_id);

CREATE INDEX index_deploy_tokens_on_project_id ON deploy_tokens USING btree (project_id);

CREATE UNIQUE INDEX index_deploy_tokens_on_token_encrypted ON deploy_tokens USING btree (token_encrypted);

CREATE INDEX index_deployment_approvals_on_approval_rule_id ON deployment_approvals USING btree (approval_rule_id);

CREATE INDEX index_deployment_approvals_on_ci_build_id ON deployment_approvals USING btree (ci_build_id);

CREATE INDEX index_deployment_approvals_on_created_at_and_id ON deployment_approvals USING btree (created_at, id);

CREATE UNIQUE INDEX index_deployment_approvals_on_deployment_user_approval_rule ON deployment_approvals USING btree (deployment_id, user_id, approval_rule_id);

CREATE INDEX index_deployment_approvals_on_project_id ON deployment_approvals USING btree (project_id);

CREATE INDEX index_deployment_approvals_on_user_id ON deployment_approvals USING btree (user_id);

CREATE UNIQUE INDEX index_deployment_clusters_on_cluster_id_and_deployment_id ON deployment_clusters USING btree (cluster_id, deployment_id);

CREATE INDEX index_deployment_merge_requests_on_merge_request_id ON deployment_merge_requests USING btree (merge_request_id);

CREATE INDEX index_deployments_for_visible_scope ON deployments USING btree (environment_id, finished_at DESC) WHERE (status = ANY (ARRAY[1, 2, 3, 4, 6]));

CREATE INDEX index_deployments_on_archived_project_id_iid ON deployments USING btree (archived, project_id, iid);

CREATE INDEX index_deployments_on_created_at ON deployments USING btree (created_at);

CREATE INDEX index_deployments_on_deployable_type_and_deployable_id ON deployments USING btree (deployable_type, deployable_id);

CREATE INDEX index_deployments_on_environment_id_and_id ON deployments USING btree (environment_id, id);

CREATE INDEX index_deployments_on_environment_id_and_ref ON deployments USING btree (environment_id, ref);

CREATE INDEX index_deployments_on_environment_id_status_and_finished_at ON deployments USING btree (environment_id, status, finished_at);

CREATE INDEX index_deployments_on_environment_id_status_and_id ON deployments USING btree (environment_id, status, id);

CREATE INDEX index_deployments_on_environment_status_sha ON deployments USING btree (environment_id, status, sha);

CREATE INDEX index_deployments_on_id_and_status_and_created_at ON deployments USING btree (id, status, created_at);

CREATE INDEX index_deployments_on_project_and_environment_and_updated_at_id ON deployments USING btree (project_id, environment_id, updated_at, id);

CREATE INDEX index_deployments_on_project_and_finished ON deployments USING btree (project_id, finished_at) WHERE (status = 2);

CREATE INDEX index_deployments_on_project_id_and_id ON deployments USING btree (project_id, id DESC);

CREATE UNIQUE INDEX index_deployments_on_project_id_and_iid ON deployments USING btree (project_id, iid);

CREATE INDEX index_deployments_on_project_id_and_status_and_created_at ON deployments USING btree (project_id, status, created_at);

CREATE INDEX index_deployments_on_project_id_and_updated_at_and_id ON deployments USING btree (project_id, updated_at DESC, id DESC);

CREATE INDEX index_deployments_on_user_id_and_status_and_created_at ON deployments USING btree (user_id, status, created_at);

CREATE INDEX index_description_versions_on_epic_id ON description_versions USING btree (epic_id) WHERE (epic_id IS NOT NULL);

CREATE INDEX index_description_versions_on_issue_id ON description_versions USING btree (issue_id) WHERE (issue_id IS NOT NULL);

CREATE INDEX index_description_versions_on_merge_request_id ON description_versions USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL);

CREATE INDEX index_design_management_designs_issue_id_relative_position_id ON design_management_designs USING btree (issue_id, relative_position, id);

CREATE UNIQUE INDEX index_design_management_designs_on_iid_and_project_id ON design_management_designs USING btree (project_id, iid);

CREATE UNIQUE INDEX index_design_management_designs_on_issue_id_and_filename ON design_management_designs USING btree (issue_id, filename);

CREATE INDEX index_design_management_designs_on_namespace_id ON design_management_designs USING btree (namespace_id);

CREATE INDEX index_design_management_designs_on_project_id ON design_management_designs USING btree (project_id);

CREATE INDEX index_design_management_designs_versions_on_design_id ON design_management_designs_versions USING btree (design_id);

CREATE INDEX index_design_management_designs_versions_on_event ON design_management_designs_versions USING btree (event);

CREATE INDEX index_design_management_designs_versions_on_namespace_id ON design_management_designs_versions USING btree (namespace_id);

CREATE INDEX index_design_management_designs_versions_on_version_id ON design_management_designs_versions USING btree (version_id);

CREATE INDEX index_design_management_repositories_on_namespace_id ON design_management_repositories USING btree (namespace_id);

CREATE UNIQUE INDEX index_design_management_repositories_on_project_id ON design_management_repositories USING btree (project_id);

CREATE INDEX index_design_management_repository_states_failed_verification ON design_management_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_design_management_repository_states_needs_verification ON design_management_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_design_management_repository_states_on_namespace_id ON design_management_repository_states USING btree (namespace_id);

CREATE INDEX index_design_management_repository_states_on_verification_state ON design_management_repository_states USING btree (verification_state);

CREATE INDEX index_design_management_repository_states_pending_verification ON design_management_repository_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_design_management_versions_on_author_id ON design_management_versions USING btree (author_id) WHERE (author_id IS NOT NULL);

CREATE INDEX index_design_management_versions_on_issue_id_and_id ON design_management_versions USING btree (issue_id, id);

CREATE INDEX index_design_management_versions_on_namespace_id ON design_management_versions USING btree (namespace_id);

CREATE UNIQUE INDEX index_design_management_versions_on_sha_and_issue_id ON design_management_versions USING btree (sha, issue_id);

CREATE INDEX index_design_user_mentions_on_namespace_id ON design_user_mentions USING btree (namespace_id);

CREATE UNIQUE INDEX index_design_user_mentions_on_note_id ON design_user_mentions USING btree (note_id);

CREATE UNIQUE INDEX index_diff_note_positions_on_note_id_and_diff_type ON diff_note_positions USING btree (note_id, diff_type);

CREATE INDEX index_dingtalk_tracker_data_on_integration_id ON dingtalk_tracker_data USING btree (integration_id);

CREATE UNIQUE INDEX index_dora_configurations_on_project_id ON dora_configurations USING btree (project_id);

CREATE UNIQUE INDEX index_dora_daily_metrics_on_environment_id_and_date ON dora_daily_metrics USING btree (environment_id, date);

CREATE INDEX index_dora_daily_metrics_on_project_id_and_date ON dora_daily_metrics USING btree (project_id, date);

CREATE UNIQUE INDEX index_dora_performance_scores_on_project_id_and_date ON dora_performance_scores USING btree (project_id, date);

CREATE INDEX index_draft_notes_on_author_id ON draft_notes USING btree (author_id);

CREATE INDEX index_draft_notes_on_discussion_id ON draft_notes USING btree (discussion_id);

CREATE INDEX index_draft_notes_on_merge_request_id ON draft_notes USING btree (merge_request_id);

CREATE INDEX index_draft_notes_on_project_id ON draft_notes USING btree (project_id);

CREATE INDEX index_dts_on_expiring_at_seven_days_notification_sent_at ON deploy_tokens USING btree (expires_at, id) WHERE ((revoked = false) AND (seven_days_notification_sent_at IS NULL));

CREATE INDEX index_dts_on_expiring_at_sixty_days_notification_sent_at ON deploy_tokens USING btree (expires_at, id) WHERE ((revoked = false) AND (sixty_days_notification_sent_at IS NULL));

CREATE INDEX index_dts_on_expiring_at_thirty_days_notification_sent_at ON deploy_tokens USING btree (expires_at, id) WHERE ((revoked = false) AND (thirty_days_notification_sent_at IS NULL));

CREATE INDEX index_duo_workflows_checkpoint_writes_on_namespace_id ON duo_workflows_checkpoint_writes USING btree (namespace_id);

CREATE INDEX index_duo_workflows_checkpoint_writes_on_project_id ON duo_workflows_checkpoint_writes USING btree (project_id);

CREATE INDEX index_duo_workflows_checkpoint_writes_thread_ts ON duo_workflows_checkpoint_writes USING btree (workflow_id, thread_ts);

CREATE INDEX index_duo_workflows_checkpoints_on_namespace_id ON duo_workflows_checkpoints USING btree (namespace_id);

CREATE INDEX index_duo_workflows_checkpoints_on_project_id ON duo_workflows_checkpoints USING btree (project_id);

CREATE INDEX index_duo_workflows_events_on_namespace_id ON duo_workflows_events USING btree (namespace_id);

CREATE INDEX index_duo_workflows_events_on_project_id ON duo_workflows_events USING btree (project_id);

CREATE INDEX index_duo_workflows_events_on_workflow_id ON duo_workflows_events USING btree (workflow_id);

CREATE UNIQUE INDEX index_duo_workflows_workflow_checkpoints_unique_thread ON duo_workflows_checkpoints USING btree (workflow_id, thread_ts);

CREATE INDEX index_duo_workflows_workflows_on_namespace_id ON duo_workflows_workflows USING btree (namespace_id);

CREATE INDEX index_duo_workflows_workflows_on_project_id ON duo_workflows_workflows USING btree (project_id);

CREATE INDEX index_duo_workflows_workflows_on_user_id ON duo_workflows_workflows USING btree (user_id);

CREATE INDEX index_duo_workflows_workloads_on_project_id ON duo_workflows_workloads USING btree (project_id);

CREATE INDEX index_duo_workflows_workloads_on_workflow_id ON duo_workflows_workloads USING btree (workflow_id);

CREATE INDEX index_duo_workflows_workloads_on_workload_id ON duo_workflows_workloads USING btree (workload_id);

CREATE INDEX index_e4459c2bb7 ON project_type_ci_runner_machines USING btree (organization_id);

CREATE INDEX index_early_access_program_tracking_events_on_category ON early_access_program_tracking_events USING btree (category);

CREATE INDEX index_early_access_program_tracking_events_on_event_label ON early_access_program_tracking_events USING btree (event_label);

CREATE INDEX index_early_access_program_tracking_events_on_event_name ON early_access_program_tracking_events USING btree (event_name);

CREATE INDEX index_early_access_program_tracking_events_on_user_id ON early_access_program_tracking_events USING btree (user_id);

CREATE INDEX index_ee7c87e634 ON group_type_ci_runner_machines USING btree (ip_address);

CREATE UNIQUE INDEX index_elastic_index_settings_on_alias_name ON elastic_index_settings USING btree (alias_name);

CREATE INDEX index_elastic_reindexing_subtasks_on_elastic_reindexing_task_id ON elastic_reindexing_subtasks USING btree (elastic_reindexing_task_id);

CREATE UNIQUE INDEX index_elastic_reindexing_tasks_on_in_progress ON elastic_reindexing_tasks USING btree (in_progress) WHERE in_progress;

CREATE INDEX index_elastic_reindexing_tasks_on_state ON elastic_reindexing_tasks USING btree (state);

CREATE INDEX index_elasticsearch_indexed_namespaces_on_created_at ON elasticsearch_indexed_namespaces USING btree (created_at);

CREATE UNIQUE INDEX index_emails_on_confirmation_token ON emails USING btree (confirmation_token);

CREATE INDEX index_emails_on_created_at_where_confirmed_at_is_null ON emails USING btree (created_at) WHERE (confirmed_at IS NULL);

CREATE INDEX index_emails_on_detumbled_email ON emails USING btree (detumbled_email);

CREATE UNIQUE INDEX index_emails_on_email ON emails USING btree (email);

CREATE INDEX index_emails_on_email_trigram ON emails USING gin (email gin_trgm_ops);

CREATE INDEX index_emails_on_user_id ON emails USING btree (user_id);

CREATE INDEX index_enabled_clusters_on_id ON clusters USING btree (id) WHERE (enabled = true);

CREATE INDEX index_environments_cluster_agent_id ON environments USING btree (cluster_agent_id) WHERE (cluster_agent_id IS NOT NULL);

CREATE INDEX index_environments_name_without_type ON environments USING btree (project_id, lower(ltrim(ltrim((name)::text, (environment_type)::text), '/'::text)) varchar_pattern_ops, state);

CREATE INDEX index_environments_on_merge_request_id ON environments USING btree (merge_request_id);

CREATE INDEX index_environments_on_name_varchar_pattern_ops ON environments USING btree (name varchar_pattern_ops);

CREATE INDEX index_environments_on_project_id_and_id ON environments USING btree (project_id, id);

CREATE UNIQUE INDEX index_environments_on_project_id_and_name ON environments USING btree (project_id, name);

CREATE UNIQUE INDEX index_environments_on_project_id_and_slug ON environments USING btree (project_id, slug);

CREATE INDEX index_environments_on_project_id_and_tier ON environments USING btree (project_id, tier) WHERE (tier IS NOT NULL);

CREATE INDEX index_environments_on_project_id_state_environment_type ON environments USING btree (project_id, state, environment_type);

CREATE INDEX index_environments_on_project_name_varchar_pattern_ops_state ON environments USING btree (project_id, lower((name)::text) varchar_pattern_ops, state);

CREATE INDEX index_environments_on_state_and_auto_delete_at ON environments USING btree (auto_delete_at) WHERE ((auto_delete_at IS NOT NULL) AND ((state)::text = 'stopped'::text));

CREATE INDEX index_environments_on_state_and_auto_stop_at ON environments USING btree (state, auto_stop_at) WHERE ((auto_stop_at IS NOT NULL) AND ((state)::text = 'available'::text));

CREATE INDEX index_environments_on_updated_at_for_stopping_state ON environments USING btree (updated_at) WHERE ((state)::text = 'stopping'::text);

CREATE UNIQUE INDEX index_epic_board_list_preferences_on_user_and_list ON boards_epic_list_user_preferences USING btree (user_id, epic_list_id);

CREATE UNIQUE INDEX index_epic_board_recent_visits_on_user_group_and_board ON boards_epic_board_recent_visits USING btree (user_id, group_id, epic_board_id);

CREATE INDEX index_epic_issues_on_epic_id_and_issue_id ON epic_issues USING btree (epic_id, issue_id);

CREATE UNIQUE INDEX index_epic_issues_on_issue_id ON epic_issues USING btree (issue_id);

CREATE INDEX index_epic_issues_on_namespace_id ON epic_issues USING btree (namespace_id);

CREATE INDEX index_epic_user_mentions_on_group_id ON epic_user_mentions USING btree (group_id);

CREATE UNIQUE INDEX index_epic_user_mentions_on_note_id ON epic_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);

CREATE INDEX index_epics_on_assignee_id ON epics USING btree (assignee_id);

CREATE INDEX index_epics_on_author_id ON epics USING btree (author_id);

CREATE INDEX index_epics_on_closed_by_id ON epics USING btree (closed_by_id);

CREATE INDEX index_epics_on_confidential ON epics USING btree (confidential);

CREATE INDEX index_epics_on_due_date_sourcing_epic_id ON epics USING btree (due_date_sourcing_epic_id) WHERE (due_date_sourcing_epic_id IS NOT NULL);

CREATE INDEX index_epics_on_due_date_sourcing_milestone_id ON epics USING btree (due_date_sourcing_milestone_id);

CREATE INDEX index_epics_on_end_date ON epics USING btree (end_date);

CREATE UNIQUE INDEX index_epics_on_group_id_and_external_key ON epics USING btree (group_id, external_key) WHERE (external_key IS NOT NULL);

CREATE UNIQUE INDEX index_epics_on_group_id_and_iid ON epics USING btree (group_id, iid);

CREATE INDEX index_epics_on_group_id_and_iid_varchar_pattern ON epics USING btree (group_id, ((iid)::character varying) varchar_pattern_ops);

CREATE INDEX index_epics_on_iid ON epics USING btree (iid);

CREATE INDEX index_epics_on_last_edited_by_id ON epics USING btree (last_edited_by_id);

CREATE INDEX index_epics_on_parent_id ON epics USING btree (parent_id);

CREATE INDEX index_epics_on_start_date ON epics USING btree (start_date);

CREATE INDEX index_epics_on_start_date_sourcing_epic_id ON epics USING btree (start_date_sourcing_epic_id) WHERE (start_date_sourcing_epic_id IS NOT NULL);

CREATE INDEX index_epics_on_start_date_sourcing_milestone_id ON epics USING btree (start_date_sourcing_milestone_id);

CREATE INDEX index_error_tracking_client_for_enabled_check ON error_tracking_client_keys USING btree (project_id, public_key) WHERE (active = true);

CREATE INDEX index_error_tracking_client_keys_on_project_id ON error_tracking_client_keys USING btree (project_id);

CREATE INDEX index_error_tracking_error_events_on_error_id ON error_tracking_error_events USING btree (error_id);

CREATE INDEX index_error_tracking_error_events_on_project_id ON error_tracking_error_events USING btree (project_id);

CREATE INDEX index_error_tracking_errors_on_project_id ON error_tracking_errors USING btree (project_id);

CREATE INDEX index_esc_protected_branches_on_external_status_check_id ON external_status_checks_protected_branches USING btree (external_status_check_id);

CREATE INDEX index_esc_protected_branches_on_protected_branch_id ON external_status_checks_protected_branches USING btree (protected_branch_id);

CREATE UNIQUE INDEX index_escalation_rules_on_all_attributes ON incident_management_escalation_rules USING btree (policy_id, oncall_schedule_id, status, elapsed_time_seconds, user_id);

CREATE INDEX index_escalation_rules_on_user ON incident_management_escalation_rules USING btree (user_id);

CREATE INDEX index_et_errors_on_project_id_and_status_and_id ON error_tracking_errors USING btree (project_id, status, id);

CREATE INDEX index_et_errors_on_project_id_and_status_events_count_id_desc ON error_tracking_errors USING btree (project_id, status, events_count DESC, id DESC);

CREATE INDEX index_et_errors_on_project_id_and_status_first_seen_at_id_desc ON error_tracking_errors USING btree (project_id, status, first_seen_at DESC, id DESC);

CREATE INDEX index_et_errors_on_project_id_and_status_last_seen_at_id_desc ON error_tracking_errors USING btree (project_id, status, last_seen_at DESC, id DESC);

CREATE INDEX index_events_author_id_group_id_action_target_type_created_at ON events USING btree (author_id, group_id, action, target_type, created_at);

CREATE INDEX index_events_author_id_project_id_action_target_type_created_at ON events USING btree (author_id, project_id, action, target_type, created_at);

CREATE INDEX index_events_for_followed_users ON events USING btree (author_id, target_type, action, id);

CREATE INDEX index_events_for_group_activity ON events USING btree (group_id, target_type, action, id) WHERE (group_id IS NOT NULL);

CREATE INDEX index_events_for_project_activity ON events USING btree (project_id, target_type, action, id);

CREATE INDEX index_events_on_author_id_and_created_at ON events USING btree (author_id, created_at);

CREATE INDEX index_events_on_author_id_and_id ON events USING btree (author_id, id);

CREATE INDEX index_events_on_created_at_and_id ON events USING btree (created_at, id) WHERE (created_at > '2021-08-27 00:00:00+00'::timestamp with time zone);

CREATE INDEX index_events_on_group_id_and_id ON events USING btree (group_id, id) WHERE (group_id IS NOT NULL);

CREATE INDEX index_events_on_personal_namespace_id ON events USING btree (personal_namespace_id) WHERE (personal_namespace_id IS NOT NULL);

CREATE INDEX index_events_on_project_id_and_created_at ON events USING btree (project_id, created_at);

CREATE INDEX index_events_on_project_id_and_id ON events USING btree (project_id, id);

CREATE UNIQUE INDEX index_events_on_target_type_and_target_id_and_fingerprint ON events USING btree (target_type, target_id, fingerprint);

CREATE INDEX index_evidences_on_project_id ON evidences USING btree (project_id);

CREATE INDEX index_evidences_on_release_id ON evidences USING btree (release_id);

CREATE INDEX index_excluded_merge_requests_on_merge_request_id ON excluded_merge_requests USING btree (merge_request_id);

CREATE UNIQUE INDEX index_external_audit_event_destinations_on_namespace_id ON audit_events_external_audit_event_destinations USING btree (namespace_id, destination_url);

CREATE UNIQUE INDEX index_external_pull_requests_on_project_and_branches ON external_pull_requests USING btree (project_id, source_branch, target_branch);

CREATE INDEX index_external_status_checks_protected_branches_on_project_id ON external_status_checks_protected_branches USING btree (project_id);

CREATE INDEX index_f4903d2246 ON instance_type_ci_runner_machines USING btree (organization_id);

CREATE UNIQUE INDEX index_feature_flags_clients_on_project_id_and_token_encrypted ON operations_feature_flags_clients USING btree (project_id, token_encrypted);

CREATE UNIQUE INDEX index_feature_gates_on_feature_key_and_key_and_value ON feature_gates USING btree (feature_key, key, value);

CREATE UNIQUE INDEX index_features_on_key ON features USING btree (key);

CREATE INDEX index_for_protected_environment_group_id_of_protected_environme ON protected_environment_deploy_access_levels USING btree (protected_environment_group_id);

CREATE INDEX index_for_protected_environment_project_id_of_protected_environ ON protected_environment_deploy_access_levels USING btree (protected_environment_project_id);

CREATE INDEX index_for_security_scans_scan_type ON security_scans USING btree (scan_type, project_id, pipeline_id) WHERE (status = 1);

CREATE INDEX index_for_status_per_branch_per_project ON merge_trains USING btree (target_project_id, target_branch, status);

CREATE INDEX index_fork_network_members_on_fork_network_id ON fork_network_members USING btree (fork_network_id);

CREATE INDEX index_fork_network_members_on_forked_from_project_id ON fork_network_members USING btree (forked_from_project_id);

CREATE UNIQUE INDEX index_fork_network_members_on_project_id ON fork_network_members USING btree (project_id);

CREATE INDEX index_fork_networks_on_organization_id ON fork_networks USING btree (organization_id);

CREATE UNIQUE INDEX index_fork_networks_on_root_project_id ON fork_networks USING btree (root_project_id);

CREATE INDEX index_geo_event_log_on_cache_invalidation_event_id ON geo_event_log USING btree (cache_invalidation_event_id) WHERE (cache_invalidation_event_id IS NOT NULL);

CREATE INDEX index_geo_event_log_on_geo_event_id ON geo_event_log USING btree (geo_event_id) WHERE (geo_event_id IS NOT NULL);

CREATE INDEX index_geo_node_namespace_links_on_geo_node_id ON geo_node_namespace_links USING btree (geo_node_id);

CREATE UNIQUE INDEX index_geo_node_namespace_links_on_geo_node_id_and_namespace_id ON geo_node_namespace_links USING btree (geo_node_id, namespace_id);

CREATE INDEX index_geo_node_namespace_links_on_namespace_id ON geo_node_namespace_links USING btree (namespace_id);

CREATE UNIQUE INDEX index_geo_node_statuses_on_geo_node_id ON geo_node_statuses USING btree (geo_node_id);

CREATE INDEX index_geo_nodes_on_access_key ON geo_nodes USING btree (access_key);

CREATE UNIQUE INDEX index_geo_nodes_on_name ON geo_nodes USING btree (name);

CREATE INDEX index_geo_nodes_on_primary ON geo_nodes USING btree ("primary");

CREATE INDEX index_ghost_user_migrations_on_consume_after_id ON ghost_user_migrations USING btree (consume_after, id);

CREATE UNIQUE INDEX index_ghost_user_migrations_on_user_id ON ghost_user_migrations USING btree (user_id);

CREATE INDEX index_gin_ci_namespace_mirrors_on_traversal_ids ON ci_namespace_mirrors USING gin (traversal_ids);

CREATE INDEX index_gin_ci_pending_builds_on_namespace_traversal_ids ON ci_pending_builds USING gin (namespace_traversal_ids);

CREATE INDEX index_gitlab_subscription_histories_on_gitlab_subscription_id ON gitlab_subscription_histories USING btree (gitlab_subscription_id);

CREATE INDEX index_gitlab_subscriptions_on_end_date_and_namespace_id ON gitlab_subscriptions USING btree (end_date, namespace_id);

CREATE INDEX index_gitlab_subscriptions_on_hosted_plan_id_and_trial ON gitlab_subscriptions USING btree (hosted_plan_id, trial);

CREATE INDEX index_gitlab_subscriptions_on_max_seats_used_changed_at ON gitlab_subscriptions USING btree (max_seats_used_changed_at, namespace_id);

CREATE UNIQUE INDEX index_gitlab_subscriptions_on_namespace_id ON gitlab_subscriptions USING btree (namespace_id);

CREATE INDEX index_gitlab_subscriptions_on_trial_and_trial_starts_on ON gitlab_subscriptions USING btree (trial, trial_starts_on);

CREATE UNIQUE INDEX index_gpg_key_subkeys_on_fingerprint ON gpg_key_subkeys USING btree (fingerprint);

CREATE INDEX index_gpg_key_subkeys_on_gpg_key_id ON gpg_key_subkeys USING btree (gpg_key_id);

CREATE UNIQUE INDEX index_gpg_key_subkeys_on_keyid ON gpg_key_subkeys USING btree (keyid);

CREATE UNIQUE INDEX index_gpg_keys_on_fingerprint ON gpg_keys USING btree (fingerprint);

CREATE UNIQUE INDEX index_gpg_keys_on_primary_keyid ON gpg_keys USING btree (primary_keyid);

CREATE INDEX index_gpg_keys_on_user_id ON gpg_keys USING btree (user_id);

CREATE UNIQUE INDEX index_gpg_signatures_on_commit_sha ON gpg_signatures USING btree (commit_sha);

CREATE INDEX index_gpg_signatures_on_gpg_key_id_and_id ON gpg_signatures USING btree (gpg_key_id, id);

CREATE INDEX index_gpg_signatures_on_gpg_key_primary_keyid ON gpg_signatures USING btree (gpg_key_primary_keyid);

CREATE INDEX index_gpg_signatures_on_gpg_key_subkey_id ON gpg_signatures USING btree (gpg_key_subkey_id);

CREATE INDEX index_gpg_signatures_on_project_id ON gpg_signatures USING btree (project_id);

CREATE INDEX index_grafana_integrations_on_enabled ON grafana_integrations USING btree (enabled) WHERE (enabled IS TRUE);

CREATE INDEX index_grafana_integrations_on_project_id ON grafana_integrations USING btree (project_id);

CREATE INDEX index_group_crm_settings_on_group_id ON group_crm_settings USING btree (group_id);

CREATE INDEX index_group_crm_settings_on_source_group_id ON group_crm_settings USING btree (source_group_id);

CREATE UNIQUE INDEX index_group_custom_attributes_on_group_id_and_key ON group_custom_attributes USING btree (group_id, key);

CREATE INDEX index_group_custom_attributes_on_key_and_value ON group_custom_attributes USING btree (key, value);

CREATE INDEX index_group_deletion_schedules_on_marked_for_deletion_on ON group_deletion_schedules USING btree (marked_for_deletion_on);

CREATE INDEX index_group_deletion_schedules_on_user_id ON group_deletion_schedules USING btree (user_id);

CREATE UNIQUE INDEX index_group_deploy_keys_group_on_group_deploy_key_and_group_ids ON group_deploy_keys_groups USING btree (group_id, group_deploy_key_id);

CREATE INDEX index_group_deploy_keys_groups_on_group_deploy_key_id ON group_deploy_keys_groups USING btree (group_deploy_key_id);

CREATE INDEX index_group_deploy_keys_on_fingerprint ON group_deploy_keys USING btree (fingerprint);

CREATE UNIQUE INDEX index_group_deploy_keys_on_fingerprint_sha256_unique ON group_deploy_keys USING btree (fingerprint_sha256);

CREATE INDEX index_group_deploy_keys_on_user_id ON group_deploy_keys USING btree (user_id);

CREATE INDEX index_group_deploy_tokens_on_deploy_token_id ON group_deploy_tokens USING btree (deploy_token_id);

CREATE UNIQUE INDEX index_group_deploy_tokens_on_group_and_deploy_token_ids ON group_deploy_tokens USING btree (group_id, deploy_token_id);

CREATE INDEX index_group_group_links_on_member_role_id ON group_group_links USING btree (member_role_id);

CREATE UNIQUE INDEX index_group_group_links_on_shared_group_and_shared_with_group ON group_group_links USING btree (shared_group_id, shared_with_group_id);

CREATE INDEX index_group_group_links_on_shared_with_group_and_group_access ON group_group_links USING btree (shared_with_group_id, group_access);

CREATE INDEX index_group_group_links_on_shared_with_group_and_shared_group ON group_group_links USING btree (shared_with_group_id, shared_group_id);

CREATE INDEX index_group_id_on_group_microsoft_access_tokens ON system_access_group_microsoft_graph_access_tokens USING btree (group_id);

CREATE INDEX index_group_import_states_on_group_id ON group_import_states USING btree (group_id);

CREATE INDEX index_group_import_states_on_user_id ON group_import_states USING btree (user_id) WHERE (user_id IS NOT NULL);

CREATE UNIQUE INDEX index_group_microsoft_applications_on_temp_source_id ON system_access_group_microsoft_applications USING btree (temp_source_id);

CREATE UNIQUE INDEX index_group_push_rules_on_group_id ON group_push_rules USING btree (group_id);

CREATE INDEX index_group_repository_storage_moves_on_group_id ON group_repository_storage_moves USING btree (group_id);

CREATE INDEX index_group_saved_replies_on_group_id ON group_saved_replies USING btree (group_id);

CREATE UNIQUE INDEX index_group_scim_access_tokens_on_group_id_and_token ON group_scim_auth_access_tokens USING btree (group_id, token_encrypted);

CREATE UNIQUE INDEX index_group_scim_auth_access_tokens_on_temp_source_id ON group_scim_auth_access_tokens USING btree (temp_source_id);

CREATE INDEX index_group_scim_identities_on_group_id ON group_scim_identities USING btree (group_id);

CREATE UNIQUE INDEX index_group_scim_identities_on_lower_extern_uid_group_id ON group_scim_identities USING btree (lower(extern_uid), group_id);

CREATE UNIQUE INDEX index_group_scim_identities_on_temp_source_id ON group_scim_identities USING btree (temp_source_id);

CREATE UNIQUE INDEX index_group_scim_identities_on_user_id_and_group_id ON group_scim_identities USING btree (user_id, group_id);

CREATE INDEX index_group_security_exclusions_on_group_id ON group_security_exclusions USING btree (group_id);

CREATE UNIQUE INDEX index_group_ssh_certificates_on_fingerprint ON group_ssh_certificates USING btree (fingerprint);

CREATE INDEX index_group_ssh_certificates_on_namespace_id ON group_ssh_certificates USING btree (namespace_id);

CREATE UNIQUE INDEX index_group_stages_on_group_id_group_value_stream_id_and_name ON analytics_cycle_analytics_group_stages USING btree (group_id, group_value_stream_id, name);

CREATE INDEX index_group_stages_on_stage_event_hash_id ON analytics_cycle_analytics_group_stages USING btree (stage_event_hash_id);

CREATE UNIQUE INDEX index_group_user_callouts_feature ON user_group_callouts USING btree (user_id, feature_name, group_id);

CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_repositories USING btree (disk_path);

CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositories USING btree (shard_id);

CREATE INDEX index_group_wiki_repository_states_failed_verification ON group_wiki_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_group_wiki_repository_states_needs_verification ON group_wiki_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_group_wiki_repository_states_on_group_id ON group_wiki_repository_states USING btree (group_id);

CREATE UNIQUE INDEX index_group_wiki_repository_states_on_group_wiki_repository_id ON group_wiki_repository_states USING btree (group_wiki_repository_id);

CREATE INDEX index_group_wiki_repository_states_on_verification_state ON group_wiki_repository_states USING btree (verification_state);

CREATE INDEX index_group_wiki_repository_states_pending_verification ON group_wiki_repository_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_groups_on_parent_id_id ON namespaces USING btree (parent_id, id) WHERE ((type)::text = 'Group'::text);

CREATE INDEX index_groups_on_path_and_id ON namespaces USING btree (path, id) WHERE ((type)::text = 'Group'::text);

CREATE INDEX index_groups_visits_on_entity_id ON ONLY groups_visits USING btree (entity_id);

CREATE INDEX index_groups_visits_on_user_id_and_entity_id_and_visited_at ON ONLY groups_visits USING btree (user_id, entity_id, visited_at);

CREATE INDEX index_historical_data_on_recorded_at ON historical_data USING btree (recorded_at);

CREATE UNIQUE INDEX index_http_integrations_on_project_and_endpoint ON alert_management_http_integrations USING btree (project_id, endpoint_identifier);

CREATE INDEX index_identities_on_saml_provider_id ON identities USING btree (saml_provider_id) WHERE (saml_provider_id IS NOT NULL);

CREATE INDEX index_identities_on_user_id ON identities USING btree (user_id);

CREATE INDEX index_im_issuable_escalation_statuses_on_policy_id ON incident_management_issuable_escalation_statuses USING btree (policy_id);

CREATE UNIQUE INDEX index_im_oncall_schedules_on_project_id_and_iid ON incident_management_oncall_schedules USING btree (project_id, iid);

CREATE INDEX index_im_timeline_event_id ON incident_management_timeline_event_tag_links USING btree (timeline_event_id);

CREATE UNIQUE INDEX index_im_timeline_event_tags_on_lower_name_and_project_id ON incident_management_timeline_event_tags USING btree (project_id, lower(name));

CREATE UNIQUE INDEX index_im_timeline_event_tags_on_tag_id_and_event_id ON incident_management_timeline_event_tag_links USING btree (timeline_event_tag_id, timeline_event_id);

CREATE INDEX index_im_timeline_events_author_id ON incident_management_timeline_events USING btree (author_id);

CREATE INDEX index_im_timeline_events_issue_id ON incident_management_timeline_events USING btree (issue_id);

CREATE INDEX index_im_timeline_events_project_id ON incident_management_timeline_events USING btree (project_id);

CREATE INDEX index_im_timeline_events_promoted_from_note_id ON incident_management_timeline_events USING btree (promoted_from_note_id);

CREATE INDEX index_im_timeline_events_updated_by_user_id ON incident_management_timeline_events USING btree (updated_by_user_id);

CREATE INDEX index_import_export_uploads_on_group_id_non_unique ON import_export_uploads USING btree (group_id) WHERE (group_id IS NOT NULL);

CREATE INDEX index_import_export_uploads_on_project_id ON import_export_uploads USING btree (project_id);

CREATE INDEX index_import_export_uploads_on_updated_at ON import_export_uploads USING btree (updated_at);

CREATE INDEX index_import_export_uploads_on_user_id ON import_export_uploads USING btree (user_id);

CREATE INDEX index_import_failures_on_correlation_id_value ON import_failures USING btree (correlation_id_value);

CREATE INDEX index_import_failures_on_external_identifiers ON import_failures USING btree (external_identifiers) WHERE (external_identifiers <> '{}'::jsonb);

CREATE INDEX index_import_failures_on_group_id_not_null ON import_failures USING btree (group_id) WHERE (group_id IS NOT NULL);

CREATE INDEX index_import_failures_on_organization_id ON import_failures USING btree (organization_id);

CREATE INDEX index_import_failures_on_project_id_and_correlation_id_value ON import_failures USING btree (project_id, correlation_id_value) WHERE (retry_count = 0);

CREATE INDEX index_import_failures_on_project_id_not_null ON import_failures USING btree (project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX index_import_failures_on_user_id_not_null ON import_failures USING btree (user_id) WHERE (user_id IS NOT NULL);

CREATE INDEX index_import_placeholder_memberships_on_group_id ON import_placeholder_memberships USING btree (group_id);

CREATE INDEX index_import_placeholder_memberships_on_namespace_id ON import_placeholder_memberships USING btree (namespace_id);

CREATE INDEX index_import_placeholder_memberships_on_project_id ON import_placeholder_memberships USING btree (project_id);

CREATE INDEX index_import_placeholder_user_details_on_eligible_for_deletion ON import_placeholder_user_details USING btree (deletion_attempts, last_deletion_attempt_at, id) WHERE (namespace_id IS NULL);

CREATE INDEX index_import_placeholder_user_details_on_namespace_id ON import_placeholder_user_details USING btree (namespace_id);

CREATE INDEX index_import_placeholder_user_details_on_organization_id ON import_placeholder_user_details USING btree (organization_id);

CREATE INDEX index_import_placeholder_user_details_on_placeholder_user_id ON import_placeholder_user_details USING btree (placeholder_user_id);

CREATE INDEX index_import_source_user_placeholder_references_on_namespace_id ON import_source_user_placeholder_references USING btree (namespace_id);

CREATE INDEX index_import_source_users_on_namespace_id_and_status ON import_source_users USING btree (namespace_id, status);

CREATE INDEX index_import_source_users_on_placeholder_user_id ON import_source_users USING btree (placeholder_user_id);

CREATE INDEX index_import_source_users_on_reassigned_by_user_id ON import_source_users USING btree (reassigned_by_user_id);

CREATE UNIQUE INDEX index_import_source_users_on_reassignment_token ON import_source_users USING btree (reassignment_token);

CREATE INDEX index_imported_projects_on_import_type_creator_id_created_at ON projects USING btree (import_type, creator_id, created_at) WHERE (import_type IS NOT NULL);

CREATE INDEX index_imported_projects_on_import_type_id ON projects USING btree (import_type, id) WHERE (import_type IS NOT NULL);

CREATE INDEX index_inc_mgmnt_oncall_participants_on_oncall_user_id ON incident_management_oncall_participants USING btree (user_id);

CREATE UNIQUE INDEX index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id ON incident_management_oncall_participants USING btree (user_id, oncall_rotation_id);

CREATE INDEX index_inc_mgmnt_oncall_pcpnt_on_oncall_rotation_id_is_removed ON incident_management_oncall_participants USING btree (oncall_rotation_id, is_removed);

CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_id ON incident_management_oncall_rotations USING btree (oncall_schedule_id, id);

CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_name ON incident_management_oncall_rotations USING btree (oncall_schedule_id, name);

CREATE INDEX index_incident_management_escalation_rules_on_project_id ON incident_management_escalation_rules USING btree (project_id);

CREATE INDEX index_incident_management_issuable_escalation_statuses_on_names ON incident_management_issuable_escalation_statuses USING btree (namespace_id);

CREATE INDEX index_incident_management_oncall_participants_on_project_id ON incident_management_oncall_participants USING btree (project_id);

CREATE INDEX index_incident_management_oncall_rotations_on_project_id ON incident_management_oncall_rotations USING btree (project_id);

CREATE INDEX index_incident_management_oncall_schedules_on_project_id ON incident_management_oncall_schedules USING btree (project_id);

CREATE INDEX index_incident_management_oncall_shifts_on_participant_id ON incident_management_oncall_shifts USING btree (participant_id);

CREATE INDEX index_incident_management_oncall_shifts_on_project_id ON incident_management_oncall_shifts USING btree (project_id);

CREATE INDEX index_incident_management_pending_alert_escalations_on_alert_id ON ONLY incident_management_pending_alert_escalations USING btree (alert_id);

CREATE INDEX index_incident_management_pending_alert_escalations_on_rule_id ON ONLY incident_management_pending_alert_escalations USING btree (rule_id);

CREATE INDEX index_incident_management_pending_issue_escalations_on_issue_id ON ONLY incident_management_pending_issue_escalations USING btree (issue_id);

CREATE INDEX index_incident_management_pending_issue_escalations_on_rule_id ON ONLY incident_management_pending_issue_escalations USING btree (rule_id);

CREATE UNIQUE INDEX index_index_statuses_on_project_id ON index_statuses USING btree (project_id);

CREATE INDEX index_insights_on_namespace_id ON insights USING btree (namespace_id);

CREATE INDEX index_insights_on_project_id ON insights USING btree (project_id);

CREATE INDEX index_integrations_on_inherit_from_id ON integrations USING btree (inherit_from_id);

CREATE INDEX index_integrations_on_organization_id ON integrations USING btree (organization_id);

CREATE INDEX index_integrations_on_project_and_type_new_where_inherit_null ON integrations USING btree (project_id, type_new) WHERE (inherit_from_id IS NULL);

CREATE UNIQUE INDEX index_integrations_on_project_id_and_type_new_unique ON integrations USING btree (project_id, type_new);

CREATE INDEX index_integrations_on_type_new ON integrations USING btree (type_new);

CREATE INDEX index_integrations_on_type_new_and_instance_partial ON integrations USING btree (type_new, instance) WHERE (instance = true);

CREATE INDEX index_integrations_on_type_new_id_when_active_and_has_group ON integrations USING btree (type_new, id, inherit_from_id) WHERE ((active = true) AND (group_id IS NOT NULL));

CREATE INDEX index_integrations_on_type_new_id_when_active_and_has_project ON integrations USING btree (type_new, id) WHERE ((active = true) AND (project_id IS NOT NULL));

CREATE INDEX index_integrations_on_unique_group_id_and_type_new ON integrations USING btree (group_id, type_new);

CREATE INDEX index_internal_ids_on_namespace_id ON internal_ids USING btree (namespace_id);

CREATE INDEX index_internal_ids_on_project_id ON internal_ids USING btree (project_id);

CREATE UNIQUE INDEX index_internal_ids_on_usage_and_namespace_id ON internal_ids USING btree (usage, namespace_id) WHERE (namespace_id IS NOT NULL);

CREATE UNIQUE INDEX index_internal_ids_on_usage_and_project_id ON internal_ids USING btree (usage, project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX index_ip_restrictions_on_group_id ON ip_restrictions USING btree (group_id);

CREATE INDEX index_issuable_metric_images_on_issue_id ON issuable_metric_images USING btree (issue_id);

CREATE INDEX index_issuable_metric_images_on_namespace_id ON issuable_metric_images USING btree (namespace_id);

CREATE INDEX index_issuable_resource_links_on_namespace_id ON issuable_resource_links USING btree (namespace_id);

CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities USING btree (issue_id);

CREATE INDEX index_issuable_severities_on_namespace_id ON issuable_severities USING btree (namespace_id);

CREATE INDEX index_issuable_slas_on_due_at_id_label_applied_issuable_closed ON issuable_slas USING btree (due_at, id) WHERE ((label_applied = false) AND (issuable_closed = false));

CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree (issue_id);

CREATE INDEX index_issuable_slas_on_namespace_id ON issuable_slas USING btree (namespace_id);

CREATE INDEX index_issue_assignees_on_namespace_id ON issue_assignees USING btree (namespace_id);

CREATE INDEX index_issue_assignees_on_user_id_and_issue_id ON issue_assignees USING btree (user_id, issue_id);

CREATE INDEX index_issue_assignment_events_on_namespace_id ON issue_assignment_events USING btree (namespace_id);

CREATE INDEX index_issue_assignment_events_on_user_id ON issue_assignment_events USING btree (user_id);

CREATE UNIQUE INDEX index_issue_crm_contacts_on_issue_id_and_contact_id ON issue_customer_relations_contacts USING btree (issue_id, contact_id);

CREATE INDEX index_issue_customer_relations_contacts_on_contact_id ON issue_customer_relations_contacts USING btree (contact_id);

CREATE INDEX index_issue_customer_relations_contacts_on_namespace_id ON issue_customer_relations_contacts USING btree (namespace_id);

CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_lower_email ON issue_email_participants USING btree (issue_id, lower(email));

CREATE INDEX index_issue_email_participants_on_namespace_id ON issue_email_participants USING btree (namespace_id);

CREATE INDEX index_issue_emails_on_email_message_id ON issue_emails USING btree (email_message_id);

CREATE INDEX index_issue_emails_on_issue_id ON issue_emails USING btree (issue_id);

CREATE INDEX index_issue_emails_on_namespace_id ON issue_emails USING btree (namespace_id);

CREATE INDEX index_issue_links_on_namespace_id ON issue_links USING btree (namespace_id);

CREATE INDEX index_issue_links_on_source_id ON issue_links USING btree (source_id);

CREATE UNIQUE INDEX index_issue_links_on_source_id_and_target_id ON issue_links USING btree (source_id, target_id);

CREATE INDEX index_issue_links_on_target_id ON issue_links USING btree (target_id);

CREATE INDEX index_issue_metrics_on_issue_id_and_timestamps ON issue_metrics USING btree (issue_id, first_mentioned_in_commit_at, first_associated_with_milestone_at, first_added_to_board_at);

CREATE INDEX index_issue_metrics_on_namespace_id ON issue_metrics USING btree (namespace_id);

CREATE INDEX index_issue_on_project_id_state_id_and_blocking_issues_count ON issues USING btree (project_id, state_id, blocking_issues_count);

CREATE INDEX index_issue_tracker_data_on_group_id ON issue_tracker_data USING btree (group_id);

CREATE INDEX index_issue_tracker_data_on_instance_integration_id ON issue_tracker_data USING btree (instance_integration_id);

CREATE INDEX index_issue_tracker_data_on_integration_id ON issue_tracker_data USING btree (integration_id);

CREATE INDEX index_issue_tracker_data_on_organization_id ON issue_tracker_data USING btree (organization_id);

CREATE INDEX index_issue_tracker_data_on_project_id ON issue_tracker_data USING btree (project_id);

CREATE INDEX index_issue_user_mentions_on_namespace_id ON issue_user_mentions USING btree (namespace_id);

CREATE UNIQUE INDEX index_issue_user_mentions_on_note_id ON issue_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);

CREATE INDEX index_issues_on_author_id ON issues USING btree (author_id);

CREATE INDEX index_issues_on_closed_by_id ON issues USING btree (closed_by_id);

CREATE INDEX index_issues_on_description_trigram_non_latin ON issues USING gin (description gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)));

CREATE INDEX index_issues_on_duplicated_to_id ON issues USING btree (duplicated_to_id) WHERE (duplicated_to_id IS NOT NULL);

CREATE INDEX index_issues_on_id_and_weight ON issues USING btree (id, weight);

CREATE INDEX index_issues_on_last_edited_by_id ON issues USING btree (last_edited_by_id);

CREATE INDEX index_issues_on_milestone_id_and_id ON issues USING btree (milestone_id, id);

CREATE INDEX index_issues_on_moved_to_id ON issues USING btree (moved_to_id) WHERE (moved_to_id IS NOT NULL);

CREATE INDEX index_issues_on_namespace_id_created_at_id_state_id ON issues USING btree (namespace_id, created_at, id, state_id);

CREATE UNIQUE INDEX index_issues_on_namespace_id_iid_unique ON issues USING btree (namespace_id, iid);

CREATE INDEX index_issues_on_namespace_id_relative_position_id_state_id ON issues USING btree (namespace_id, relative_position, id, state_id);

CREATE INDEX index_issues_on_namespace_id_updated_at_id_state_id ON issues USING btree (namespace_id, updated_at, id, state_id);

CREATE INDEX index_issues_on_project_health_status_asc_work_item_type ON issues USING btree (project_id, health_status, id DESC, state_id, work_item_type_id);

CREATE UNIQUE INDEX index_issues_on_project_id_and_external_key ON issues USING btree (project_id, external_key) WHERE (external_key IS NOT NULL);

CREATE UNIQUE INDEX index_issues_on_project_id_and_iid ON issues USING btree (project_id, iid);

CREATE INDEX index_issues_on_project_id_and_upvotes_count ON issues USING btree (project_id, upvotes_count);

CREATE INDEX index_issues_on_project_id_closed_at_desc_state_id_and_id ON issues USING btree (project_id, closed_at DESC NULLS LAST, state_id, id);

CREATE INDEX index_issues_on_promoted_to_epic_id ON issues USING btree (promoted_to_epic_id) WHERE (promoted_to_epic_id IS NOT NULL);

CREATE INDEX index_issues_on_sprint_id ON issues USING btree (sprint_id);

CREATE INDEX index_issues_on_title_trigram_non_latin ON issues USING gin (title gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)));

CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);

CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);

CREATE INDEX index_issues_on_work_item_type_id_namespace_id_created_at_state ON issues USING btree (work_item_type_id, namespace_id, created_at, state_id);

CREATE INDEX index_issues_on_work_item_type_id_project_id_created_at_state ON issues USING btree (work_item_type_id, project_id, created_at, state_id);

CREATE INDEX index_iterations_cadences_on_group_id ON iterations_cadences USING btree (group_id);

CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key);

CREATE INDEX index_jira_connect_installations_on_instance_url ON jira_connect_installations USING btree (instance_url);

CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id);

CREATE INDEX index_jira_imports_on_label_id ON jira_imports USING btree (label_id);

CREATE INDEX index_jira_imports_on_project_id_and_jira_project_key ON jira_imports USING btree (project_id, jira_project_key);

CREATE INDEX index_jira_imports_on_user_id ON jira_imports USING btree (user_id);

CREATE INDEX index_jira_tracker_data_on_group_id ON jira_tracker_data USING btree (group_id);

CREATE INDEX index_jira_tracker_data_on_instance_integration_id ON jira_tracker_data USING btree (instance_integration_id);

CREATE INDEX index_jira_tracker_data_on_integration_id ON jira_tracker_data USING btree (integration_id);

CREATE INDEX index_jira_tracker_data_on_organization_id ON jira_tracker_data USING btree (organization_id);

CREATE INDEX index_jira_tracker_data_on_project_id ON jira_tracker_data USING btree (project_id);

CREATE INDEX index_job_artifact_states_failed_verification ON ci_job_artifact_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_job_artifact_states_needs_verification ON ci_job_artifact_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_job_artifact_states_on_verification_state ON ci_job_artifact_states USING btree (verification_state);

CREATE INDEX index_job_artifact_states_pending_verification ON ci_job_artifact_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_key_updated_at_on_user_custom_attribute ON user_custom_attributes USING btree (key, updated_at);

CREATE INDEX index_keys_on_expires_at_and_id ON keys USING btree (date(timezone('UTC'::text, expires_at)), id) WHERE (expiry_notification_delivered_at IS NULL);

CREATE INDEX index_keys_on_fingerprint ON keys USING btree (fingerprint);

CREATE UNIQUE INDEX index_keys_on_fingerprint_sha256_unique ON keys USING btree (fingerprint_sha256);

CREATE INDEX index_keys_on_id_and_ldap_key_type ON keys USING btree (id) WHERE ((type)::text = 'LDAPKey'::text);

CREATE INDEX index_keys_on_last_used_at ON keys USING btree (last_used_at DESC NULLS LAST);

CREATE INDEX index_keys_on_user_id ON keys USING btree (user_id);

CREATE UNIQUE INDEX index_kubernetes_namespaces_on_cluster_project_environment_id ON clusters_kubernetes_namespaces USING btree (cluster_id, project_id, environment_id);

CREATE INDEX index_label_links_on_label_id_and_target_type ON label_links USING btree (label_id, target_type);

CREATE INDEX index_label_links_on_target_id_and_target_type ON label_links USING btree (target_id, target_type);

CREATE INDEX index_label_priorities_on_label_id ON label_priorities USING btree (label_id);

CREATE INDEX index_label_priorities_on_priority ON label_priorities USING btree (priority);

CREATE UNIQUE INDEX index_label_priorities_on_project_id_and_label_id ON label_priorities USING btree (project_id, label_id);

CREATE INDEX index_labels_on_group_id ON labels USING btree (group_id);

CREATE UNIQUE INDEX index_labels_on_group_id_and_title_varchar_unique ON labels USING btree (group_id, title varchar_pattern_ops) WHERE (project_id IS NULL);

CREATE INDEX index_labels_on_project_id ON labels USING btree (project_id);

CREATE UNIQUE INDEX index_labels_on_project_id_and_title_varchar_unique ON labels USING btree (project_id, title varchar_pattern_ops) WHERE (group_id IS NULL);

CREATE INDEX index_labels_on_template ON labels USING btree (template) WHERE template;

CREATE INDEX index_labels_on_title_varchar ON labels USING btree (title varchar_pattern_ops);

CREATE INDEX index_labels_on_type_project_id_and_id ON labels USING btree (type, project_id, id);

CREATE INDEX index_last_usages_on_last_used_date ON catalog_resource_component_last_usages USING btree (last_used_date);

CREATE INDEX index_ldap_admin_role_links_on_member_role_id ON ldap_admin_role_links USING btree (member_role_id);

CREATE INDEX index_ldap_admin_role_links_on_provider_and_sync_status ON ldap_admin_role_links USING btree (provider, sync_status);

CREATE INDEX index_ldap_group_links_on_member_role_id ON ldap_group_links USING btree (member_role_id);

CREATE UNIQUE INDEX index_lfs_file_locks_on_project_id_and_path ON lfs_file_locks USING btree (project_id, path);

CREATE INDEX index_lfs_file_locks_on_user_id ON lfs_file_locks USING btree (user_id);

CREATE INDEX index_lfs_object_states_failed_verification ON lfs_object_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_lfs_object_states_needs_verification ON lfs_object_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_lfs_object_states_on_lfs_object_id ON lfs_object_states USING btree (lfs_object_id);

CREATE INDEX index_lfs_object_states_on_verification_state ON lfs_object_states USING btree (verification_state);

CREATE INDEX index_lfs_object_states_pending_verification ON lfs_object_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_lfs_objects_on_file ON lfs_objects USING btree (file);

CREATE INDEX index_lfs_objects_on_file_store ON lfs_objects USING btree (file_store);

CREATE UNIQUE INDEX index_lfs_objects_on_oid ON lfs_objects USING btree (oid);

CREATE INDEX index_lfs_objects_projects_on_lfs_object_id ON lfs_objects_projects USING btree (lfs_object_id);

CREATE INDEX index_lfs_objects_projects_on_oid ON lfs_objects_projects USING btree (oid);

CREATE INDEX index_lfs_objects_projects_on_project_id_and_lfs_object_id ON lfs_objects_projects USING btree (project_id, lfs_object_id);

CREATE INDEX index_list_user_preferences_on_list_id ON list_user_preferences USING btree (list_id);

CREATE INDEX index_list_user_preferences_on_user_id ON list_user_preferences USING btree (user_id);

CREATE UNIQUE INDEX index_list_user_preferences_on_user_id_and_list_id ON list_user_preferences USING btree (user_id, list_id);

CREATE UNIQUE INDEX index_lists_on_board_id_and_custom_status_id ON lists USING btree (board_id, custom_status_id);

CREATE UNIQUE INDEX index_lists_on_board_id_and_label_id ON lists USING btree (board_id, label_id);

CREATE UNIQUE INDEX index_lists_on_board_id_and_system_defined_status_identifier ON lists USING btree (board_id, system_defined_status_identifier);

CREATE INDEX index_lists_on_custom_status_id ON lists USING btree (custom_status_id);

CREATE INDEX index_lists_on_group_id ON lists USING btree (group_id);

CREATE INDEX index_lists_on_iteration_id ON lists USING btree (iteration_id);

CREATE INDEX index_lists_on_label_id ON lists USING btree (label_id);

CREATE INDEX index_lists_on_list_type ON lists USING btree (list_type);

CREATE INDEX index_lists_on_milestone_id ON lists USING btree (milestone_id);

CREATE INDEX index_lists_on_project_id ON lists USING btree (project_id);

CREATE INDEX index_lists_on_user_id ON lists USING btree (user_id);

CREATE INDEX index_loose_foreign_keys_deleted_records_for_partitioned_query ON ONLY loose_foreign_keys_deleted_records USING btree (partition, fully_qualified_table_name, consume_after, id) WHERE (status = 1);

CREATE INDEX index_manifest_states_failed_verification ON dependency_proxy_manifest_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_manifest_states_needs_verification ON dependency_proxy_manifest_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_manifest_states_on_dependency_proxy_manifest_id ON dependency_proxy_manifest_states USING btree (dependency_proxy_manifest_id);

CREATE INDEX index_manifest_states_on_verification_state ON dependency_proxy_manifest_states USING btree (verification_state);

CREATE INDEX index_manifest_states_pending_verification ON dependency_proxy_manifest_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_member_approval_on_member_id ON member_approvals USING btree (member_id);

CREATE INDEX index_member_approval_on_member_namespace_id ON member_approvals USING btree (member_namespace_id);

CREATE INDEX index_member_approval_on_requested_by_id ON member_approvals USING btree (requested_by_id);

CREATE INDEX index_member_approval_on_reviewed_by_id ON member_approvals USING btree (reviewed_by_id);

CREATE INDEX index_member_approvals_on_member_namespace_id_status ON member_approvals USING btree (member_namespace_id, status) WHERE (status = 0);

CREATE INDEX index_member_approvals_on_member_role_id ON member_approvals USING btree (member_role_id);

CREATE INDEX index_member_approvals_on_user_id ON member_approvals USING btree (user_id);

CREATE UNIQUE INDEX index_member_roles_on_name_unique ON member_roles USING btree (name) WHERE (namespace_id IS NULL);

CREATE INDEX index_member_roles_on_namespace_id ON member_roles USING btree (namespace_id);

CREATE UNIQUE INDEX index_member_roles_on_namespace_id_name_unique ON member_roles USING btree (namespace_id, name) WHERE (namespace_id IS NOT NULL);

CREATE INDEX index_member_roles_on_occupies_seat ON member_roles USING btree (occupies_seat);

CREATE INDEX index_member_roles_on_permissions ON member_roles USING gin (permissions);

CREATE INDEX index_members_deletion_schedules_on_scheduled_by_id ON members_deletion_schedules USING btree (scheduled_by_id);

CREATE INDEX index_members_deletion_schedules_on_user_id ON members_deletion_schedules USING btree (user_id);

CREATE INDEX index_members_on_access_level ON members USING btree (access_level);

CREATE INDEX index_members_on_expires_at ON members USING btree (expires_at);

CREATE INDEX index_members_on_expiring_at_access_level_id ON members USING btree (expires_at, access_level, id) WHERE ((requested_at IS NULL) AND (expiry_notified_at IS NULL));

CREATE INDEX index_members_on_invite_email ON members USING btree (invite_email);

CREATE UNIQUE INDEX index_members_on_invite_token ON members USING btree (invite_token);

CREATE INDEX index_members_on_lower_invite_email_with_token ON members USING btree (lower((invite_email)::text)) WHERE (invite_token IS NOT NULL);

CREATE INDEX index_members_on_member_namespace_id_compound ON members USING btree (member_namespace_id, type, requested_at, id);

CREATE INDEX index_members_on_member_role_id ON members USING btree (member_role_id);

CREATE INDEX index_members_on_requested_at ON members USING btree (requested_at);

CREATE INDEX index_members_on_source_and_access_level_and_member_role ON members USING btree (source_id, source_type, access_level) WHERE (member_role_id IS NULL);

CREATE INDEX index_members_on_source_and_type_and_access_level ON members USING btree (source_id, source_type, type, access_level);

CREATE INDEX index_members_on_source_and_type_and_id ON members USING btree (source_id, source_type, type, id) WHERE (invite_token IS NULL);

CREATE INDEX index_members_on_source_state_type_access_level_and_user_id ON members USING btree (source_id, source_type, state, type, access_level, user_id) WHERE ((requested_at IS NULL) AND (invite_token IS NULL));

CREATE INDEX index_members_on_user_id_and_access_level_requested_at_is_null ON members USING btree (user_id, access_level) WHERE (requested_at IS NULL);

CREATE INDEX index_members_on_user_id_created_at ON members USING btree (user_id, created_at) WHERE ((ldap = true) AND ((type)::text = 'GroupMember'::text) AND ((source_type)::text = 'Namespace'::text));

CREATE INDEX index_merge_request_approval_metrics_on_merge_request_id ON merge_request_approval_metrics USING btree (merge_request_id);

CREATE UNIQUE INDEX index_merge_request_assignees_on_merge_request_id_and_user_id ON merge_request_assignees USING btree (merge_request_id, user_id);

CREATE INDEX index_merge_request_assignees_on_project_id ON merge_request_assignees USING btree (project_id);

CREATE INDEX index_merge_request_assignees_on_user_id ON merge_request_assignees USING btree (user_id);

CREATE INDEX index_merge_request_assignment_events_on_project_id ON merge_request_assignment_events USING btree (project_id);

CREATE INDEX index_merge_request_assignment_events_on_user_id ON merge_request_assignment_events USING btree (user_id);

CREATE INDEX index_merge_request_blocks_on_blocked_merge_request_id ON merge_request_blocks USING btree (blocked_merge_request_id);

CREATE INDEX index_merge_request_blocks_on_project_id ON merge_request_blocks USING btree (project_id);

CREATE UNIQUE INDEX index_merge_request_cleanup_schedules_on_merge_request_id ON merge_request_cleanup_schedules USING btree (merge_request_id);

CREATE INDEX index_merge_request_cleanup_schedules_on_status ON merge_request_cleanup_schedules USING btree (status);

CREATE UNIQUE INDEX index_merge_request_commits_metadata_on_project_id_and_sha ON ONLY merge_request_commits_metadata USING btree (project_id, sha);

CREATE INDEX index_merge_request_context_commit_diff_files_on_project_id ON merge_request_context_commit_diff_files USING btree (project_id);

CREATE INDEX index_merge_request_context_commits_on_project_id ON merge_request_context_commits USING btree (project_id);

CREATE UNIQUE INDEX index_merge_request_diff_commit_users_on_name_and_email ON merge_request_diff_commit_users USING btree (name, email);

CREATE UNIQUE INDEX index_merge_request_diff_commit_users_on_org_id_name_email ON merge_request_diff_commit_users USING btree (organization_id, name, email);

CREATE INDEX index_merge_request_diff_commits_on_sha ON merge_request_diff_commits USING btree (sha);

CREATE INDEX index_merge_request_diff_details_failed_verification ON merge_request_diff_details USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_merge_request_diff_details_needs_verification ON merge_request_diff_details USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_merge_request_diff_details_on_merge_request_diff_id ON merge_request_diff_details USING btree (merge_request_diff_id);

CREATE INDEX index_merge_request_diff_details_on_project_id ON merge_request_diff_details USING btree (project_id);

CREATE INDEX index_merge_request_diff_details_on_verification_state ON merge_request_diff_details USING btree (verification_state);

CREATE INDEX index_merge_request_diff_details_pending_verification ON merge_request_diff_details USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_merge_request_diff_files_on_project_id ON merge_request_diff_files USING btree (project_id);

CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL)));

CREATE INDEX index_merge_request_diffs_on_external_diff ON merge_request_diffs USING btree (external_diff);

CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_diffs USING btree (external_diff_store);

CREATE INDEX index_merge_request_diffs_on_merge_request_id_and_id ON merge_request_diffs USING btree (merge_request_id, id);

CREATE INDEX index_merge_request_diffs_on_project_id_and_id ON merge_request_diffs USING btree (project_id, id);

CREATE UNIQUE INDEX index_merge_request_diffs_on_unique_merge_request_id ON merge_request_diffs USING btree (merge_request_id) WHERE (diff_type = 2);

CREATE INDEX index_merge_request_merge_schedules_on_merge_after_and_mr_id ON merge_request_merge_schedules USING btree (merge_after, merge_request_id);

CREATE UNIQUE INDEX index_merge_request_merge_schedules_on_merge_request_id ON merge_request_merge_schedules USING btree (merge_request_id);

CREATE INDEX index_merge_request_merge_schedules_on_project_id ON merge_request_merge_schedules USING btree (project_id);

CREATE INDEX index_merge_request_metrics_on_first_deployed_to_production_at ON merge_request_metrics USING btree (first_deployed_to_production_at);

CREATE INDEX index_merge_request_metrics_on_latest_closed_at ON merge_request_metrics USING btree (latest_closed_at) WHERE (latest_closed_at IS NOT NULL);

CREATE INDEX index_merge_request_metrics_on_latest_closed_by_id ON merge_request_metrics USING btree (latest_closed_by_id);

CREATE INDEX index_merge_request_metrics_on_merge_request_id_and_merged_at ON merge_request_metrics USING btree (merge_request_id, merged_at) WHERE (merged_at IS NOT NULL);

CREATE INDEX index_merge_request_metrics_on_merged_at ON merge_request_metrics USING btree (merged_at);

CREATE INDEX index_merge_request_metrics_on_pipeline_id ON merge_request_metrics USING btree (pipeline_id);

CREATE INDEX index_merge_request_predictions_on_project_id ON merge_request_predictions USING btree (project_id);

CREATE INDEX index_merge_request_requested_changes_on_merge_request_id ON merge_request_requested_changes USING btree (merge_request_id);

CREATE INDEX index_merge_request_requested_changes_on_project_id ON merge_request_requested_changes USING btree (project_id);

CREATE INDEX index_merge_request_requested_changes_on_user_id ON merge_request_requested_changes USING btree (user_id);

CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_id ON merge_request_reviewers USING btree (merge_request_id, user_id);

CREATE INDEX index_merge_request_reviewers_on_project_id ON merge_request_reviewers USING btree (project_id);

CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id);

CREATE UNIQUE INDEX index_merge_request_user_mentions_on_note_id ON merge_request_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);

CREATE INDEX index_merge_request_user_mentions_on_project_id ON merge_request_user_mentions USING btree (project_id);

CREATE INDEX index_merge_requests_approval_rules_approver_groups_on_group_id ON merge_requests_approval_rules_approver_groups USING btree (group_id);

CREATE INDEX index_merge_requests_approval_rules_approver_users_on_group_id ON merge_requests_approval_rules_approver_users USING btree (group_id);

CREATE INDEX index_merge_requests_approval_rules_approver_users_on_user_id ON merge_requests_approval_rules_approver_users USING btree (user_id);

CREATE INDEX index_merge_requests_approval_rules_groups_on_group_id ON merge_requests_approval_rules_groups USING btree (group_id);

CREATE INDEX index_merge_requests_approval_rules_on_group_id ON merge_requests_approval_rules USING btree (group_id);

CREATE INDEX index_merge_requests_approval_rules_on_project_id ON merge_requests_approval_rules USING btree (project_id);

CREATE INDEX index_merge_requests_approval_rules_on_source_rule_id ON merge_requests_approval_rules USING btree (source_rule_id);

CREATE INDEX index_merge_requests_closing_issues_on_issue_id ON merge_requests_closing_issues USING btree (issue_id);

CREATE INDEX index_merge_requests_closing_issues_on_merge_request_id ON merge_requests_closing_issues USING btree (merge_request_id);

CREATE INDEX index_merge_requests_closing_issues_on_project_id ON merge_requests_closing_issues USING btree (project_id);

CREATE INDEX index_merge_requests_compliance_violations_on_violating_user_id ON merge_requests_compliance_violations USING btree (violating_user_id);

CREATE UNIQUE INDEX index_merge_requests_compliance_violations_unique_columns ON merge_requests_compliance_violations USING btree (merge_request_id, violating_user_id, reason);

CREATE INDEX index_merge_requests_for_latest_diffs_with_state_merged ON merge_requests USING btree (latest_merge_request_diff_id, target_project_id) WHERE (state_id = 3);

CREATE INDEX index_merge_requests_id_created_at_prepared_at ON merge_requests USING btree (created_at, id) WHERE (prepared_at IS NULL);

CREATE INDEX index_merge_requests_on_assignee_id ON merge_requests USING btree (assignee_id);

CREATE INDEX index_merge_requests_on_author_id_and_created_at ON merge_requests USING btree (author_id, created_at);

CREATE INDEX index_merge_requests_on_author_id_and_id ON merge_requests USING btree (author_id, id);

CREATE INDEX index_merge_requests_on_author_id_and_target_project_id ON merge_requests USING btree (author_id, target_project_id);

CREATE INDEX index_merge_requests_on_created_at ON merge_requests USING btree (created_at);

CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING gin (description gin_trgm_ops) WITH (fastupdate='false');

CREATE INDEX index_merge_requests_on_head_pipeline_id ON merge_requests USING btree (head_pipeline_id);

CREATE INDEX index_merge_requests_on_latest_merge_request_diff_id ON merge_requests USING btree (latest_merge_request_diff_id);

CREATE INDEX index_merge_requests_on_merge_user_id ON merge_requests USING btree (merge_user_id) WHERE (merge_user_id IS NOT NULL);

CREATE INDEX index_merge_requests_on_milestone_id ON merge_requests USING btree (milestone_id);

CREATE INDEX index_merge_requests_on_source_branch ON merge_requests USING btree (source_branch);

CREATE INDEX index_merge_requests_on_source_project_id_and_source_branch ON merge_requests USING btree (source_project_id, source_branch);

CREATE INDEX index_merge_requests_on_sprint_id ON merge_requests USING btree (sprint_id);

CREATE INDEX index_merge_requests_on_target_branch ON merge_requests USING btree (target_branch);

CREATE INDEX index_merge_requests_on_target_project_id_and_created_at_and_id ON merge_requests USING btree (target_project_id, created_at, id);

CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON merge_requests USING btree (target_project_id, iid);

CREATE INDEX index_merge_requests_on_target_project_id_and_merged_commit_sha ON merge_requests USING btree (target_project_id, merged_commit_sha);

CREATE INDEX index_merge_requests_on_target_project_id_and_source_branch ON merge_requests USING btree (target_project_id, source_branch);

CREATE INDEX index_merge_requests_on_target_project_id_and_squash_commit_sha ON merge_requests USING btree (target_project_id, squash_commit_sha);

CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true));

CREATE INDEX index_merge_requests_on_target_project_id_and_updated_at_and_id ON merge_requests USING btree (target_project_id, updated_at, id);

CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops) WITH (fastupdate='false');

CREATE INDEX index_merge_requests_on_tp_id_and_merge_commit_sha_and_id ON merge_requests USING btree (target_project_id, merge_commit_sha, id);

CREATE INDEX index_merge_requests_on_updated_by_id ON merge_requests USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);

CREATE UNIQUE INDEX index_merge_trains_on_merge_request_id ON merge_trains USING btree (merge_request_id);

CREATE INDEX index_merge_trains_on_pipeline_id ON merge_trains USING btree (pipeline_id);

CREATE INDEX index_merge_trains_on_user_id ON merge_trains USING btree (user_id);

CREATE INDEX index_migration_jobs_on_migration_id_and_cursor_max_value ON batched_background_migration_jobs USING btree (batched_background_migration_id, max_cursor) WHERE (max_cursor IS NOT NULL);

CREATE INDEX index_migration_jobs_on_migration_id_and_finished_at ON batched_background_migration_jobs USING btree (batched_background_migration_id, finished_at);

CREATE INDEX index_migration_jobs_on_migration_id_and_max_value ON batched_background_migration_jobs USING btree (batched_background_migration_id, max_value);

CREATE INDEX index_milestone_releases_on_project_id ON milestone_releases USING btree (project_id);

CREATE INDEX index_milestone_releases_on_release_id ON milestone_releases USING btree (release_id);

CREATE INDEX index_milestones_on_description_trigram ON milestones USING gin (description gin_trgm_ops);

CREATE INDEX index_milestones_on_due_date ON milestones USING btree (due_date);

CREATE INDEX index_milestones_on_group_id ON milestones USING btree (group_id);

CREATE UNIQUE INDEX index_milestones_on_project_id_and_iid ON milestones USING btree (project_id, iid);

CREATE INDEX index_milestones_on_title ON milestones USING btree (title);

CREATE INDEX index_milestones_on_title_trigram ON milestones USING gin (title gin_trgm_ops);

CREATE INDEX index_mirror_data_non_scheduled_or_started ON project_mirror_data USING btree (next_execution_timestamp, retry_count) WHERE ((status)::text <> ALL ('{scheduled,started}'::text[]));

CREATE UNIQUE INDEX index_ml_candidate_metadata_on_candidate_id_and_name ON ml_candidate_metadata USING btree (candidate_id, name);

CREATE INDEX index_ml_candidate_metadata_on_name ON ml_candidate_metadata USING btree (name);

CREATE INDEX index_ml_candidate_metadata_on_project_id ON ml_candidate_metadata USING btree (project_id);

CREATE INDEX index_ml_candidate_metrics_on_candidate_id ON ml_candidate_metrics USING btree (candidate_id);

CREATE INDEX index_ml_candidate_metrics_on_project_id ON ml_candidate_metrics USING btree (project_id);

CREATE INDEX index_ml_candidate_params_on_candidate_id ON ml_candidate_params USING btree (candidate_id);

CREATE UNIQUE INDEX index_ml_candidate_params_on_candidate_id_on_name ON ml_candidate_params USING btree (candidate_id, name);

CREATE INDEX index_ml_candidate_params_on_project_id ON ml_candidate_params USING btree (project_id);

CREATE INDEX index_ml_candidates_on_ci_build_id ON ml_candidates USING btree (ci_build_id);

CREATE UNIQUE INDEX index_ml_candidates_on_experiment_id_and_eid ON ml_candidates USING btree (experiment_id, eid);

CREATE UNIQUE INDEX index_ml_candidates_on_model_version_id ON ml_candidates USING btree (model_version_id);

CREATE INDEX index_ml_candidates_on_package_id ON ml_candidates USING btree (package_id);

CREATE INDEX index_ml_candidates_on_project_id ON ml_candidates USING btree (project_id);

CREATE INDEX index_ml_candidates_on_project_id_on_internal_id ON ml_candidates USING btree (project_id, internal_id);

CREATE INDEX index_ml_candidates_on_user_id ON ml_candidates USING btree (user_id);

CREATE UNIQUE INDEX index_ml_experiment_metadata_on_experiment_id_and_name ON ml_experiment_metadata USING btree (experiment_id, name);

CREATE INDEX index_ml_experiment_metadata_on_project_id ON ml_experiment_metadata USING btree (project_id);

CREATE INDEX index_ml_experiments_on_model_id ON ml_experiments USING btree (model_id);

CREATE UNIQUE INDEX index_ml_experiments_on_project_id_and_iid ON ml_experiments USING btree (project_id, iid);

CREATE UNIQUE INDEX index_ml_experiments_on_project_id_and_name ON ml_experiments USING btree (project_id, name);

CREATE INDEX index_ml_experiments_on_user_id ON ml_experiments USING btree (user_id);

CREATE INDEX index_ml_model_metadata_on_project_id ON ml_model_metadata USING btree (project_id);

CREATE INDEX index_ml_model_version_metadata_on_project_id ON ml_model_version_metadata USING btree (project_id);

CREATE INDEX index_ml_model_versions_on_created_at_on_model_id ON ml_model_versions USING btree (model_id, created_at);

CREATE INDEX index_ml_model_versions_on_package_id ON ml_model_versions USING btree (package_id);

CREATE INDEX index_ml_model_versions_on_project_id ON ml_model_versions USING btree (project_id);

CREATE UNIQUE INDEX index_ml_model_versions_on_project_id_and_model_id_and_version ON ml_model_versions USING btree (project_id, model_id, version);

CREATE INDEX index_ml_models_on_project_id ON ml_models USING btree (project_id);

CREATE UNIQUE INDEX index_ml_models_on_project_id_and_name ON ml_models USING btree (project_id, name);

CREATE INDEX index_ml_models_on_user_id ON ml_models USING btree (user_id);

CREATE UNIQUE INDEX index_mr_approval_metrics_on_project_id_and_mr_id ON merge_request_approval_metrics USING btree (target_project_id, merge_request_id);

CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id);

CREATE INDEX index_mr_cleanup_schedules_timestamps_status ON merge_request_cleanup_schedules USING btree (scheduled_at) WHERE ((completed_at IS NULL) AND (status = 0));

CREATE UNIQUE INDEX index_mr_context_commits_on_merge_request_id_and_sha ON merge_request_context_commits USING btree (merge_request_id, sha);

CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_nulls_last ON merge_request_metrics USING btree (target_project_id, merged_at DESC NULLS LAST, id DESC);

CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_time_to_merge ON merge_request_metrics USING btree (target_project_id, merged_at, created_at) WHERE (merged_at > created_at);

CREATE INDEX index_mrdc_on_merge_request_commits_metadata_id ON merge_request_diff_commits USING btree (merge_request_commits_metadata_id) WHERE (merge_request_commits_metadata_id IS NOT NULL);

CREATE INDEX index_mrs_approval_rules_approver_users_on_project_id ON merge_requests_approval_rules_approver_users USING btree (project_id);

CREATE INDEX index_mrs_approval_rules_mrs_on_mr_id ON merge_requests_approval_rules_merge_requests USING btree (merge_request_id);

CREATE INDEX index_mrs_approval_rules_mrs_on_project_id ON merge_requests_approval_rules_merge_requests USING btree (project_id);

CREATE INDEX index_mrs_approval_rules_projects_on_project_id ON merge_requests_approval_rules_projects USING btree (project_id);

CREATE UNIQUE INDEX index_mrs_ars_approver_groups_on_ar_id_and_group_id ON merge_requests_approval_rules_approver_groups USING btree (approval_rule_id, group_id);

CREATE UNIQUE INDEX index_mrs_ars_groups_on_ar_id_and_group_id ON merge_requests_approval_rules_groups USING btree (approval_rule_id, group_id);

CREATE UNIQUE INDEX index_mrs_ars_mrs_on_ar_id_and_mr_id ON merge_requests_approval_rules_merge_requests USING btree (approval_rule_id, merge_request_id);

CREATE UNIQUE INDEX index_mrs_ars_projects_on_ar_id_and_project_id ON merge_requests_approval_rules_projects USING btree (approval_rule_id, project_id);

CREATE UNIQUE INDEX index_mrs_ars_users_on_ar_id_and_user_id ON merge_requests_approval_rules_approver_users USING btree (approval_rule_id, user_id);

CREATE INDEX index_namespace_admin_notes_on_namespace_id ON namespace_admin_notes USING btree (namespace_id);

CREATE UNIQUE INDEX index_namespace_aggregation_schedules_on_namespace_id ON namespace_aggregation_schedules USING btree (namespace_id);

CREATE UNIQUE INDEX index_namespace_ai_settings_on_namespace_id ON namespace_ai_settings USING btree (namespace_id);

CREATE UNIQUE INDEX index_namespace_bans_on_namespace_id_and_user_id ON namespace_bans USING btree (namespace_id, user_id);

CREATE INDEX index_namespace_bans_on_user_id ON namespace_bans USING btree (user_id);

CREATE INDEX index_namespace_commit_emails_on_email_id ON namespace_commit_emails USING btree (email_id);

CREATE INDEX index_namespace_commit_emails_on_namespace_id ON namespace_commit_emails USING btree (namespace_id);

CREATE UNIQUE INDEX index_namespace_commit_emails_on_user_id_and_namespace_id ON namespace_commit_emails USING btree (user_id, namespace_id);

CREATE INDEX index_namespace_deletion_schedules_on_marked_for_deletion_at ON namespace_deletion_schedules USING btree (marked_for_deletion_at);

CREATE INDEX index_namespace_deletion_schedules_on_user_id ON namespace_deletion_schedules USING btree (user_id);

CREATE INDEX index_namespace_details_on_creator_id ON namespace_details USING btree (creator_id);

CREATE UNIQUE INDEX index_namespace_import_users_on_namespace_id ON namespace_import_users USING btree (namespace_id);

CREATE UNIQUE INDEX index_namespace_import_users_on_user_id ON namespace_import_users USING btree (user_id);

CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON namespace_root_storage_statistics USING btree (namespace_id);

CREATE INDEX index_namespace_settings_on_duo_features ON namespace_settings USING btree (duo_features_enabled, lock_duo_features_enabled) INCLUDE (namespace_id) WHERE (duo_features_enabled IS NOT NULL);

CREATE INDEX index_namespace_settings_on_namespace_id_where_archived_true ON namespace_settings USING btree (namespace_id) WHERE (archived = true);

CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id);

CREATE UNIQUE INDEX index_namespaces_name_parent_id_type ON namespaces USING btree (name, parent_id, type);

CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at);

CREATE INDEX index_namespaces_on_custom_project_templates_group_id_and_type ON namespaces USING btree (custom_project_templates_group_id, type) WHERE (custom_project_templates_group_id IS NOT NULL);

CREATE INDEX index_namespaces_on_file_template_project_id ON namespaces USING btree (file_template_project_id);

CREATE INDEX index_namespaces_on_ldap_sync_last_successful_update_at ON namespaces USING btree (ldap_sync_last_successful_update_at);

CREATE INDEX index_namespaces_on_name_trigram ON namespaces USING gin (name gin_trgm_ops);

CREATE INDEX index_namespaces_on_organization_id ON namespaces USING btree (organization_id);

CREATE INDEX index_namespaces_on_organization_id_for_groups ON namespaces USING btree (organization_id) WHERE ((type)::text = 'Group'::text);

CREATE INDEX index_namespaces_on_owner_id ON namespaces USING btree (owner_id);

CREATE UNIQUE INDEX index_namespaces_on_parent_id_and_id ON namespaces USING btree (parent_id, id);

CREATE INDEX index_namespaces_on_path ON namespaces USING btree (path);

CREATE INDEX index_namespaces_on_path_for_top_level_non_projects ON namespaces USING btree (lower((path)::text)) WHERE ((parent_id IS NULL) AND ((type)::text <> 'Project'::text));

CREATE INDEX index_namespaces_on_path_trigram ON namespaces USING gin (path gin_trgm_ops);

CREATE UNIQUE INDEX index_namespaces_on_push_rule_id ON namespaces USING btree (push_rule_id);

CREATE UNIQUE INDEX index_namespaces_on_runners_token_encrypted ON namespaces USING btree (runners_token_encrypted);

CREATE INDEX index_namespaces_on_traversal_ids ON namespaces USING gin (traversal_ids);

CREATE INDEX index_namespaces_on_traversal_ids_for_groups ON namespaces USING gin (traversal_ids) WHERE ((type)::text = 'Group'::text);

CREATE INDEX index_namespaces_on_traversal_ids_for_groups_btree ON namespaces USING btree (traversal_ids) WHERE ((type)::text = 'Group'::text);

CREATE INDEX index_namespaces_on_type_and_id ON namespaces USING btree (type, id);

CREATE INDEX index_namespaces_public_groups_name_id ON namespaces USING btree (name, id) WHERE (((type)::text = 'Group'::text) AND (visibility_level = 20));

CREATE INDEX index_namespaces_sync_events_on_namespace_id ON namespaces_sync_events USING btree (namespace_id);

CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON members USING btree (source_id, source_type) WHERE ((requested_at IS NULL) AND ((type)::text = 'ProjectMember'::text));

CREATE INDEX index_non_sql_service_pings_on_organization_id ON non_sql_service_pings USING btree (organization_id);

CREATE UNIQUE INDEX index_non_sql_service_pings_on_recorded_at ON non_sql_service_pings USING btree (recorded_at);

CREATE UNIQUE INDEX index_note_diff_files_on_diff_note_id ON note_diff_files USING btree (diff_note_id);

CREATE INDEX index_note_metadata_on_note_id ON note_metadata USING btree (note_id);

CREATE INDEX index_notes_for_cherry_picked_merge_requests ON notes USING btree (project_id, commit_id) WHERE ((noteable_type)::text = 'MergeRequest'::text);

CREATE INDEX index_notes_on_author_id_and_created_at_and_id ON notes USING btree (author_id, created_at, id);

CREATE INDEX index_notes_on_commit_id ON notes USING btree (commit_id);

CREATE INDEX index_notes_on_created_at ON notes USING btree (created_at);

CREATE INDEX index_notes_on_discussion_id ON notes USING btree (discussion_id);

CREATE INDEX index_notes_on_id_where_confidential ON notes USING btree (id) WHERE (confidential = true);

CREATE INDEX index_notes_on_id_where_internal ON notes USING btree (id) WHERE (internal = true);

CREATE INDEX index_notes_on_line_code ON notes USING btree (line_code);

CREATE INDEX index_notes_on_namespace_id ON notes USING btree (namespace_id);

CREATE INDEX index_notes_on_noteable_id_and_noteable_type_and_system ON notes USING btree (noteable_id, noteable_type, system);

CREATE INDEX index_notes_on_noteable_id_noteable_type_and_id ON notes USING btree (noteable_id, noteable_type, id);

CREATE INDEX index_notes_on_project_id_and_id_and_system_false ON notes USING btree (project_id, id) WHERE (NOT system);

CREATE INDEX index_notes_on_project_id_and_noteable_type ON notes USING btree (project_id, noteable_type);

CREATE INDEX index_notes_on_review_id ON notes USING btree (review_id);

CREATE INDEX index_notification_settings_on_source_and_level_and_user ON notification_settings USING btree (source_id, source_type, level, user_id);

CREATE UNIQUE INDEX index_notifications_on_user_id_and_source_id_and_source_type ON notification_settings USING btree (user_id, source_id, source_type);

CREATE UNIQUE INDEX index_npm_metadata_caches_on_package_name_project_id_unique ON packages_npm_metadata_caches USING btree (package_name, project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX index_ns_root_stor_stats_on_registry_size_estimated ON namespace_root_storage_statistics USING btree (registry_size_estimated);

CREATE UNIQUE INDEX index_ns_user_callouts_feature ON user_namespace_callouts USING btree (user_id, feature_name, namespace_id);

CREATE INDEX index_oauth_access_grants_on_application_id ON oauth_access_grants USING btree (application_id);

CREATE INDEX index_oauth_access_grants_on_created_at_expires_in ON oauth_access_grants USING btree (created_at, expires_in);

CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON oauth_access_grants USING btree (resource_owner_id, application_id, created_at);

CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON oauth_access_grants USING btree (token);

CREATE INDEX index_oauth_access_tokens_on_application_id ON oauth_access_tokens USING btree (application_id);

CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON oauth_access_tokens USING btree (refresh_token);

CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON oauth_access_tokens USING btree (token);

CREATE INDEX index_oauth_applications_on_owner_id_and_owner_type ON oauth_applications USING btree (owner_id, owner_type);

CREATE UNIQUE INDEX index_oauth_applications_on_uid ON oauth_applications USING btree (uid);

CREATE INDEX index_oauth_device_grants_on_application_id ON oauth_device_grants USING btree (application_id);

CREATE UNIQUE INDEX index_oauth_device_grants_on_device_code ON oauth_device_grants USING btree (device_code);

CREATE UNIQUE INDEX index_oauth_device_grants_on_user_code ON oauth_device_grants USING btree (user_code);

CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON oauth_openid_requests USING btree (access_grant_id);

CREATE INDEX index_observability_group_o11y_settings_on_group_id ON observability_group_o11y_settings USING btree (group_id);

CREATE INDEX index_observability_logs_issues_connections_on_project_id ON observability_logs_issues_connections USING btree (project_id);

CREATE INDEX index_observability_metrics_issues_connections_on_namespace_id ON observability_metrics_issues_connections USING btree (namespace_id);

CREATE INDEX index_observability_metrics_issues_connections_on_project_id ON observability_metrics_issues_connections USING btree (project_id);

CREATE INDEX index_observability_traces_issues_connections_on_project_id ON observability_traces_issues_connections USING btree (project_id);

CREATE UNIQUE INDEX index_on_deploy_keys_id_and_type_and_public ON keys USING btree (id, type) WHERE (public = true);

CREATE INDEX index_on_design_management_designs_issue_id_and_id ON design_management_designs USING btree (issue_id, id);

CREATE INDEX index_on_dingtalk_tracker_data_corpid ON dingtalk_tracker_data USING btree (corpid) WHERE (corpid IS NOT NULL);

COMMENT ON INDEX index_on_dingtalk_tracker_data_corpid IS 'JiHu-specific index';

CREATE INDEX index_on_events_to_improve_contribution_analytics_performance ON events USING btree (project_id, target_type, action, created_at, author_id, id);

CREATE INDEX index_on_group_id_on_webhooks ON web_hooks USING btree (group_id);

CREATE INDEX index_on_identities_lower_extern_uid_and_provider ON identities USING btree (lower((extern_uid)::text), provider);

CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_usage_trends_measurements USING btree (identifier, recorded_at);

CREATE INDEX index_on_issue_assignment_events_issue_id_action_created_at_id ON issue_assignment_events USING btree (issue_id, action, created_at, id);

CREATE INDEX index_on_job_artifact_id_partition_id_verification_state ON ci_job_artifact_states USING btree (verification_state, job_artifact_id, partition_id);

CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type);

CREATE INDEX index_on_merge_request_diffs_head_commit_sha ON merge_request_diffs USING btree (head_commit_sha);

CREATE INDEX index_on_merge_request_reviewers_user_id_and_state ON merge_request_reviewers USING btree (user_id, state) WHERE (state = 2);

CREATE INDEX index_on_merge_requests_for_latest_diffs ON merge_requests USING btree (target_project_id) INCLUDE (id, latest_merge_request_diff_id);

COMMENT ON INDEX index_on_merge_requests_for_latest_diffs IS 'Index used to efficiently obtain the oldest merge request for a commit SHA';

CREATE INDEX index_on_mr_assignment_events_mr_id_action_created_at_id ON merge_request_assignment_events USING btree (merge_request_id, action, created_at, id);

CREATE INDEX index_on_namespaces_lower_name ON namespaces USING btree (lower((name)::text));

CREATE INDEX index_on_namespaces_lower_path ON namespaces USING btree (lower((path)::text));

CREATE INDEX index_on_namespaces_namespaces_by_top_level_namespace ON namespaces USING btree ((traversal_ids[1]), type, id);

CREATE INDEX index_on_oncall_schedule_escalation_rule ON incident_management_escalation_rules USING btree (oncall_schedule_id);

CREATE UNIQUE INDEX index_on_project_id_escalation_policy_name_unique ON incident_management_escalation_policies USING btree (project_id, name);

CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text));

CREATE INDEX index_on_sbom_sources_package_manager_name ON sbom_sources USING btree ((((source -> 'package_manager'::text) ->> 'name'::text)));

CREATE INDEX index_on_todos_user_project_target_and_state ON todos USING btree (user_id, project_id, target_type, target_id, id) WHERE ((state)::text = 'pending'::text);

CREATE INDEX index_on_users_lower_email ON users USING btree (lower((email)::text));

CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username)::text));

CREATE INDEX index_on_users_name_lower ON users USING btree (lower((name)::text));

CREATE INDEX index_on_value_stream_dashboard_aggregations_last_run_at_and_id ON value_stream_dashboard_aggregations USING btree (last_run_at NULLS FIRST, namespace_id) WHERE (enabled IS TRUE);

CREATE UNIQUE INDEX index_onboarding_progresses_on_namespace_id ON onboarding_progresses USING btree (namespace_id);

CREATE INDEX index_oncall_shifts_on_rotation_id_and_starts_at_and_ends_at ON incident_management_oncall_shifts USING btree (rotation_id, starts_at, ends_at);

CREATE INDEX index_open_issues_on_namespace_id_confidential_author_id_id ON issues USING btree (namespace_id, confidential, author_id, id) WHERE (state_id = 1);

CREATE INDEX index_operations_feature_flags_issues_on_issue_id ON operations_feature_flags_issues USING btree (issue_id);

CREATE INDEX index_operations_feature_flags_issues_on_project_id ON operations_feature_flags_issues USING btree (project_id);

CREATE UNIQUE INDEX index_operations_feature_flags_on_project_id_and_iid ON operations_feature_flags USING btree (project_id, iid);

CREATE UNIQUE INDEX index_operations_feature_flags_on_project_id_and_name ON operations_feature_flags USING btree (project_id, name);

CREATE INDEX index_operations_scopes_on_project_id ON operations_scopes USING btree (project_id);

CREATE UNIQUE INDEX index_operations_scopes_on_strategy_id_and_environment_scope ON operations_scopes USING btree (strategy_id, environment_scope);

CREATE INDEX index_operations_strategies_on_feature_flag_id ON operations_strategies USING btree (feature_flag_id);

CREATE INDEX index_operations_strategies_on_project_id ON operations_strategies USING btree (project_id);

CREATE INDEX index_operations_strategies_user_lists_on_project_id ON operations_strategies_user_lists USING btree (project_id);

CREATE INDEX index_operations_strategies_user_lists_on_user_list_id ON operations_strategies_user_lists USING btree (user_list_id);

CREATE UNIQUE INDEX index_operations_user_lists_on_project_id_and_iid ON operations_user_lists USING btree (project_id, iid);

CREATE UNIQUE INDEX index_operations_user_lists_on_project_id_and_name ON operations_user_lists USING btree (project_id, name);

CREATE UNIQUE INDEX index_ops_feature_flags_issues_on_feature_flag_id_and_issue_id ON operations_feature_flags_issues USING btree (feature_flag_id, issue_id);

CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list_id ON operations_strategies_user_lists USING btree (strategy_id, user_list_id);

CREATE UNIQUE INDEX index_organization_push_rules_on_organization_id ON organization_push_rules USING btree (organization_id);

CREATE INDEX index_organization_user_aliases_on_user_id ON organization_user_aliases USING btree (user_id);

CREATE INDEX index_organization_user_details_on_lower_username ON organization_user_details USING btree (lower(username));

CREATE INDEX index_organization_user_details_on_user_id ON organization_user_details USING btree (user_id);

CREATE INDEX index_organization_users_on_org_id_access_level_user_id ON organization_users USING btree (organization_id, access_level, user_id);

CREATE INDEX index_organization_users_on_organization_id_and_id ON organization_users USING btree (organization_id, id);

CREATE UNIQUE INDEX index_organization_users_on_organization_id_and_user_id ON organization_users USING btree (organization_id, user_id);

CREATE INDEX index_organization_users_on_user_id ON organization_users USING btree (user_id);

CREATE INDEX index_organizations_on_name_trigram ON organizations USING gin (name gin_trgm_ops);

CREATE INDEX index_organizations_on_path_trigram ON organizations USING gin (path gin_trgm_ops);

CREATE UNIQUE INDEX index_organizations_on_unique_name_per_group ON customer_relations_organizations USING btree (group_id, lower(name), id);

CREATE INDEX index_p_catalog_resource_sync_events_on_id_where_pending ON ONLY p_catalog_resource_sync_events USING btree (id) WHERE (status = 1);

CREATE INDEX index_p_ci_build_names_on_project_id_and_build_id ON ONLY p_ci_build_names USING btree (project_id, build_id);

CREATE INDEX index_p_ci_build_names_on_search_vector ON ONLY p_ci_build_names USING gin (search_vector);

CREATE INDEX index_p_ci_build_sources_on_pipeline_source ON ONLY p_ci_build_sources USING btree (pipeline_source);

CREATE INDEX index_p_ci_build_sources_on_project_id_and_build_id ON ONLY p_ci_build_sources USING btree (project_id, build_id);

CREATE INDEX index_p_ci_build_sources_on_search_columns ON ONLY p_ci_build_sources USING btree (project_id, source, build_id, partition_id);

CREATE INDEX index_p_ci_build_tags_on_build_id_and_partition_id ON ONLY p_ci_build_tags USING btree (build_id, partition_id);

CREATE INDEX index_p_ci_build_tags_on_project_id ON ONLY p_ci_build_tags USING btree (project_id);

CREATE UNIQUE INDEX index_p_ci_build_tags_on_tag_id_and_build_id_and_partition_id ON ONLY p_ci_build_tags USING btree (tag_id, build_id, partition_id);

CREATE INDEX index_p_ci_build_trace_metadata_on_project_id ON ONLY p_ci_build_trace_metadata USING btree (project_id);

CREATE INDEX index_p_ci_build_trace_metadata_on_trace_artifact_id ON ONLY p_ci_build_trace_metadata USING btree (trace_artifact_id);

CREATE INDEX index_p_ci_builds_execution_configs_on_pipeline_id ON ONLY p_ci_builds_execution_configs USING btree (pipeline_id);

CREATE INDEX index_p_ci_builds_execution_configs_on_project_id ON ONLY p_ci_builds_execution_configs USING btree (project_id);

CREATE INDEX index_p_ci_builds_on_execution_config_id ON ONLY p_ci_builds USING btree (execution_config_id) WHERE (execution_config_id IS NOT NULL);

CREATE INDEX index_p_ci_finished_build_ch_sync_events_finished_at ON ONLY p_ci_finished_build_ch_sync_events USING btree (partition, build_finished_at);

CREATE INDEX index_p_ci_finished_build_ch_sync_events_on_project_id ON ONLY p_ci_finished_build_ch_sync_events USING btree (project_id);

CREATE UNIQUE INDEX index_p_ci_job_annotations_on_partition_id_job_id_name ON ONLY p_ci_job_annotations USING btree (partition_id, job_id, name);

CREATE INDEX index_p_ci_job_annotations_on_project_id ON ONLY p_ci_job_annotations USING btree (project_id);

CREATE INDEX index_p_ci_job_artifact_reports_on_project_id ON ONLY p_ci_job_artifact_reports USING btree (project_id);

CREATE UNIQUE INDEX index_p_ci_job_inputs_on_job_id_and_name ON ONLY p_ci_job_inputs USING btree (job_id, name, partition_id);

CREATE INDEX index_p_ci_job_inputs_on_project_id ON ONLY p_ci_job_inputs USING btree (project_id);

CREATE INDEX index_p_ci_pipeline_variables_on_project_id ON ONLY p_ci_pipeline_variables USING btree (project_id);

CREATE INDEX index_p_ci_runner_machine_builds_on_project_id ON ONLY p_ci_runner_machine_builds USING btree (project_id);

CREATE INDEX index_p_ci_runner_machine_builds_on_runner_machine_id ON ONLY p_ci_runner_machine_builds USING btree (runner_machine_id);

CREATE INDEX index_p_ci_workloads_on_project_id ON ONLY p_ci_workloads USING btree (project_id);

CREATE INDEX index_p_duo_workflows_checkpoints_on_namespace_id ON ONLY p_duo_workflows_checkpoints USING btree (namespace_id);

CREATE INDEX index_p_duo_workflows_checkpoints_on_project_id ON ONLY p_duo_workflows_checkpoints USING btree (project_id);

CREATE INDEX index_p_duo_workflows_checkpoints_thread ON ONLY p_duo_workflows_checkpoints USING btree (workflow_id, thread_ts);

CREATE UNIQUE INDEX index_p_knowledge_graph_enabled_namespaces_on_namespace_id ON ONLY p_knowledge_graph_enabled_namespaces USING btree (namespace_id);

CREATE INDEX index_p_knowledge_graph_enabled_namespaces_on_state ON ONLY p_knowledge_graph_enabled_namespaces USING btree (state);

CREATE INDEX index_p_knowledge_graph_replicas_on_namespace_id ON ONLY p_knowledge_graph_replicas USING btree (namespace_id);

CREATE INDEX index_p_knowledge_graph_replicas_on_schema_version ON ONLY p_knowledge_graph_replicas USING btree (schema_version);

CREATE INDEX index_p_knowledge_graph_replicas_on_state ON ONLY p_knowledge_graph_replicas USING btree (state);

CREATE INDEX index_p_knowledge_graph_replicas_on_zoekt_node_id ON ONLY p_knowledge_graph_replicas USING btree (zoekt_node_id);

CREATE INDEX index_p_knowledge_graph_tasks_on_knowledge_graph_replica_id ON ONLY p_knowledge_graph_tasks USING btree (knowledge_graph_replica_id);

CREATE INDEX index_p_knowledge_graph_tasks_on_node_state_and_perform_at ON ONLY p_knowledge_graph_tasks USING btree (zoekt_node_id, state, perform_at);

CREATE INDEX index_p_knowledge_graph_tasks_on_state ON ONLY p_knowledge_graph_tasks USING btree (state);

CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id);

CREATE INDEX index_packages_build_infos_on_project_id ON packages_build_infos USING btree (project_id);

CREATE INDEX index_packages_build_infos_package_id_id ON packages_build_infos USING btree (package_id, id);

CREATE INDEX index_packages_build_infos_package_id_pipeline_id_id ON packages_build_infos USING btree (package_id, pipeline_id, id);

CREATE UNIQUE INDEX index_packages_composer_metadata_on_package_id_and_target_sha ON packages_composer_metadata USING btree (package_id, target_sha);

CREATE INDEX index_packages_composer_metadata_on_project_id ON packages_composer_metadata USING btree (project_id);

CREATE UNIQUE INDEX index_packages_conan_file_metadata_on_package_file_id ON packages_conan_file_metadata USING btree (package_file_id);

CREATE INDEX index_packages_conan_file_metadata_on_package_reference_id ON packages_conan_file_metadata USING btree (package_reference_id);

CREATE INDEX index_packages_conan_file_metadata_on_package_revision_id ON packages_conan_file_metadata USING btree (package_revision_id);

CREATE INDEX index_packages_conan_file_metadata_on_project_id ON packages_conan_file_metadata USING btree (project_id);

CREATE INDEX index_packages_conan_file_metadata_on_recipe_revision_id ON packages_conan_file_metadata USING btree (recipe_revision_id);

CREATE UNIQUE INDEX index_packages_conan_metadata_on_package_id_username_channel ON packages_conan_metadata USING btree (package_id, package_username, package_channel);

CREATE INDEX index_packages_conan_metadata_on_project_id ON packages_conan_metadata USING btree (project_id);

CREATE INDEX index_packages_conan_package_references_on_project_id ON packages_conan_package_references USING btree (project_id);

CREATE INDEX index_packages_conan_package_references_on_recipe_revision_id ON packages_conan_package_references USING btree (recipe_revision_id);

CREATE INDEX index_packages_conan_package_revisions_on_package_reference_id ON packages_conan_package_revisions USING btree (package_reference_id);

CREATE INDEX index_packages_conan_package_revisions_on_project_id ON packages_conan_package_revisions USING btree (project_id);

CREATE INDEX index_packages_conan_recipe_revisions_on_project_id ON packages_conan_recipe_revisions USING btree (project_id);

CREATE INDEX index_packages_debian_file_metadata_on_project_id ON packages_debian_file_metadata USING btree (project_id);

CREATE INDEX index_packages_debian_group_architectures_on_group_id ON packages_debian_group_architectures USING btree (group_id);

CREATE INDEX index_packages_debian_group_component_files_on_component_id ON packages_debian_group_component_files USING btree (component_id);

CREATE INDEX index_packages_debian_group_component_files_on_group_id ON packages_debian_group_component_files USING btree (group_id);

CREATE INDEX index_packages_debian_group_components_on_group_id ON packages_debian_group_components USING btree (group_id);

CREATE INDEX index_packages_debian_group_distribution_keys_on_group_id ON packages_debian_group_distribution_keys USING btree (group_id);

CREATE INDEX index_packages_debian_group_distributions_on_creator_id ON packages_debian_group_distributions USING btree (creator_id);

CREATE INDEX index_packages_debian_project_architectures_on_project_id ON packages_debian_project_architectures USING btree (project_id);

CREATE INDEX index_packages_debian_project_component_files_on_component_id ON packages_debian_project_component_files USING btree (component_id);

CREATE INDEX index_packages_debian_project_component_files_on_project_id ON packages_debian_project_component_files USING btree (project_id);

CREATE INDEX index_packages_debian_project_components_on_project_id ON packages_debian_project_components USING btree (project_id);

CREATE INDEX index_packages_debian_project_distribution_keys_on_project_id ON packages_debian_project_distribution_keys USING btree (project_id);

CREATE INDEX index_packages_debian_project_distributions_on_creator_id ON packages_debian_project_distributions USING btree (creator_id);

CREATE INDEX index_packages_debian_publications_on_distribution_id ON packages_debian_publications USING btree (distribution_id);

CREATE UNIQUE INDEX index_packages_debian_publications_on_package_id ON packages_debian_publications USING btree (package_id);

CREATE INDEX index_packages_debian_publications_on_project_id ON packages_debian_publications USING btree (project_id);

CREATE UNIQUE INDEX index_packages_dependencies_on_name_version_pattern_project_id ON packages_dependencies USING btree (name, version_pattern, project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX index_packages_dependencies_on_project_id ON packages_dependencies USING btree (project_id);

CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_dependency_links USING btree (dependency_id);

CREATE INDEX index_packages_dependency_links_on_project_id ON packages_dependency_links USING btree (project_id);

CREATE INDEX index_packages_helm_file_metadata_on_channel ON packages_helm_file_metadata USING btree (channel);

CREATE INDEX index_packages_helm_file_metadata_on_pf_id_and_channel ON packages_helm_file_metadata USING btree (package_file_id, channel);

CREATE INDEX index_packages_helm_file_metadata_on_project_id ON packages_helm_file_metadata USING btree (project_id);

CREATE UNIQUE INDEX index_packages_helm_metadata_caches_on_object_storage_key ON packages_helm_metadata_caches USING btree (object_storage_key);

CREATE UNIQUE INDEX index_packages_helm_metadata_caches_on_project_id_and_channel ON packages_helm_metadata_caches USING btree (project_id, channel);

CREATE INDEX index_packages_maven_metadata_on_package_id_and_path ON packages_maven_metadata USING btree (package_id, path);

CREATE INDEX index_packages_maven_metadata_on_path ON packages_maven_metadata USING btree (path);

CREATE INDEX index_packages_maven_metadata_on_project_id ON packages_maven_metadata USING btree (project_id);

CREATE UNIQUE INDEX index_packages_npm_metadata_caches_on_object_storage_key ON packages_npm_metadata_caches USING btree (object_storage_key);

CREATE INDEX index_packages_npm_metadata_caches_on_project_id_status ON packages_npm_metadata_caches USING btree (project_id, status);

CREATE INDEX index_packages_npm_metadata_on_package_json_deprecate_exist ON packages_npm_metadata USING btree (package_id) WHERE (package_json ? 'deprecated'::text);

CREATE INDEX index_packages_npm_metadata_on_project_id ON packages_npm_metadata USING btree (project_id);

CREATE INDEX index_packages_nuget_dependency_link_metadata_on_project_id ON packages_nuget_dependency_link_metadata USING btree (project_id);

CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_nuget_dependency_link_metadata USING btree (dependency_link_id);

CREATE INDEX index_packages_nuget_metadata_on_project_id ON packages_nuget_metadata USING btree (project_id);

CREATE UNIQUE INDEX index_packages_nuget_symbols_on_object_storage_key ON packages_nuget_symbols USING btree (object_storage_key);

CREATE INDEX index_packages_nuget_symbols_on_package_id ON packages_nuget_symbols USING btree (package_id);

CREATE INDEX index_packages_nuget_symbols_on_project_id ON packages_nuget_symbols USING btree (project_id);

CREATE INDEX index_packages_on_available_pypi_packages ON packages_packages USING btree (project_id, id) WHERE ((status = ANY (ARRAY[0, 1])) AND (package_type = 5) AND (version IS NOT NULL));

CREATE INDEX index_packages_package_file_build_infos_on_package_file_id ON packages_package_file_build_infos USING btree (package_file_id);

CREATE INDEX index_packages_package_file_build_infos_on_pipeline_id ON packages_package_file_build_infos USING btree (pipeline_id);

CREATE INDEX index_packages_package_file_build_infos_on_project_id ON packages_package_file_build_infos USING btree (project_id);

CREATE INDEX index_packages_package_files_on_file_name ON packages_package_files USING gin (file_name gin_trgm_ops);

CREATE INDEX index_packages_package_files_on_file_name_file_sha256 ON packages_package_files USING btree (file_name, file_sha256);

CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store);

CREATE INDEX index_packages_package_files_on_id_for_cleanup ON packages_package_files USING btree (id) WHERE (status = 1);

CREATE INDEX index_packages_package_files_on_package_file_extension_status ON packages_package_files USING btree (package_id) WHERE ((status = 0) AND (reverse(split_part(reverse((file_name)::text), '.'::text, 1)) = 'nupkg'::text));

CREATE INDEX index_packages_package_files_on_package_id_and_created_at_desc ON packages_package_files USING btree (package_id, created_at DESC);

CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name);

CREATE INDEX index_packages_package_files_on_package_id_id ON packages_package_files USING btree (package_id, id);

CREATE INDEX index_packages_package_files_on_package_id_status_and_id ON packages_package_files USING btree (package_id, status, id);

CREATE INDEX index_packages_package_files_on_status ON packages_package_files USING btree (status);

CREATE INDEX index_packages_package_files_on_verification_state ON packages_package_files USING btree (verification_state);

CREATE INDEX index_packages_packages_on_creator_id ON packages_packages USING btree (creator_id);

CREATE INDEX index_packages_packages_on_id_and_created_at ON packages_packages USING btree (id, created_at);

CREATE INDEX index_packages_packages_on_name_trigram ON packages_packages USING gin (name gin_trgm_ops);

CREATE INDEX index_packages_packages_on_project_id_and_created_at ON packages_packages USING btree (project_id, created_at);

CREATE INDEX index_packages_packages_on_project_id_and_lower_version ON packages_packages USING btree (project_id, lower((version)::text)) WHERE (package_type = 4);

CREATE INDEX index_packages_packages_on_project_id_and_package_type ON packages_packages USING btree (project_id, package_type);

CREATE INDEX index_packages_packages_on_project_id_and_status_and_id ON packages_packages USING btree (project_id, status, id);

CREATE INDEX index_packages_packages_on_project_id_and_version ON packages_packages USING btree (project_id, version);

CREATE INDEX index_packages_project_id_name_partial_for_nuget ON packages_packages USING btree (project_id, name) WHERE (((name)::text <> 'NuGet.Temporary.Package'::text) AND (version IS NOT NULL) AND (package_type = 4));

CREATE INDEX index_packages_pypi_metadata_on_project_id ON packages_pypi_metadata USING btree (project_id);

CREATE INDEX index_packages_rpm_metadata_on_package_id ON packages_rpm_metadata USING btree (package_id);

CREATE INDEX index_packages_rpm_metadata_on_project_id ON packages_rpm_metadata USING btree (project_id);

CREATE INDEX index_packages_rpm_repository_files_on_project_id_and_file_name ON packages_rpm_repository_files USING btree (project_id, file_name);

CREATE INDEX index_packages_rubygems_metadata_on_project_id ON packages_rubygems_metadata USING btree (project_id);

CREATE INDEX index_packages_tags_on_package_id_and_updated_at ON packages_tags USING btree (package_id, updated_at DESC);

CREATE INDEX index_packages_tags_on_project_id ON packages_tags USING btree (project_id);

CREATE INDEX index_packages_terraform_module_metadata_on_project_id ON packages_terraform_module_metadata USING btree (project_id);

CREATE INDEX index_pages_deployment_states_failed_verification ON pages_deployment_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_pages_deployment_states_needs_verification ON pages_deployment_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_pages_deployment_states_on_pages_deployment_id ON pages_deployment_states USING btree (pages_deployment_id);

CREATE INDEX index_pages_deployment_states_on_project_id ON pages_deployment_states USING btree (project_id);

CREATE INDEX index_pages_deployment_states_on_verification_state ON pages_deployment_states USING btree (verification_state);

CREATE INDEX index_pages_deployment_states_pending_verification ON pages_deployment_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_pages_deployments_on_ci_build_id ON pages_deployments USING btree (ci_build_id);

CREATE INDEX index_pages_deployments_on_deleted_at ON pages_deployments USING btree (deleted_at) WHERE (deleted_at IS NOT NULL);

CREATE INDEX index_pages_deployments_on_expires_at ON pages_deployments USING btree (expires_at, id) WHERE (expires_at IS NOT NULL);

CREATE INDEX index_pages_deployments_on_file_store_and_id ON pages_deployments USING btree (file_store, id);

CREATE INDEX index_pages_deployments_on_project_id ON pages_deployments USING btree (project_id);

CREATE INDEX index_pages_domain_acme_orders_on_challenge_token ON pages_domain_acme_orders USING btree (challenge_token);

CREATE INDEX index_pages_domain_acme_orders_on_pages_domain_id ON pages_domain_acme_orders USING btree (pages_domain_id);

CREATE INDEX index_pages_domain_acme_orders_on_project_id ON pages_domain_acme_orders USING btree (project_id);

CREATE INDEX index_pages_domains_need_auto_ssl_renewal_user_provided ON pages_domains USING btree (id) WHERE ((auto_ssl_enabled = true) AND (auto_ssl_failed = false) AND (certificate_source = 0));

CREATE INDEX index_pages_domains_need_auto_ssl_renewal_valid_not_after ON pages_domains USING btree (certificate_valid_not_after) WHERE ((auto_ssl_enabled = true) AND (auto_ssl_failed = false));

CREATE UNIQUE INDEX index_pages_domains_on_domain_and_wildcard ON pages_domains USING btree (domain, wildcard);

CREATE INDEX index_pages_domains_on_domain_lowercase ON pages_domains USING btree (lower((domain)::text));

CREATE INDEX index_pages_domains_on_project_id ON pages_domains USING btree (project_id);

CREATE INDEX index_pages_domains_on_project_id_and_enabled_until ON pages_domains USING btree (project_id, enabled_until);

CREATE INDEX index_pages_domains_on_remove_at ON pages_domains USING btree (remove_at);

CREATE INDEX index_pages_domains_on_scope ON pages_domains USING btree (scope);

CREATE INDEX index_pages_domains_on_usage ON pages_domains USING btree (usage);

CREATE INDEX index_pages_domains_on_verified_at ON pages_domains USING btree (verified_at);

CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON pages_domains USING btree (verified_at, enabled_until);

CREATE INDEX index_pages_domains_on_wildcard ON pages_domains USING btree (wildcard);

CREATE INDEX index_pat_on_user_id_and_expires_at ON personal_access_tokens USING btree (user_id, expires_at);

CREATE INDEX index_path_locks_on_path ON path_locks USING btree (path);

CREATE INDEX index_path_locks_on_project_id ON path_locks USING btree (project_id);

CREATE INDEX index_path_locks_on_user_id ON path_locks USING btree (user_id);

CREATE INDEX index_pats_on_expiring_at_seven_days_notification_sent_at ON personal_access_tokens USING btree (expires_at, id) WHERE ((impersonation = false) AND (revoked = false) AND (seven_days_notification_sent_at IS NULL));

CREATE INDEX index_pats_on_expiring_at_sixty_days_notification_sent_at ON personal_access_tokens USING btree (expires_at, id) WHERE ((impersonation = false) AND (revoked = false) AND (sixty_days_notification_sent_at IS NULL));

CREATE INDEX index_pats_on_expiring_at_thirty_days_notification_sent_at ON personal_access_tokens USING btree (expires_at, id) WHERE ((impersonation = false) AND (revoked = false) AND (thirty_days_notification_sent_at IS NULL));

CREATE INDEX index_pats_on_user_id_and_created_at_and_pat_id ON personal_access_tokens USING btree (user_id, created_at, id) WHERE (impersonation = false);

CREATE INDEX index_pats_on_user_id_and_expires_at_and_pat_id ON personal_access_tokens USING btree (user_id, expires_at, id DESC) WHERE (impersonation = false);

CREATE INDEX index_pats_on_user_id_and_last_used_at_and_pat_id ON personal_access_tokens USING btree (user_id, last_used_at, id) WHERE (impersonation = false);

CREATE INDEX index_pe_approval_rules_on_required_approvals_and_created_at ON protected_environment_approval_rules USING btree (required_approvals, created_at);

CREATE INDEX index_pep_policy_config_links_security_policy_id ON security_pipeline_execution_policy_config_links USING btree (security_policy_id);

CREATE INDEX index_personal_access_token_last_used_ips_on_organization_id ON personal_access_token_last_used_ips USING btree (organization_id);

CREATE INDEX index_personal_access_tokens_on_id_and_created_at ON personal_access_tokens USING btree (id, created_at);

CREATE INDEX index_personal_access_tokens_on_organization_id ON personal_access_tokens USING btree (organization_id);

CREATE UNIQUE INDEX index_personal_access_tokens_on_token_digest ON personal_access_tokens USING btree (token_digest);

CREATE INDEX index_personal_access_tokens_on_user_id ON personal_access_tokens USING btree (user_id);

CREATE INDEX index_pipeline_metadata_on_name_text_pattern_pipeline_id ON ci_pipeline_metadata USING btree (name text_pattern_ops, pipeline_id);

CREATE INDEX index_pipl_users_on_initial_email_sent_at ON pipl_users USING btree (initial_email_sent_at);

CREATE UNIQUE INDEX index_plan_limits_on_plan_id ON plan_limits USING btree (plan_id);

CREATE UNIQUE INDEX index_plans_on_name ON plans USING btree (name);

CREATE UNIQUE INDEX index_pm_advisories_on_advisory_xid_and_source_xid ON pm_advisories USING btree (advisory_xid, source_xid);

CREATE INDEX index_pm_advisories_on_cve ON pm_advisories USING btree (cve);

CREATE INDEX index_pm_affected_packages_on_pm_advisory_id ON pm_affected_packages USING btree (pm_advisory_id);

CREATE INDEX index_pm_affected_packages_on_purl_type_and_package_name ON pm_affected_packages USING btree (purl_type, package_name);

CREATE UNIQUE INDEX index_pm_cve_enrichment_on_cve ON pm_cve_enrichment USING btree (cve);

CREATE INDEX index_pm_package_version_licenses_on_pm_license_id ON pm_package_version_licenses USING btree (pm_license_id);

CREATE INDEX index_pm_package_version_licenses_on_pm_package_version_id ON pm_package_version_licenses USING btree (pm_package_version_id);

CREATE INDEX index_pm_package_versions_on_pm_package_id ON pm_package_versions USING btree (pm_package_id);

CREATE INDEX index_pool_repositories_on_shard_id ON pool_repositories USING btree (shard_id);

CREATE UNIQUE INDEX index_pool_repositories_on_source_project_id_and_shard_id ON pool_repositories USING btree (source_project_id, shard_id);

CREATE UNIQUE INDEX index_postgres_async_indexes_on_name ON postgres_async_indexes USING btree (name);

CREATE INDEX index_postgres_reindex_actions_on_index_identifier ON postgres_reindex_actions USING btree (index_identifier);

CREATE INDEX index_postgres_reindex_queued_actions_on_state ON postgres_reindex_queued_actions USING btree (state);

CREATE UNIQUE INDEX index_programming_languages_on_name ON programming_languages USING btree (name);

CREATE INDEX index_project_access_tokens_on_project_id ON project_access_tokens USING btree (project_id);

CREATE UNIQUE INDEX index_project_aliases_on_name ON project_aliases USING btree (name);

CREATE INDEX index_project_aliases_on_project_id ON project_aliases USING btree (project_id);

CREATE INDEX index_project_authorizations_for_migration_on_project_user ON project_authorizations_for_migration USING btree (project_id, user_id);

CREATE UNIQUE INDEX index_project_authorizations_on_project_user_access_level ON project_authorizations USING btree (project_id, user_id, access_level);

CREATE UNIQUE INDEX index_project_auto_devops_on_project_id ON project_auto_devops USING btree (project_id);

CREATE INDEX index_project_branch_rule_squash_options_on_project_id ON projects_branch_rules_squash_options USING btree (project_id);

CREATE UNIQUE INDEX index_project_build_artifacts_size_refreshes_on_project_id ON project_build_artifacts_size_refreshes USING btree (project_id);

CREATE UNIQUE INDEX index_project_ci_cd_settings_on_project_id ON project_ci_cd_settings USING btree (project_id);

CREATE INDEX index_project_ci_cd_settings_on_project_id_partial ON project_ci_cd_settings USING btree (project_id) WHERE (delete_pipelines_in_seconds IS NOT NULL);

CREATE UNIQUE INDEX index_project_ci_feature_usages_unique_columns ON project_ci_feature_usages USING btree (project_id, feature, default_branch);

CREATE INDEX index_project_compliance_framework_settings_on_framework_id ON project_compliance_framework_settings USING btree (framework_id);

CREATE INDEX index_project_compliance_standards_adherence_on_project_id ON project_compliance_standards_adherence USING btree (project_id);

CREATE INDEX index_project_compliance_violations_issues_on_issue_id ON project_compliance_violations_issues USING btree (issue_id);

CREATE INDEX index_project_compliance_violations_issues_on_project_id ON project_compliance_violations_issues USING btree (project_id);

CREATE INDEX index_project_custom_attributes_on_key_and_value ON project_custom_attributes USING btree (key, value);

CREATE UNIQUE INDEX index_project_custom_attributes_on_project_id_and_key ON project_custom_attributes USING btree (project_id, key);

CREATE UNIQUE INDEX index_project_daily_statistics_on_project_id_and_date ON project_daily_statistics USING btree (project_id, date DESC);

CREATE INDEX index_project_data_transfers_on_namespace_id ON project_data_transfers USING btree (namespace_id);

CREATE UNIQUE INDEX index_project_data_transfers_on_project_and_namespace_and_date ON project_data_transfers USING btree (project_id, namespace_id, date);

CREATE INDEX index_project_deploy_tokens_on_deploy_token_id ON project_deploy_tokens USING btree (deploy_token_id);

CREATE UNIQUE INDEX index_project_deploy_tokens_on_project_id_and_deploy_token_id ON project_deploy_tokens USING btree (project_id, deploy_token_id);

CREATE UNIQUE INDEX index_project_export_job_relation ON project_relation_exports USING btree (project_export_job_id, relation);

CREATE UNIQUE INDEX index_project_export_jobs_on_jid ON project_export_jobs USING btree (jid);

CREATE INDEX index_project_export_jobs_on_project_id_and_jid ON project_export_jobs USING btree (project_id, jid);

CREATE INDEX index_project_export_jobs_on_project_id_and_status ON project_export_jobs USING btree (project_id, status);

CREATE INDEX index_project_export_jobs_on_status ON project_export_jobs USING btree (status);

CREATE INDEX index_project_export_jobs_on_updated_at_and_id ON project_export_jobs USING btree (updated_at, id);

CREATE INDEX index_project_export_jobs_on_user_id ON project_export_jobs USING btree (user_id);

CREATE INDEX index_project_feature_usages_on_project_id ON project_feature_usages USING btree (project_id);

CREATE UNIQUE INDEX index_project_features_on_project_id ON project_features USING btree (project_id);

CREATE INDEX index_project_features_on_project_id_bal_20 ON project_features USING btree (project_id) WHERE (builds_access_level = 20);

CREATE UNIQUE INDEX index_project_features_on_project_id_include_container_registry ON project_features USING btree (project_id) INCLUDE (container_registry_access_level);

COMMENT ON INDEX index_project_features_on_project_id_include_container_registry IS 'Included column (container_registry_access_level) improves performance of the ContainerRepository.for_group_and_its_subgroups scope query';

CREATE INDEX index_project_features_on_project_id_on_public_package_registry ON project_features USING btree (project_id) WHERE (package_registry_access_level = 30);

CREATE INDEX index_project_features_on_project_id_ral_20 ON project_features USING btree (project_id) WHERE (repository_access_level = 20);

CREATE INDEX index_project_group_links_on_group_id_and_project_id ON project_group_links USING btree (group_id, project_id);

CREATE INDEX index_project_group_links_on_member_role_id ON project_group_links USING btree (member_role_id);

CREATE INDEX index_project_group_links_on_project_id ON project_group_links USING btree (project_id);

CREATE INDEX index_project_import_data_on_project_id ON project_import_data USING btree (project_id);

CREATE INDEX index_project_incident_management_settings_on_p_id_sla_timer ON project_incident_management_settings USING btree (project_id) WHERE (sla_timer = true);

CREATE INDEX index_project_members_on_id_temp ON members USING btree (id) WHERE ((source_type)::text = 'Project'::text);

CREATE INDEX index_project_mirror_data_on_last_successful_update_at ON project_mirror_data USING btree (last_successful_update_at);

CREATE INDEX index_project_mirror_data_on_last_update_at_and_retry_count ON project_mirror_data USING btree (last_update_at, retry_count);

CREATE UNIQUE INDEX index_project_mirror_data_on_project_id ON project_mirror_data USING btree (project_id);

CREATE INDEX index_project_mirror_data_on_status ON project_mirror_data USING btree (status);

CREATE INDEX index_project_relation_export_upload_id ON project_relation_export_uploads USING btree (project_relation_export_id);

CREATE INDEX index_project_relation_export_uploads_on_project_id ON project_relation_export_uploads USING btree (project_id);

CREATE INDEX index_project_relation_exports_on_project_id ON project_relation_exports USING btree (project_id);

CREATE UNIQUE INDEX index_project_repositories_on_disk_path ON project_repositories USING btree (disk_path);

CREATE UNIQUE INDEX index_project_repositories_on_project_id ON project_repositories USING btree (project_id);

CREATE INDEX index_project_repositories_on_shard_id_and_project_id ON project_repositories USING btree (shard_id, project_id);

CREATE INDEX index_project_repository_storage_moves_on_project_id ON project_repository_storage_moves USING btree (project_id);

CREATE INDEX index_project_requirement_compliance_statuses_on_project_id ON project_requirement_compliance_statuses USING btree (project_id);

CREATE INDEX index_project_saved_replies_on_project_id ON project_saved_replies USING btree (project_id);

CREATE UNIQUE INDEX index_project_secrets_managers_on_project_id ON project_secrets_managers USING btree (project_id);

CREATE INDEX index_project_security_exclusions_on_project_id ON project_security_exclusions USING btree (project_id);

CREATE INDEX index_project_settings_on_legacy_os_license_project_id ON project_settings USING btree (project_id) WHERE (legacy_open_source_license_available = true);

CREATE INDEX index_project_settings_on_project_id_partially ON project_settings USING btree (project_id) WHERE (has_vulnerabilities IS TRUE);

CREATE UNIQUE INDEX index_project_settings_on_push_rule_id ON project_settings USING btree (push_rule_id);

CREATE INDEX index_project_states_failed_verification ON project_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_project_states_needs_verification ON project_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE UNIQUE INDEX index_project_states_on_project_id ON project_states USING btree (project_id);

CREATE INDEX index_project_states_on_verification_state ON project_states USING btree (verification_state);

CREATE INDEX index_project_states_pending_verification ON project_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_project_statistics_on_namespace_id ON project_statistics USING btree (namespace_id);

CREATE INDEX index_project_statistics_on_packages_size_and_project_id ON project_statistics USING btree (packages_size, project_id);

CREATE UNIQUE INDEX index_project_statistics_on_project_id ON project_statistics USING btree (project_id);

CREATE INDEX index_project_statistics_on_repository_size_and_project_id ON project_statistics USING btree (repository_size, project_id);

CREATE INDEX index_project_statistics_on_root_namespace_id ON project_statistics USING btree (root_namespace_id);

CREATE INDEX index_project_statistics_on_storage_size_and_project_id ON project_statistics USING btree (storage_size, project_id);

CREATE INDEX index_project_statistics_on_wiki_size_and_project_id ON project_statistics USING btree (wiki_size, project_id);

CREATE UNIQUE INDEX index_project_topics_on_project_id_and_topic_id ON project_topics USING btree (project_id, topic_id);

CREATE INDEX index_project_topics_on_topic_id ON project_topics USING btree (topic_id);

CREATE UNIQUE INDEX index_project_user_callouts_feature ON user_project_callouts USING btree (user_id, feature_name, project_id);

CREATE UNIQUE INDEX index_project_wiki_repositories_on_project_id ON project_wiki_repositories USING btree (project_id);

CREATE INDEX index_projects_aimed_for_deletion ON projects USING btree (marked_for_deletion_at) WHERE ((marked_for_deletion_at IS NOT NULL) AND (pending_delete = false));

CREATE INDEX index_projects_api_created_at_id_desc ON projects USING btree (created_at, id DESC);

CREATE INDEX index_projects_api_last_activity_at_id_desc ON projects USING btree (last_activity_at, id DESC);

CREATE INDEX index_projects_api_name_id_desc ON projects USING btree (name, id DESC);

CREATE INDEX index_projects_api_path_id_desc ON projects USING btree (path, id DESC);

CREATE INDEX index_projects_api_updated_at_id_desc ON projects USING btree (updated_at, id DESC);

CREATE INDEX index_projects_api_vis20_created_at ON projects USING btree (created_at, id) WHERE (visibility_level = 20);

CREATE INDEX index_projects_api_vis20_last_activity_at ON projects USING btree (last_activity_at, id) WHERE (visibility_level = 20);

CREATE INDEX index_projects_api_vis20_name ON projects USING btree (name, id) WHERE (visibility_level = 20);

CREATE INDEX index_projects_api_vis20_path ON projects USING btree (path, id) WHERE (visibility_level = 20);

CREATE INDEX index_projects_api_vis20_updated_at ON projects USING btree (updated_at, id) WHERE (visibility_level = 20);

CREATE INDEX index_projects_id_for_aimed_for_deletion ON projects USING btree (id, marked_for_deletion_at) WHERE ((marked_for_deletion_at IS NOT NULL) AND (pending_delete = false));

CREATE INDEX index_projects_not_aimed_for_deletion ON projects USING btree (id) WHERE (marked_for_deletion_at IS NULL);

CREATE INDEX index_projects_on_creator_id_and_created_at_and_id ON projects USING btree (creator_id, created_at, id);

CREATE INDEX index_projects_on_creator_id_and_id ON projects USING btree (creator_id, id);

CREATE INDEX index_projects_on_creator_id_import_type_and_created_at_partial ON projects USING btree (creator_id, import_type, created_at) WHERE (import_type IS NOT NULL);

CREATE INDEX index_projects_on_description_trigram ON projects USING gin (description gin_trgm_ops);

CREATE INDEX index_projects_on_id_and_archived_and_pending_delete ON projects USING btree (id) WHERE ((archived = false) AND (pending_delete = false));

CREATE UNIQUE INDEX index_projects_on_id_partial_for_visibility ON projects USING btree (id) WHERE (visibility_level = ANY (ARRAY[10, 20]));

CREATE INDEX index_projects_on_id_service_desk_enabled ON projects USING btree (id) WHERE (service_desk_enabled = true);

CREATE INDEX index_projects_on_last_activity_at_and_id ON projects USING btree (last_activity_at, id);

CREATE INDEX index_projects_on_last_repository_check_at ON projects USING btree (last_repository_check_at) WHERE (last_repository_check_at IS NOT NULL);

CREATE INDEX index_projects_on_last_repository_check_failed ON projects USING btree (last_repository_check_failed);

CREATE INDEX index_projects_on_last_repository_updated_at ON projects USING btree (last_repository_updated_at);

CREATE INDEX index_projects_on_lower_name ON projects USING btree (lower((name)::text));

CREATE INDEX index_projects_on_marked_for_deletion_by_user_id ON projects USING btree (marked_for_deletion_by_user_id) WHERE (marked_for_deletion_by_user_id IS NOT NULL);

CREATE INDEX index_projects_on_mirror_creator_id_created_at ON projects USING btree (creator_id, created_at) WHERE ((mirror = true) AND (mirror_trigger_builds = true));

CREATE INDEX index_projects_on_mirror_id_where_mirror_and_trigger_builds ON projects USING btree (id) WHERE ((mirror = true) AND (mirror_trigger_builds = true));

CREATE INDEX index_projects_on_mirror_user_id ON projects USING btree (mirror_user_id);

CREATE INDEX index_projects_on_name_and_id ON projects USING btree (name, id);

CREATE INDEX index_projects_on_name_trigram ON projects USING gin (name gin_trgm_ops);

CREATE INDEX index_projects_on_namespace_id_and_id ON projects USING btree (namespace_id, id);

CREATE INDEX index_projects_on_namespace_id_and_repository_size_limit ON projects USING btree (namespace_id, repository_size_limit);

CREATE INDEX index_projects_on_organization_id_and_id ON projects USING btree (organization_id, id);

CREATE INDEX index_projects_on_path_trigram ON projects USING gin (path gin_trgm_ops);

CREATE INDEX index_projects_on_pending_delete ON projects USING btree (pending_delete);

CREATE INDEX index_projects_on_pool_repository_id ON projects USING btree (pool_repository_id) WHERE (pool_repository_id IS NOT NULL);

CREATE UNIQUE INDEX index_projects_on_project_namespace_id ON projects USING btree (project_namespace_id);

CREATE INDEX index_projects_on_repository_storage ON projects USING btree (repository_storage);

CREATE INDEX index_projects_on_star_count ON projects USING btree (star_count);

CREATE INDEX index_projects_on_updated_at_and_id ON projects USING btree (updated_at, id);

CREATE INDEX index_projects_sync_events_on_project_id ON projects_sync_events USING btree (project_id);

CREATE INDEX index_projects_visits_on_entity_id ON ONLY projects_visits USING btree (entity_id);

CREATE INDEX index_projects_visits_on_user_id_and_entity_id_and_visited_at ON ONLY projects_visits USING btree (user_id, entity_id, visited_at);

CREATE INDEX index_protected_branch_merge_access ON protected_branch_merge_access_levels USING btree (protected_branch_id);

CREATE INDEX index_protected_branch_merge_access_levels_on_group_id ON protected_branch_merge_access_levels USING btree (group_id);

CREATE INDEX index_protected_branch_merge_access_levels_on_user_id ON protected_branch_merge_access_levels USING btree (user_id);

CREATE INDEX index_protected_branch_push_access ON protected_branch_push_access_levels USING btree (protected_branch_id);

CREATE INDEX index_protected_branch_push_access_levels_on_group_id ON protected_branch_push_access_levels USING btree (group_id);

CREATE INDEX index_protected_branch_push_access_levels_on_protected_branch_n ON protected_branch_push_access_levels USING btree (protected_branch_namespace_id);

CREATE INDEX index_protected_branch_push_access_levels_on_protected_branch_p ON protected_branch_push_access_levels USING btree (protected_branch_project_id);

CREATE INDEX index_protected_branch_push_access_levels_on_user_id ON protected_branch_push_access_levels USING btree (user_id);

CREATE INDEX index_protected_branch_unprotect_access ON protected_branch_unprotect_access_levels USING btree (protected_branch_id);

CREATE INDEX index_protected_branch_unprotect_access_levels_on_group_id ON protected_branch_unprotect_access_levels USING btree (group_id);

CREATE INDEX index_protected_branch_unprotect_access_levels_on_user_id ON protected_branch_unprotect_access_levels USING btree (user_id);

CREATE INDEX index_protected_branches_namespace_id ON protected_branches USING btree (namespace_id) WHERE (namespace_id IS NOT NULL);

CREATE INDEX index_protected_branches_on_project_id ON protected_branches USING btree (project_id);

CREATE INDEX index_protected_environment_approval_rules_on_group_id ON protected_environment_approval_rules USING btree (group_id);

CREATE INDEX index_protected_environment_approval_rules_on_user_id ON protected_environment_approval_rules USING btree (user_id);

CREATE INDEX index_protected_environment_deploy_access ON protected_environment_deploy_access_levels USING btree (protected_environment_id);

CREATE INDEX index_protected_environment_deploy_access_levels_on_group_id ON protected_environment_deploy_access_levels USING btree (group_id);

CREATE INDEX index_protected_environment_deploy_access_levels_on_user_id ON protected_environment_deploy_access_levels USING btree (user_id);

CREATE INDEX index_protected_environment_group_id_of_protected_environment_a ON protected_environment_approval_rules USING btree (protected_environment_group_id);

CREATE INDEX index_protected_environment_project_id_of_protected_environment ON protected_environment_approval_rules USING btree (protected_environment_project_id);

CREATE INDEX index_protected_environments_on_approval_count_and_created_at ON protected_environments USING btree (required_approval_count, created_at);

CREATE UNIQUE INDEX index_protected_environments_on_group_id_and_name ON protected_environments USING btree (group_id, name) WHERE (group_id IS NOT NULL);

CREATE UNIQUE INDEX index_protected_environments_on_project_id_and_name ON protected_environments USING btree (project_id, name);

CREATE INDEX index_protected_tag_create_access ON protected_tag_create_access_levels USING btree (protected_tag_id);

CREATE INDEX index_protected_tag_create_access_levels_on_deploy_key_id ON protected_tag_create_access_levels USING btree (deploy_key_id);

CREATE INDEX index_protected_tag_create_access_levels_on_group_id ON protected_tag_create_access_levels USING btree (group_id);

CREATE INDEX index_protected_tag_create_access_levels_on_project_id ON protected_tag_create_access_levels USING btree (project_id);

CREATE INDEX index_protected_tag_create_access_levels_on_user_id ON protected_tag_create_access_levels USING btree (user_id);

CREATE UNIQUE INDEX index_protected_tags_on_project_id_and_name ON protected_tags USING btree (project_id, name);

CREATE INDEX index_push_rules_on_is_sample ON push_rules USING btree (is_sample) WHERE is_sample;

CREATE INDEX index_push_rules_on_organization_id ON push_rules USING btree (organization_id);

CREATE INDEX index_push_rules_on_project_id ON push_rules USING btree (project_id);

CREATE INDEX index_queries_service_pings_on_organization_id ON queries_service_pings USING btree (organization_id);

CREATE UNIQUE INDEX index_queries_service_pings_on_recorded_at ON queries_service_pings USING btree (recorded_at);

CREATE INDEX index_raw_usage_data_on_organization_id ON raw_usage_data USING btree (organization_id);

CREATE UNIQUE INDEX index_raw_usage_data_on_recorded_at ON raw_usage_data USING btree (recorded_at);

CREATE INDEX index_redirect_routes_on_namespace_id ON redirect_routes USING btree (namespace_id);

CREATE UNIQUE INDEX index_redirect_routes_on_path ON redirect_routes USING btree (path);

CREATE UNIQUE INDEX index_redirect_routes_on_path_unique_text_pattern_ops ON redirect_routes USING btree (lower((path)::text) varchar_pattern_ops);

CREATE INDEX index_redirect_routes_on_source_type_and_source_id ON redirect_routes USING btree (source_type, source_id);

CREATE INDEX index_related_epic_links_on_group_id ON related_epic_links USING btree (group_id);

CREATE INDEX index_related_epic_links_on_source_id ON related_epic_links USING btree (source_id);

CREATE UNIQUE INDEX index_related_epic_links_on_source_id_and_target_id ON related_epic_links USING btree (source_id, target_id);

CREATE INDEX index_related_epic_links_on_target_id ON related_epic_links USING btree (target_id);

CREATE INDEX index_relation_import_trackers_on_project_id ON relation_import_trackers USING btree (project_id);

CREATE INDEX index_release_links_on_project_id ON release_links USING btree (project_id);

CREATE UNIQUE INDEX index_release_links_on_release_id_and_name ON release_links USING btree (release_id, name);

CREATE UNIQUE INDEX index_release_links_on_release_id_and_url ON release_links USING btree (release_id, url);

CREATE INDEX index_releases_on_author_id_id_created_at ON releases USING btree (author_id, id, created_at);

CREATE INDEX index_releases_on_project_id_and_released_at_and_id ON releases USING btree (project_id, released_at, id);

CREATE INDEX index_releases_on_project_id_and_updated_at_and_released_at ON releases USING btree (project_id, updated_at, released_at);

CREATE INDEX index_releases_on_project_id_id ON releases USING btree (project_id, id);

CREATE UNIQUE INDEX index_releases_on_project_tag_unique ON releases USING btree (project_id, tag);

CREATE INDEX index_releases_on_released_at ON releases USING btree (released_at);

CREATE INDEX index_remote_mirrors_on_last_successful_update_at ON remote_mirrors USING btree (last_successful_update_at);

CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (project_id);

CREATE INDEX index_required_code_owners_sections_on_protected_branch_id ON required_code_owners_sections USING btree (protected_branch_id);

CREATE INDEX index_required_code_owners_sections_on_protected_branch_namespa ON required_code_owners_sections USING btree (protected_branch_namespace_id);

CREATE INDEX index_required_code_owners_sections_on_protected_branch_project ON required_code_owners_sections USING btree (protected_branch_project_id);

CREATE INDEX index_requirements_management_test_reports_on_author_id ON requirements_management_test_reports USING btree (author_id);

CREATE INDEX index_requirements_management_test_reports_on_build_id ON requirements_management_test_reports USING btree (build_id);

CREATE INDEX index_requirements_management_test_reports_on_issue_id ON requirements_management_test_reports USING btree (issue_id);

CREATE INDEX index_requirements_management_test_reports_on_project_id ON requirements_management_test_reports USING btree (project_id);

CREATE UNIQUE INDEX index_requirements_on_issue_id ON requirements USING btree (issue_id);

CREATE INDEX index_requirements_on_project_id ON requirements USING btree (project_id);

CREATE UNIQUE INDEX index_requirements_on_project_id_and_iid ON requirements USING btree (project_id, iid) WHERE (project_id IS NOT NULL);

CREATE INDEX index_requirements_project_id_user_id_id_and_target_type ON todos USING btree (project_id, user_id, id, target_type);

CREATE INDEX index_requirements_user_id_and_target_type ON todos USING btree (user_id, target_type);

CREATE INDEX index_resource_iteration_events_on_issue_id ON resource_iteration_events USING btree (issue_id);

CREATE INDEX index_resource_iteration_events_on_iteration_id ON resource_iteration_events USING btree (iteration_id);

CREATE INDEX index_resource_iteration_events_on_iteration_id_and_add_action ON resource_iteration_events USING btree (iteration_id) WHERE (action = 1);

CREATE INDEX index_resource_iteration_events_on_merge_request_id ON resource_iteration_events USING btree (merge_request_id);

CREATE INDEX index_resource_iteration_events_on_user_id ON resource_iteration_events USING btree (user_id);

CREATE INDEX index_resource_label_events_issue_id_label_id_action ON resource_label_events USING btree (issue_id, label_id, action);

CREATE INDEX index_resource_label_events_on_epic_id ON resource_label_events USING btree (epic_id);

CREATE INDEX index_resource_label_events_on_label_id_and_action ON resource_label_events USING btree (label_id, action);

CREATE INDEX index_resource_label_events_on_merge_request_id_label_id_action ON resource_label_events USING btree (merge_request_id, label_id, action);

CREATE INDEX index_resource_label_events_on_user_id ON resource_label_events USING btree (user_id);

CREATE INDEX index_resource_link_events_on_child_work_item_id ON resource_link_events USING btree (child_work_item_id);

CREATE INDEX index_resource_link_events_on_issue_id ON resource_link_events USING btree (issue_id);

CREATE INDEX index_resource_link_events_on_namespace_id ON resource_link_events USING btree (namespace_id);

CREATE INDEX index_resource_link_events_on_user_id ON resource_link_events USING btree (user_id);

CREATE INDEX index_resource_milestone_events_created_at ON resource_milestone_events USING btree (created_at);

CREATE INDEX index_resource_milestone_events_on_issue_id ON resource_milestone_events USING btree (issue_id);

CREATE INDEX index_resource_milestone_events_on_merge_request_id ON resource_milestone_events USING btree (merge_request_id);

CREATE INDEX index_resource_milestone_events_on_milestone_id ON resource_milestone_events USING btree (milestone_id);

CREATE INDEX index_resource_milestone_events_on_milestone_id_and_add_action ON resource_milestone_events USING btree (milestone_id) WHERE (action = 1);

CREATE INDEX index_resource_milestone_events_on_user_id ON resource_milestone_events USING btree (user_id);

CREATE INDEX index_resource_state_events_on_epic_id ON resource_state_events USING btree (epic_id);

CREATE INDEX index_resource_state_events_on_issue_id_and_created_at ON resource_state_events USING btree (issue_id, created_at);

CREATE INDEX index_resource_state_events_on_merge_request_id ON resource_state_events USING btree (merge_request_id);

CREATE INDEX index_resource_state_events_on_namespace_id ON resource_state_events USING btree (namespace_id);

CREATE INDEX index_resource_state_events_on_source_merge_request_id ON resource_state_events USING btree (source_merge_request_id);

CREATE INDEX index_resource_state_events_on_user_id ON resource_state_events USING btree (user_id);

CREATE INDEX index_resource_weight_events_on_issue_id_and_created_at ON resource_weight_events USING btree (issue_id, created_at);

CREATE INDEX index_resource_weight_events_on_issue_id_and_weight ON resource_weight_events USING btree (issue_id, weight);

CREATE INDEX index_resource_weight_events_on_namespace_id ON resource_weight_events USING btree (namespace_id);

CREATE INDEX index_resource_weight_events_on_user_id ON resource_weight_events USING btree (user_id);

CREATE INDEX index_reviews_on_author_id ON reviews USING btree (author_id);

CREATE INDEX index_reviews_on_merge_request_id ON reviews USING btree (merge_request_id);

CREATE INDEX index_reviews_on_project_id ON reviews USING btree (project_id);

CREATE INDEX index_route_on_name_trigram ON routes USING gin (name gin_trgm_ops);

CREATE UNIQUE INDEX index_routes_on_namespace_id ON routes USING btree (namespace_id);

CREATE UNIQUE INDEX index_routes_on_path ON routes USING btree (path);

CREATE INDEX index_routes_on_path_text_pattern_ops ON routes USING btree (path varchar_pattern_ops);

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 UNIQUE INDEX index_saml_group_links_on_group_id_saml_group_name_provider ON saml_group_links USING btree (group_id, saml_group_name, provider);

CREATE INDEX index_saml_group_links_on_member_role_id ON saml_group_links USING btree (member_role_id);

CREATE INDEX index_saml_group_links_on_scim_group_uid ON saml_group_links USING btree (scim_group_uid);

CREATE INDEX index_saml_providers_on_group_id ON saml_providers USING btree (group_id);

CREATE INDEX index_saml_providers_on_member_role_id ON saml_providers USING btree (member_role_id);

CREATE UNIQUE INDEX index_saved_replies_on_name_text_pattern_ops ON saved_replies USING btree (user_id, name text_pattern_ops);

CREATE UNIQUE INDEX index_sbom_component_versions_on_component_id_and_version ON sbom_component_versions USING btree (component_id, version);

CREATE INDEX index_sbom_component_versions_on_organization_id ON sbom_component_versions USING btree (organization_id);

CREATE INDEX index_sbom_components_on_organization_id ON sbom_components USING btree (organization_id);

CREATE INDEX index_sbom_graph_paths_on_ancestor_id ON sbom_graph_paths USING btree (ancestor_id);

CREATE INDEX index_sbom_graph_paths_on_descendant_id ON sbom_graph_paths USING btree (descendant_id);

CREATE INDEX index_sbom_graph_paths_on_project_id_and_descendant_id ON sbom_graph_paths USING btree (project_id, descendant_id);

CREATE INDEX index_sbom_graph_paths_on_project_id_and_id ON sbom_graph_paths USING btree (project_id, id);

CREATE INDEX index_sbom_occurr_on_project_id_and_component_version_id_and_id ON sbom_occurrences USING btree (project_id, component_version_id, id);

CREATE INDEX index_sbom_occurrences_on_component_id_and_id ON sbom_occurrences USING btree (component_id, id);

CREATE INDEX index_sbom_occurrences_on_component_version_id ON sbom_occurrences USING btree (component_version_id);

CREATE INDEX index_sbom_occurrences_on_highest_severity ON sbom_occurrences USING btree (project_id, highest_severity DESC NULLS LAST);

CREATE INDEX index_sbom_occurrences_on_licenses_spdx_identifier ON sbom_occurrences USING btree (project_id, ((licenses #> '{0,spdx_identifier}'::text[])), ((licenses #> '{1,spdx_identifier}'::text[])));

CREATE INDEX index_sbom_occurrences_on_pipeline_id ON sbom_occurrences USING btree (pipeline_id);

CREATE INDEX index_sbom_occurrences_on_project_id_and_component_id_and_id ON sbom_occurrences USING btree (project_id, component_id, id);

CREATE INDEX index_sbom_occurrences_on_project_id_and_id ON sbom_occurrences USING btree (project_id, id);

CREATE INDEX index_sbom_occurrences_on_project_id_and_package_manager ON sbom_occurrences USING btree (project_id, package_manager);

CREATE INDEX index_sbom_occurrences_on_source_id ON sbom_occurrences USING btree (source_id);

CREATE INDEX index_sbom_occurrences_on_traversal_ids_and_id ON sbom_occurrences USING btree (traversal_ids, id) WHERE (archived = false);

CREATE INDEX index_sbom_occurrences_on_traversal_ids_and_package_manager ON sbom_occurrences USING btree (traversal_ids, package_manager COLLATE "C");

CREATE UNIQUE INDEX index_sbom_occurrences_on_uuid ON sbom_occurrences USING btree (uuid);

CREATE INDEX index_sbom_occurrences_vulnerabilities_on_project_id ON sbom_occurrences_vulnerabilities USING btree (project_id);

CREATE INDEX index_sbom_occurrences_vulnerabilities_on_vulnerability_id ON sbom_occurrences_vulnerabilities USING btree (vulnerability_id);

CREATE UNIQUE INDEX index_sbom_source_packages_on_name_and_purl_type_and_org_id ON sbom_source_packages USING btree (name, purl_type, organization_id);

CREATE INDEX index_sbom_source_packages_on_organization_id ON sbom_source_packages USING btree (organization_id);

CREATE INDEX index_sbom_source_packages_on_source_package_id_and_id ON sbom_occurrences USING btree (source_package_id, id);

CREATE INDEX index_sbom_sources_on_organization_id ON sbom_sources USING btree (organization_id);

CREATE UNIQUE INDEX index_sbom_sources_on_source_type_and_source_and_org_id ON sbom_sources USING btree (source_type, source, organization_id);

CREATE INDEX index_scan_execution_policy_rules_on_policy_mgmt_project_id ON scan_execution_policy_rules USING btree (security_policy_management_project_id);

CREATE UNIQUE INDEX index_scan_execution_policy_rules_on_unique_policy_rule_index ON scan_execution_policy_rules USING btree (security_policy_id, rule_index);

CREATE INDEX index_scan_result_policies_on_approval_policy_rule_id ON scan_result_policies USING btree (approval_policy_rule_id);

CREATE UNIQUE INDEX index_scan_result_policies_on_configuration_action_and_rule_idx ON scan_result_policies USING btree (security_orchestration_policy_configuration_id, project_id, orchestration_policy_idx, rule_idx, action_idx);

CREATE INDEX index_scan_result_policies_on_namespace_id ON scan_result_policies USING btree (namespace_id);

CREATE INDEX index_scan_result_policies_on_project_id ON scan_result_policies USING btree (project_id);

CREATE INDEX index_scan_result_policy_violations_on_approval_policy_rule_id ON scan_result_policy_violations USING btree (approval_policy_rule_id);

CREATE INDEX index_scan_result_policy_violations_on_merge_request_id ON scan_result_policy_violations USING btree (merge_request_id);

CREATE UNIQUE INDEX index_scan_result_policy_violations_on_policy_and_merge_request ON scan_result_policy_violations USING btree (scan_result_policy_id, merge_request_id);

CREATE INDEX index_scim_group_memberships_on_scim_group_uid ON scim_group_memberships USING btree (scim_group_uid);

CREATE INDEX index_scim_identities_on_group_id ON scim_identities USING btree (group_id);

CREATE UNIQUE INDEX index_scim_identities_on_lower_extern_uid_and_group_id ON scim_identities USING btree (lower((extern_uid)::text), group_id);

CREATE UNIQUE INDEX index_scim_identities_on_user_id_and_group_id ON scim_identities USING btree (user_id, group_id);

CREATE UNIQUE INDEX index_scim_oauth_access_tokens_on_group_id_and_token_encrypted ON scim_oauth_access_tokens USING btree (group_id, token_encrypted);

CREATE UNIQUE INDEX index_security_categories_namespace_name ON security_categories USING btree (namespace_id, name);

CREATE INDEX index_security_orchestration_policy_rule_schedules_on_namespace ON security_orchestration_policy_rule_schedules USING btree (namespace_id);

CREATE INDEX index_security_orchestration_policy_rule_schedules_on_project_i ON security_orchestration_policy_rule_schedules USING btree (project_id);

CREATE INDEX index_security_policies_on_policy_management_project_id ON security_policies USING btree (security_policy_management_project_id);

CREATE UNIQUE INDEX index_security_policies_on_unique_config_type_policy_index ON security_policies USING btree (security_orchestration_policy_configuration_id, type, policy_index);

CREATE UNIQUE INDEX index_security_policy_project_links_on_project_and_policy ON security_policy_project_links USING btree (security_policy_id, project_id);

CREATE INDEX index_security_policy_requirements_on_compliance_requirement_id ON security_policy_requirements USING btree (compliance_requirement_id);

CREATE INDEX index_security_policy_requirements_on_namespace_id ON security_policy_requirements USING btree (namespace_id);

CREATE INDEX index_security_policy_settings_on_csp_namespace_id ON security_policy_settings USING btree (csp_namespace_id);

CREATE UNIQUE INDEX index_security_policy_settings_on_organization_id ON security_policy_settings USING btree (organization_id);

CREATE INDEX index_security_scans_for_non_purged_records ON security_scans USING btree (created_at, id) WHERE (status <> 6);

CREATE INDEX index_security_scans_on_created_at ON security_scans USING btree (created_at);

CREATE INDEX index_security_scans_on_date_created_at_and_id ON security_scans USING btree (date(timezone('UTC'::text, created_at)), id);

CREATE INDEX index_security_scans_on_length_of_errors ON security_scans USING btree (pipeline_id, jsonb_array_length(COALESCE((info -> 'errors'::text), '[]'::jsonb)));

CREATE INDEX index_security_scans_on_length_of_warnings ON security_scans USING btree (pipeline_id, jsonb_array_length(COALESCE((info -> 'warnings'::text), '[]'::jsonb)));

CREATE INDEX index_security_scans_on_pipeline_id_and_scan_type ON security_scans USING btree (pipeline_id, scan_type);

CREATE INDEX index_security_scans_on_project_id ON security_scans USING btree (project_id);

CREATE UNIQUE INDEX index_security_training_providers_on_unique_name ON security_training_providers USING btree (name);

CREATE INDEX index_security_trainings_on_project_id ON security_trainings USING btree (project_id);

CREATE INDEX index_security_trainings_on_provider_id ON security_trainings USING btree (provider_id);

CREATE UNIQUE INDEX index_security_trainings_on_unique_project_id ON security_trainings USING btree (project_id) WHERE (is_primary IS TRUE);

CREATE INDEX index_sent_notifications_on_issue_email_participant_id ON sent_notifications USING btree (issue_email_participant_id);

CREATE INDEX index_sent_notifications_on_noteable_type_noteable_id_and_id ON sent_notifications USING btree (noteable_id, id) WHERE ((noteable_type)::text = 'Issue'::text);

CREATE UNIQUE INDEX index_sent_notifications_on_reply_key ON sent_notifications USING btree (reply_key);

CREATE UNIQUE INDEX index_sentry_issues_on_issue_id ON sentry_issues USING btree (issue_id);

CREATE INDEX index_sentry_issues_on_namespace_id ON sentry_issues USING btree (namespace_id);

CREATE INDEX index_sentry_issues_on_sentry_issue_identifier ON sentry_issues USING btree (sentry_issue_identifier);

CREATE INDEX index_service_desk_custom_email_verifications_on_triggerer_id ON service_desk_custom_email_verifications USING btree (triggerer_id);

CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON projects USING btree (id, creator_id, created_at) WHERE (service_desk_enabled = true);

CREATE INDEX index_service_desk_settings_on_custom_email_enabled ON service_desk_settings USING btree (custom_email_enabled);

CREATE INDEX index_service_desk_settings_on_file_template_project_id ON service_desk_settings USING btree (file_template_project_id);

CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name);

CREATE UNIQUE INDEX index_site_profile_secret_variables_on_site_profile_id_and_key ON dast_site_profile_secret_variables USING btree (dast_site_profile_id, key);

CREATE UNIQUE INDEX index_slack_api_scopes_on_name ON slack_api_scopes USING btree (name);

CREATE UNIQUE INDEX index_slack_api_scopes_on_name_and_integration ON slack_integrations_scopes USING btree (slack_integration_id, slack_api_scope_id);

CREATE INDEX index_slack_integrations_on_integration_id ON slack_integrations USING btree (integration_id);

CREATE UNIQUE INDEX index_slack_integrations_on_team_id_and_alias ON slack_integrations USING btree (team_id, alias);

CREATE UNIQUE INDEX index_smartcard_identities_on_subject_and_issuer ON smartcard_identities USING btree (subject, issuer);

CREATE INDEX index_smartcard_identities_on_user_id ON smartcard_identities USING btree (user_id);

CREATE INDEX index_snippet_on_id_and_project_id ON snippets USING btree (id, project_id);

CREATE INDEX index_snippet_repositories_failed_verification ON snippet_repositories USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_snippet_repositories_needs_verification ON snippet_repositories USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE UNIQUE INDEX index_snippet_repositories_on_disk_path ON snippet_repositories USING btree (disk_path);

CREATE INDEX index_snippet_repositories_on_shard_id ON snippet_repositories USING btree (shard_id);

CREATE INDEX index_snippet_repositories_on_snippet_organization_id ON snippet_repositories USING btree (snippet_organization_id);

CREATE INDEX index_snippet_repositories_on_snippet_project_id ON snippet_repositories USING btree (snippet_project_id);

CREATE INDEX index_snippet_repositories_pending_verification ON snippet_repositories USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_snippet_repositories_verification_state ON snippet_repositories USING btree (verification_state);

CREATE INDEX index_snippet_repository_states_failed_verification ON snippet_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_snippet_repository_states_needs_verification ON snippet_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE UNIQUE INDEX index_snippet_repository_states_on_snippet_repository_id ON snippet_repository_states USING btree (snippet_repository_id);

CREATE INDEX index_snippet_repository_states_on_verification_state ON snippet_repository_states USING btree (verification_state);

CREATE INDEX index_snippet_repository_states_pending_verification ON snippet_repository_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_snippet_repository_storage_moves_on_snippet_id ON snippet_repository_storage_moves USING btree (snippet_id);

CREATE INDEX index_snippet_repository_storage_moves_on_snippet_organization_ ON snippet_repository_storage_moves USING btree (snippet_organization_id);

CREATE INDEX index_snippet_repository_storage_moves_on_snippet_project_id ON snippet_repository_storage_moves USING btree (snippet_project_id);

CREATE INDEX index_snippet_repository_storage_moves_on_state ON snippet_repository_storage_moves USING btree (state) WHERE (state = ANY (ARRAY[2, 3]));

CREATE INDEX index_snippet_statistics_on_snippet_organization_id ON snippet_statistics USING btree (snippet_organization_id);

CREATE INDEX index_snippet_statistics_on_snippet_project_id ON snippet_statistics USING btree (snippet_project_id);

CREATE UNIQUE INDEX index_snippet_user_mentions_on_note_id ON snippet_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);

CREATE INDEX index_snippet_user_mentions_on_snippet_organization_id ON snippet_user_mentions USING btree (snippet_organization_id);

CREATE INDEX index_snippet_user_mentions_on_snippet_project_id ON snippet_user_mentions USING btree (snippet_project_id);

CREATE INDEX index_snippets_on_author_id ON snippets USING btree (author_id);

CREATE INDEX index_snippets_on_content_trigram ON snippets USING gin (content gin_trgm_ops);

CREATE INDEX index_snippets_on_created_at ON snippets USING btree (created_at);

CREATE INDEX index_snippets_on_description_trigram ON snippets USING gin (description gin_trgm_ops);

CREATE INDEX index_snippets_on_file_name_trigram ON snippets USING gin (file_name gin_trgm_ops);

CREATE INDEX index_snippets_on_id_and_created_at ON snippets USING btree (id, created_at);

CREATE INDEX index_snippets_on_id_and_type ON snippets USING btree (id, type);

CREATE INDEX index_snippets_on_organization_id ON snippets USING btree (organization_id);

CREATE INDEX index_snippets_on_project_id_and_title ON snippets USING btree (project_id, title);

CREATE INDEX index_snippets_on_project_id_and_visibility_level ON snippets USING btree (project_id, visibility_level);

CREATE INDEX index_snippets_on_title_trigram ON snippets USING gin (title gin_trgm_ops);

CREATE INDEX index_snippets_on_updated_at ON snippets USING btree (updated_at);

CREATE INDEX index_snippets_on_visibility_level_and_secret ON snippets USING btree (visibility_level, secret);

CREATE INDEX index_software_license_policies_on_approval_policy_rule_id ON software_license_policies USING btree (approval_policy_rule_id);

CREATE INDEX index_software_license_policies_on_scan_result_policy_id ON software_license_policies USING btree (scan_result_policy_id);

CREATE INDEX index_software_license_policies_on_software_license_id ON software_license_policies USING btree (software_license_id);

CREATE INDEX index_software_licenses_on_spdx_identifier ON software_licenses USING btree (spdx_identifier);

CREATE UNIQUE INDEX index_software_licenses_on_unique_name ON software_licenses USING btree (name);

CREATE INDEX index_sop_configurations_project_id_policy_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id, project_id);

CREATE INDEX index_sop_schedules_on_sop_configuration_id ON security_orchestration_policy_rule_schedules USING btree (security_orchestration_policy_configuration_id);

CREATE INDEX index_sop_schedules_on_user_id ON security_orchestration_policy_rule_schedules USING btree (user_id);

CREATE UNIQUE INDEX index_source_id_microsoft_access_tokens ON system_access_group_microsoft_graph_access_tokens USING btree (temp_source_id);

CREATE INDEX index_spam_logs_on_user_id ON spam_logs USING btree (user_id);

CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id);

CREATE INDEX index_sprints_on_description_trigram ON sprints USING gin (description gin_trgm_ops);

CREATE INDEX index_sprints_on_due_date ON sprints USING btree (due_date);

CREATE INDEX index_sprints_on_group_id ON sprints USING btree (group_id);

CREATE INDEX index_sprints_on_title ON sprints USING btree (title);

CREATE INDEX index_sprints_on_title_trigram ON sprints USING gin (title gin_trgm_ops);

CREATE UNIQUE INDEX index_ssh_signatures_on_commit_sha ON ssh_signatures USING btree (commit_sha);

CREATE INDEX index_ssh_signatures_on_key_id ON ssh_signatures USING btree (key_id);

CREATE INDEX index_ssh_signatures_on_project_id ON ssh_signatures USING btree (project_id);

CREATE INDEX index_ssh_signatures_on_user_id ON ssh_signatures USING btree (user_id);

CREATE INDEX index_status_check_responses_on_external_approval_rule_id ON status_check_responses USING btree (external_approval_rule_id);

CREATE INDEX index_status_check_responses_on_external_status_check_id ON status_check_responses USING btree (external_status_check_id);

CREATE INDEX index_status_check_responses_on_merge_request_id ON status_check_responses USING btree (merge_request_id);

CREATE INDEX index_status_check_responses_on_project_id ON status_check_responses USING btree (project_id);

CREATE UNIQUE INDEX index_status_page_published_incidents_on_issue_id ON status_page_published_incidents USING btree (issue_id);

CREATE INDEX index_status_page_published_incidents_on_namespace_id ON status_page_published_incidents USING btree (namespace_id);

CREATE INDEX index_status_page_settings_on_project_id ON status_page_settings USING btree (project_id);

CREATE INDEX index_subscription_add_on_purchases_on_namespace_id_add_on_id ON subscription_add_on_purchases USING btree (namespace_id, subscription_add_on_id);

CREATE UNIQUE INDEX index_subscription_add_ons_on_name ON subscription_add_ons USING btree (name);

CREATE INDEX index_subscription_addon_purchases_on_expires_on ON subscription_add_on_purchases USING btree (expires_on);

CREATE INDEX index_subscription_seat_assignments_on_organization_id ON subscription_seat_assignments USING btree (organization_id);

CREATE INDEX index_subscription_seat_assignments_on_user_id ON subscription_seat_assignments USING btree (user_id);

CREATE INDEX index_subscription_user_add_on_assignments_on_organization_id ON subscription_user_add_on_assignments USING btree (organization_id);

CREATE INDEX index_subscription_user_add_on_assignments_on_user_id ON subscription_user_add_on_assignments USING btree (user_id);

CREATE INDEX index_subscriptions_on_project_id ON subscriptions USING btree (project_id);

CREATE UNIQUE INDEX index_subscriptions_on_subscribable_and_user_id_and_project_id ON subscriptions USING btree (subscribable_id, subscribable_type, user_id, project_id);

CREATE INDEX index_subscriptions_on_subscribable_type_subscribable_id_and_id ON subscriptions USING btree (subscribable_id, subscribable_type, id);

CREATE INDEX index_subscriptions_on_user ON subscriptions USING btree (user_id);

CREATE INDEX index_successful_authentication_events_for_metrics ON authentication_events USING btree (user_id, provider, created_at) WHERE (result = 1);

CREATE UNIQUE INDEX index_suggestions_on_note_id_and_relative_order ON suggestions USING btree (note_id, relative_order);

CREATE UNIQUE INDEX index_system_access_group_microsoft_applications_on_group_id ON system_access_group_microsoft_applications USING btree (group_id);

CREATE UNIQUE INDEX index_system_access_microsoft_applications_on_namespace_id ON system_access_microsoft_applications USING btree (namespace_id);

CREATE UNIQUE INDEX index_system_note_metadata_on_description_version_id ON system_note_metadata USING btree (description_version_id) WHERE (description_version_id IS NOT NULL);

CREATE UNIQUE INDEX index_system_note_metadata_on_note_id ON system_note_metadata USING btree (note_id);

CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name);

CREATE INDEX index_tags_on_name_trigram ON tags USING gin (name gin_trgm_ops);

CREATE INDEX index_target_branch_rules_on_project_id ON target_branch_rules USING btree (project_id);

CREATE INDEX index_targeted_message_dismissals_on_namespace_id ON targeted_message_dismissals USING btree (namespace_id);

CREATE INDEX index_targeted_message_dismissals_on_targeted_message_id ON targeted_message_dismissals USING btree (targeted_message_id);

CREATE UNIQUE INDEX index_targeted_message_dismissals_on_user_ns_targeted_message ON targeted_message_dismissals USING btree (user_id, namespace_id, targeted_message_id);

CREATE UNIQUE INDEX index_targeted_message_namespaces_on_message_and_namespace ON targeted_message_namespaces USING btree (targeted_message_id, namespace_id);

CREATE INDEX index_targeted_message_namespaces_on_namespace_id ON targeted_message_namespaces USING btree (namespace_id);

CREATE INDEX index_term_agreements_on_term_id ON term_agreements USING btree (term_id);

CREATE INDEX index_term_agreements_on_user_id ON term_agreements USING btree (user_id);

CREATE INDEX index_terraform_state_version_states_failed_verification ON terraform_state_version_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_terraform_state_version_states_needs_verification_tsv_id ON terraform_state_version_states USING btree (terraform_state_version_id) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_terraform_state_version_states_on_project_id ON terraform_state_version_states USING btree (project_id);

CREATE INDEX index_terraform_state_version_states_on_verification_started ON terraform_state_version_states USING btree (terraform_state_version_id, verification_started_at) WHERE (verification_state = 1);

CREATE INDEX index_terraform_state_version_states_on_verification_state ON terraform_state_version_states USING btree (verification_state);

CREATE INDEX index_terraform_state_version_states_pending_verification ON terraform_state_version_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE UNIQUE INDEX index_terraform_state_version_states_state_version_id ON terraform_state_version_states USING btree (terraform_state_version_id);

CREATE INDEX index_terraform_state_versions_failed_verification ON terraform_state_versions USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_terraform_state_versions_needs_verification ON terraform_state_versions USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_terraform_state_versions_on_ci_build_id ON terraform_state_versions USING btree (ci_build_id);

CREATE INDEX index_terraform_state_versions_on_created_by_user_id ON terraform_state_versions USING btree (created_by_user_id);

CREATE INDEX index_terraform_state_versions_on_project_id ON terraform_state_versions USING btree (project_id);

CREATE UNIQUE INDEX index_terraform_state_versions_on_state_id_and_version ON terraform_state_versions USING btree (terraform_state_id, version);

CREATE INDEX index_terraform_state_versions_on_verification_state ON terraform_state_versions USING btree (verification_state);

CREATE INDEX index_terraform_state_versions_pending_verification ON terraform_state_versions USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_terraform_states_on_file_store ON terraform_states USING btree (file_store);

CREATE INDEX index_terraform_states_on_locked_by_user_id ON terraform_states USING btree (locked_by_user_id);

CREATE UNIQUE INDEX index_terraform_states_on_project_id_and_name ON terraform_states USING btree (project_id, name);

CREATE UNIQUE INDEX index_terraform_states_on_uuid ON terraform_states USING btree (uuid);

CREATE UNIQUE INDEX index_timelog_categories_on_unique_name_per_namespace ON timelog_categories USING btree (namespace_id, lower(name));

CREATE INDEX index_timelogs_on_issue_id ON timelogs USING btree (issue_id);

CREATE INDEX index_timelogs_on_merge_request_id ON timelogs USING btree (merge_request_id);

CREATE INDEX index_timelogs_on_note_id ON timelogs USING btree (note_id);

CREATE INDEX index_timelogs_on_project_id_and_spent_at ON timelogs USING btree (project_id, spent_at);

CREATE INDEX index_timelogs_on_spent_at ON timelogs USING btree (spent_at) WHERE (spent_at IS NOT NULL);

CREATE INDEX index_timelogs_on_timelog_category_id ON timelogs USING btree (timelog_category_id);

CREATE INDEX index_timelogs_on_user_id ON timelogs USING btree (user_id);

CREATE INDEX index_todos_coalesced_snoozed_until_created_at ON todos USING btree (user_id, state, timestamp_coalesce(snoozed_until, created_at));

CREATE INDEX index_todos_on_author_id_and_created_at ON todos USING btree (author_id, created_at);

CREATE INDEX index_todos_on_commit_id ON todos USING btree (commit_id);

CREATE INDEX index_todos_on_group_id ON todos USING btree (group_id);

CREATE INDEX index_todos_on_note_id ON todos USING btree (note_id);

CREATE INDEX index_todos_on_project_id_and_id ON todos USING btree (project_id, id);

CREATE INDEX index_todos_on_target_type_and_target_id ON todos USING btree (target_type, target_id);

CREATE INDEX index_todos_on_user_id_and_id_done ON todos USING btree (user_id, id) WHERE ((state)::text = 'done'::text);

CREATE INDEX index_todos_on_user_id_and_id_pending ON todos USING btree (user_id, id) WHERE ((state)::text = 'pending'::text);

CREATE INDEX index_topics_non_private_projects_count ON topics USING btree (non_private_projects_count DESC, id);

CREATE INDEX index_topics_on_lower_name ON topics USING btree (lower(name));

CREATE INDEX index_topics_on_name ON topics USING btree (name);

CREATE INDEX index_topics_on_name_trigram ON topics USING gin (name gin_trgm_ops);

CREATE UNIQUE INDEX index_topics_on_organization_id_and_name ON topics USING btree (organization_id, name);

CREATE INDEX index_topics_on_organization_id_and_non_private_projects_count ON topics USING btree (organization_id, non_private_projects_count DESC);

CREATE UNIQUE INDEX index_topics_on_organization_id_slug_and ON topics USING btree (organization_id, slug) WHERE (slug IS NOT NULL);

CREATE INDEX index_topics_on_slug ON topics USING btree (slug) WHERE (slug IS NOT NULL);

CREATE INDEX index_topics_total_projects_count ON topics USING btree (total_projects_count DESC, id);

CREATE UNIQUE INDEX index_trending_projects_on_project_id ON trending_projects USING btree (project_id);

CREATE INDEX index_unarchived_occurrences_for_aggregations_component_name ON sbom_occurrences USING btree (traversal_ids, component_name, component_id, component_version_id) WHERE (archived = false);

CREATE INDEX index_unarchived_occurrences_for_aggregations_license ON sbom_occurrences USING btree (traversal_ids, (((licenses -> 0) ->> 'spdx_identifier'::text)), component_id, component_version_id) WHERE (archived = false);

CREATE INDEX index_unarchived_occurrences_for_aggregations_package_manager ON sbom_occurrences USING btree (traversal_ids, package_manager, component_id, component_version_id) WHERE (archived = false);

CREATE INDEX index_unarchived_occurrences_for_aggregations_severity ON sbom_occurrences USING btree (traversal_ids, highest_severity, component_id, component_version_id) WHERE (archived = false);

CREATE INDEX index_unarchived_occurrences_on_version_id_and_traversal_ids ON sbom_occurrences USING btree (component_version_id, traversal_ids) WHERE (archived = false);

CREATE INDEX index_unarchived_sbom_occurrences_for_aggregations ON sbom_occurrences USING btree (traversal_ids, component_id, component_version_id) WHERE (archived = false);

CREATE UNIQUE INDEX index_uniq_im_issuable_escalation_statuses_on_issue_id ON incident_management_issuable_escalation_statuses USING btree (issue_id);

CREATE UNIQUE INDEX index_uniq_projects_on_runners_token ON projects USING btree (runners_token);

CREATE UNIQUE INDEX index_uniq_projects_on_runners_token_encrypted ON projects USING btree (runners_token_encrypted);

CREATE UNIQUE INDEX index_unique_ci_runner_projects_on_runner_id_and_project_id ON ci_runner_projects USING btree (runner_id, project_id);

CREATE UNIQUE INDEX index_unique_epics_on_issue_id ON epics USING btree (issue_id);

CREATE UNIQUE INDEX index_unique_issuable_resource_links_on_issue_id_and_link ON issuable_resource_links USING btree (issue_id, link);

CREATE UNIQUE INDEX index_unique_issue_link_id_on_related_epic_links ON related_epic_links USING btree (issue_link_id);

CREATE UNIQUE INDEX index_unique_issue_metrics_issue_id ON issue_metrics USING btree (issue_id);

CREATE UNIQUE INDEX index_unique_parent_link_id_on_epic_issues ON epic_issues USING btree (work_item_parent_link_id);

CREATE UNIQUE INDEX index_unique_parent_link_id_on_epics ON epics USING btree (work_item_parent_link_id);

CREATE UNIQUE INDEX index_unique_project_authorizations_on_unique_project_user ON project_authorizations USING btree (project_id, user_id) WHERE is_unique;

CREATE INDEX index_unit_test_failures_failed_at ON ci_unit_test_failures USING btree (failed_at DESC);

CREATE UNIQUE INDEX index_unit_test_failures_unique_columns ON ci_unit_test_failures USING btree (unit_test_id, failed_at DESC, build_id);

CREATE UNIQUE INDEX index_unresolved_alerts_on_project_id_and_fingerprint ON alert_management_alerts USING btree (project_id, fingerprint) WHERE ((fingerprint IS NOT NULL) AND (status <> 2));

CREATE UNIQUE INDEX index_unresolved_compromised_password_detection_on_user_id ON compromised_password_detections USING btree (user_id) WHERE (resolved_at IS NULL);

CREATE UNIQUE INDEX index_upcoming_reconciliations_on_namespace_id ON upcoming_reconciliations USING btree (namespace_id);

CREATE INDEX index_upcoming_reconciliations_on_organization_id ON upcoming_reconciliations USING btree (organization_id);

CREATE INDEX index_upload_states_failed_verification ON upload_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_upload_states_needs_verification ON upload_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_upload_states_on_upload_id ON upload_states USING btree (upload_id);

CREATE INDEX index_upload_states_on_verification_state ON upload_states USING btree (verification_state);

CREATE INDEX index_upload_states_pending_verification ON upload_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_uploads_on_checksum ON uploads USING btree (checksum);

CREATE INDEX index_uploads_on_model_id_model_type_uploader_created_at ON uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX index_uploads_on_store ON uploads USING btree (store);

CREATE INDEX index_uploads_on_uploaded_by_user_id ON uploads USING btree (uploaded_by_user_id);

CREATE INDEX index_uploads_on_uploader_and_path ON uploads USING btree (uploader, path);

CREATE INDEX index_user_achievements_on_achievement_id_revoked_by_is_null ON user_achievements USING btree (achievement_id, ((revoked_by_user_id IS NULL)));

CREATE INDEX index_user_achievements_on_awarded_by_revoked_by_is_null ON user_achievements USING btree (awarded_by_user_id, ((revoked_by_user_id IS NULL)));

CREATE INDEX index_user_achievements_on_namespace_id ON user_achievements USING btree (namespace_id);

CREATE INDEX index_user_achievements_on_revoked_by_user_id ON user_achievements USING btree (revoked_by_user_id);

CREATE INDEX index_user_achievements_on_user_id_revoked_by_is_null ON user_achievements USING btree (user_id, ((revoked_by_user_id IS NULL)));

CREATE INDEX index_user_admin_roles_on_admin_role_id ON user_admin_roles USING btree (admin_role_id);

CREATE INDEX index_user_agent_details_on_subject_id_and_subject_type ON user_agent_details USING btree (subject_id, subject_type);

CREATE INDEX index_user_broadcast_message_dismissals_on_broadcast_message_id ON user_broadcast_message_dismissals USING btree (broadcast_message_id);

CREATE UNIQUE INDEX index_user_callouts_on_user_id_and_feature_name ON user_callouts USING btree (user_id, feature_name);

CREATE INDEX index_user_credit_card_validations_on_stripe_card_fingerprint ON user_credit_card_validations USING btree (stripe_card_fingerprint);

CREATE INDEX index_user_custom_attributes_on_key_and_value ON user_custom_attributes USING btree (key, value);

CREATE UNIQUE INDEX index_user_custom_attributes_on_user_id_and_key ON user_custom_attributes USING btree (user_id, key);

CREATE INDEX index_user_details_on_bot_namespace_id ON user_details USING btree (bot_namespace_id);

CREATE INDEX index_user_details_on_enterprise_group_id_and_user_id ON user_details USING btree (enterprise_group_id, user_id);

CREATE INDEX index_user_details_on_password_last_changed_at ON user_details USING btree (password_last_changed_at);

COMMENT ON INDEX index_user_details_on_password_last_changed_at IS 'JiHu-specific index';

CREATE UNIQUE INDEX index_user_details_on_phone ON user_details USING btree (phone) WHERE (phone IS NOT NULL);

COMMENT ON INDEX index_user_details_on_phone IS 'JiHu-specific index';

CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (user_id);

CREATE INDEX index_user_group_callouts_on_group_id ON user_group_callouts USING btree (group_id);

CREATE INDEX index_user_group_member_roles_on_group_id ON user_group_member_roles USING btree (group_id);

CREATE INDEX index_user_group_member_roles_on_member_role_id ON user_group_member_roles USING btree (member_role_id);

CREATE INDEX index_user_group_member_roles_on_shared_with_group_id ON user_group_member_roles USING btree (shared_with_group_id);

CREATE INDEX index_user_group_member_roles_on_user_id ON user_group_member_roles USING btree (user_id);

CREATE INDEX index_user_highest_roles_on_user_id_and_highest_access_level ON user_highest_roles USING btree (user_id, highest_access_level);

CREATE INDEX index_user_id_and_notification_email_to_notification_settings ON notification_settings USING btree (user_id, notification_email, id) WHERE (notification_email IS NOT NULL);

CREATE INDEX index_user_namespace_callouts_on_namespace_id ON user_namespace_callouts USING btree (namespace_id);

CREATE INDEX index_user_permission_export_uploads_on_user_id_and_status ON user_permission_export_uploads USING btree (user_id, status);

CREATE INDEX index_user_phone_number_validations_on_telesign_reference_xid ON user_phone_number_validations USING btree (telesign_reference_xid);

CREATE INDEX index_user_phone_validations_on_dial_code_phone_number ON user_phone_number_validations USING btree (international_dial_code, phone_number);

CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled);

CREATE INDEX index_user_preferences_on_home_organization_id ON user_preferences USING btree (home_organization_id);

CREATE UNIQUE INDEX index_user_preferences_on_user_id ON user_preferences USING btree (user_id);

CREATE INDEX index_user_project_callouts_on_project_id ON user_project_callouts USING btree (project_id);

CREATE INDEX index_user_statuses_on_clear_status_at_not_null ON user_statuses USING btree (clear_status_at) WHERE (clear_status_at IS NOT NULL);

CREATE INDEX index_user_statuses_on_user_id ON user_statuses USING btree (user_id);

CREATE UNIQUE INDEX index_user_synced_attributes_metadata_on_user_id ON user_synced_attributes_metadata USING btree (user_id);

CREATE INDEX index_users_for_active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND (user_type = ANY (ARRAY[0, 6, 4, 13])) AND (user_type = ANY (ARRAY[0, 4, 5])));

CREATE INDEX index_users_for_auditors ON users USING btree (id) WHERE (auditor IS TRUE);

CREATE INDEX index_users_on_admin ON users USING btree (admin);

CREATE UNIQUE INDEX index_users_on_confirmation_token ON users USING btree (confirmation_token);

CREATE INDEX index_users_on_created_at ON users USING btree (created_at);

CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email);

CREATE INDEX index_users_on_email_domain_and_id ON users USING btree (lower(split_part((email)::text, '@'::text, 2)), id);

CREATE INDEX index_users_on_email_trigram ON users USING gin (email gin_trgm_ops);

CREATE INDEX index_users_on_feed_token ON users USING btree (feed_token);

CREATE INDEX index_users_on_group_view ON users USING btree (group_view);

CREATE INDEX index_users_on_id_and_last_activity_on_for_active_human_service ON users USING btree (id, last_activity_on) WHERE (((state)::text = 'active'::text) AND (user_type = ANY (ARRAY[0, 4])));

CREATE INDEX index_users_on_incoming_email_token ON users USING btree (incoming_email_token);

CREATE INDEX index_users_on_managing_group_id ON users USING btree (managing_group_id);

CREATE INDEX index_users_on_name ON users USING btree (name);

CREATE INDEX index_users_on_name_trigram ON users USING gin (name gin_trgm_ops);

CREATE INDEX index_users_on_organization_id ON users USING btree (organization_id);

CREATE INDEX index_users_on_public_email_excluding_null_and_empty ON users USING btree (public_email) WHERE (((public_email)::text <> ''::text) AND (public_email IS NOT NULL));

CREATE INDEX index_users_on_public_email_trigram ON users USING gin (public_email gin_trgm_ops);

CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);

CREATE INDEX index_users_on_state_and_user_type ON users USING btree (state, user_type);

CREATE UNIQUE INDEX index_users_on_static_object_token ON users USING btree (static_object_token);

CREATE INDEX index_users_on_unconfirmed_created_at_active_type_sign_in_count ON users USING btree (created_at, id) WHERE ((confirmed_at IS NULL) AND ((state)::text = 'active'::text) AND (user_type = 0) AND (sign_in_count = 0));

CREATE INDEX index_users_on_unconfirmed_email ON users USING btree (unconfirmed_email) WHERE (unconfirmed_email IS NOT NULL);

CREATE UNIQUE INDEX index_users_on_unlock_token ON users USING btree (unlock_token);

CREATE INDEX index_users_on_updated_at ON users USING btree (updated_at);

CREATE INDEX index_users_on_user_type_and_id ON users USING btree (user_type, id);

CREATE INDEX index_users_on_username ON users USING btree (username);

CREATE INDEX index_users_on_username_trigram ON users USING gin (username gin_trgm_ops);

CREATE INDEX index_users_ops_dashboard_projects_on_project_id ON users_ops_dashboard_projects USING btree (project_id);

CREATE UNIQUE INDEX index_users_ops_dashboard_projects_on_user_id_and_project_id ON users_ops_dashboard_projects USING btree (user_id, project_id);

CREATE INDEX index_users_security_dashboard_projects_on_user_id ON users_security_dashboard_projects USING btree (user_id);

CREATE INDEX index_users_star_projects_on_project_id ON users_star_projects USING btree (project_id);

CREATE UNIQUE INDEX index_users_star_projects_on_user_id_and_project_id ON users_star_projects USING btree (user_id, project_id);

CREATE UNIQUE INDEX index_verification_codes_on_phone_and_visitor_id_code ON ONLY verification_codes USING btree (visitor_id_code, phone, created_at);

COMMENT ON INDEX index_verification_codes_on_phone_and_visitor_id_code IS 'JiHu-specific index';

CREATE INDEX index_virtual_reg_pkgs_maven_reg_upstreams_on_group_id ON virtual_registries_packages_maven_registry_upstreams USING btree (group_id);

CREATE INDEX index_virtual_reg_pkgs_maven_upstreams_on_group_id ON virtual_registries_packages_maven_upstreams USING btree (group_id);

CREATE UNIQUE INDEX index_vuln_findings_on_uuid_including_vuln_id_1 ON vulnerability_occurrences USING btree (uuid) INCLUDE (vulnerability_id);

CREATE UNIQUE INDEX index_vuln_historical_statistics_on_project_id_and_date ON vulnerability_historical_statistics USING btree (project_id, date);

CREATE INDEX index_vuln_mgmt_policy_rules_on_policy_mgmt_project_id ON vulnerability_management_policy_rules USING btree (security_policy_management_project_id);

CREATE UNIQUE INDEX index_vuln_mgmt_policy_rules_on_unique_policy_rule_index ON vulnerability_management_policy_rules USING btree (security_policy_id, rule_index);

CREATE INDEX index_vuln_namespace_hist_statistics_for_traversal_ids_update ON vulnerability_namespace_historical_statistics USING btree (namespace_id, id);

CREATE UNIQUE INDEX index_vuln_namespace_historical_statistics_traversal_ids_date ON vulnerability_namespace_historical_statistics USING btree (traversal_ids, date);

CREATE UNIQUE INDEX index_vuln_namespace_statistics_btree_traversal_ids ON vulnerability_namespace_statistics USING btree (traversal_ids);

CREATE INDEX index_vuln_namespace_statistics_gin_traversal_ids ON vulnerability_namespace_statistics USING gin (traversal_ids);

CREATE UNIQUE INDEX index_vuln_namespace_statistics_on_namespace_id ON vulnerability_namespace_statistics USING btree (namespace_id);

CREATE INDEX index_vuln_reads_common_query_on_resolved_on_default_branch ON vulnerability_reads USING btree (project_id, state, report_type, vulnerability_id DESC) WHERE (resolved_on_default_branch IS TRUE);

CREATE INDEX index_vuln_reads_on_casted_cluster_agent_id_where_it_is_null ON vulnerability_reads USING btree (casted_cluster_agent_id) WHERE (casted_cluster_agent_id IS NOT NULL);

CREATE INDEX index_vuln_reads_on_project_id_owasp_top_10 ON vulnerability_reads USING btree (project_id, owasp_top_10);

CREATE INDEX index_vuln_reads_on_project_id_state_severity_and_vuln_id ON vulnerability_reads USING btree (project_id, state, severity, vulnerability_id DESC);

CREATE INDEX index_vuln_rep_info_on_project_id ON vulnerability_representation_information USING btree (project_id);

CREATE INDEX index_vulnerabilities_common_finder_query_on_default_branch ON vulnerabilities USING btree (project_id, state, report_type, present_on_default_branch, severity, id);

CREATE INDEX index_vulnerabilities_on_author_id ON vulnerabilities USING btree (author_id);

CREATE INDEX index_vulnerabilities_on_confirmed_by_id ON vulnerabilities USING btree (confirmed_by_id);

CREATE INDEX index_vulnerabilities_on_dismissed_by_id ON vulnerabilities USING btree (dismissed_by_id);

CREATE INDEX index_vulnerabilities_on_finding_id ON vulnerabilities USING btree (finding_id);

CREATE INDEX index_vulnerabilities_on_project_id_and_id ON vulnerabilities USING btree (project_id, id);

CREATE INDEX index_vulnerabilities_on_resolved_by_id ON vulnerabilities USING btree (resolved_by_id);

CREATE INDEX index_vulnerabilities_project_id_and_id_on_default_branch ON vulnerabilities USING btree (project_id, id) WHERE (present_on_default_branch IS TRUE);

CREATE INDEX index_vulnerabilities_project_id_state_severity_default_branch ON vulnerabilities USING btree (project_id, state, severity, present_on_default_branch);

CREATE INDEX index_vulnerability_archive_exports_on_author_id ON ONLY vulnerability_archive_exports USING btree (author_id);

CREATE INDEX index_vulnerability_archive_exports_on_project_id ON ONLY vulnerability_archive_exports USING btree (project_id);

CREATE INDEX index_vulnerability_archive_exports_on_status ON ONLY vulnerability_archive_exports USING btree (status);

CREATE INDEX index_vulnerability_archived_records_on_archive_id_and_date ON ONLY vulnerability_archived_records USING btree (archive_id, date);

CREATE INDEX index_vulnerability_archived_records_on_archive_id_and_id ON ONLY vulnerability_archived_records USING btree (archive_id, id);

CREATE INDEX index_vulnerability_archived_records_on_project_id ON ONLY vulnerability_archived_records USING btree (project_id);

CREATE UNIQUE INDEX index_vulnerability_archived_records_on_unique_attributes ON ONLY vulnerability_archived_records USING btree (vulnerability_identifier, date);

CREATE UNIQUE INDEX index_vulnerability_archives_on_project_id_and_date ON ONLY vulnerability_archives USING btree (project_id, date);

CREATE INDEX index_vulnerability_export_parts_on_organization_id ON vulnerability_export_parts USING btree (organization_id);

CREATE INDEX index_vulnerability_export_parts_on_vulnerability_export_id ON vulnerability_export_parts USING btree (vulnerability_export_id);

CREATE INDEX index_vulnerability_exports_on_author_id ON vulnerability_exports USING btree (author_id);

CREATE INDEX index_vulnerability_exports_on_file_store ON vulnerability_exports USING btree (file_store);

CREATE INDEX index_vulnerability_exports_on_group_id_not_null ON vulnerability_exports USING btree (group_id) WHERE (group_id IS NOT NULL);

CREATE INDEX index_vulnerability_exports_on_organization_id ON vulnerability_exports USING btree (organization_id);

CREATE INDEX index_vulnerability_exports_on_project_id_not_null ON vulnerability_exports USING btree (project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX index_vulnerability_external_issue_links_on_author_id ON vulnerability_external_issue_links USING btree (author_id);

CREATE INDEX index_vulnerability_external_issue_links_on_project_id ON vulnerability_external_issue_links USING btree (project_id);

CREATE INDEX index_vulnerability_feedback_finding_uuid ON vulnerability_feedback USING hash (finding_uuid);

CREATE INDEX index_vulnerability_feedback_on_author_id ON vulnerability_feedback USING btree (author_id);

CREATE INDEX index_vulnerability_feedback_on_comment_author_id ON vulnerability_feedback USING btree (comment_author_id);

CREATE INDEX index_vulnerability_feedback_on_feedback_type_and_finding_uuid ON vulnerability_feedback USING btree (feedback_type, finding_uuid);

CREATE INDEX index_vulnerability_feedback_on_issue_id ON vulnerability_feedback USING btree (issue_id);

CREATE INDEX index_vulnerability_feedback_on_issue_id_not_null ON vulnerability_feedback USING btree (id) WHERE (issue_id IS NOT NULL);

CREATE INDEX index_vulnerability_feedback_on_merge_request_id ON vulnerability_feedback USING btree (merge_request_id);

CREATE INDEX index_vulnerability_feedback_on_pipeline_id ON vulnerability_feedback USING btree (pipeline_id);

CREATE INDEX index_vulnerability_feedback_on_set_of_common_attributes ON vulnerability_feedback USING btree (project_id, category, feedback_type);

CREATE INDEX index_vulnerability_finding_evidences_on_project_id ON vulnerability_finding_evidences USING btree (project_id);

CREATE INDEX index_vulnerability_finding_signatures_on_project_id ON vulnerability_finding_signatures USING btree (project_id);

CREATE INDEX index_vulnerability_finding_signatures_on_signature_sha ON vulnerability_finding_signatures USING btree (signature_sha);

CREATE INDEX index_vulnerability_findings_remediations_on_project_id ON vulnerability_findings_remediations USING btree (project_id);

CREATE INDEX index_vulnerability_findings_remediations_on_remediation_id ON vulnerability_findings_remediations USING btree (vulnerability_remediation_id);

CREATE UNIQUE INDEX index_vulnerability_findings_remediations_on_unique_keys ON vulnerability_findings_remediations USING btree (vulnerability_occurrence_id, vulnerability_remediation_id);

CREATE INDEX index_vulnerability_flags_on_project_id ON vulnerability_flags USING btree (project_id);

CREATE UNIQUE INDEX index_vulnerability_flags_on_unique_columns ON vulnerability_flags USING btree (vulnerability_occurrence_id, flag_type, origin);

CREATE INDEX index_vulnerability_historical_statistics_on_date_and_id ON vulnerability_historical_statistics USING btree (date, id);

CREATE UNIQUE INDEX index_vulnerability_identifiers_on_project_id_and_fingerprint ON vulnerability_identifiers USING btree (project_id, fingerprint);

CREATE INDEX index_vulnerability_identifiers_on_project_id_and_name ON vulnerability_identifiers USING btree (project_id, name);

CREATE INDEX index_vulnerability_issue_links_on_issue_id ON vulnerability_issue_links USING btree (issue_id);

CREATE INDEX index_vulnerability_issue_links_on_project_id ON vulnerability_issue_links USING btree (project_id);

CREATE INDEX index_vulnerability_merge_request_links_on_merge_request_id ON vulnerability_merge_request_links USING btree (merge_request_id);

CREATE INDEX index_vulnerability_merge_request_links_on_project_id ON vulnerability_merge_request_links USING btree (project_id);

CREATE INDEX index_vulnerability_occurrence_identifiers_on_identifier_id ON vulnerability_occurrence_identifiers USING btree (identifier_id);

CREATE INDEX index_vulnerability_occurrence_identifiers_on_project_id ON vulnerability_occurrence_identifiers USING btree (project_id);

CREATE UNIQUE INDEX index_vulnerability_occurrence_identifiers_on_unique_keys ON vulnerability_occurrence_identifiers USING btree (occurrence_id, identifier_id);

CREATE INDEX index_vulnerability_occurrences_for_override_uuids_logic ON vulnerability_occurrences USING btree (project_id, report_type, location_fingerprint);

CREATE INDEX index_vulnerability_occurrences_on_initial_pipeline_id ON vulnerability_occurrences USING btree (initial_pipeline_id);

CREATE INDEX index_vulnerability_occurrences_on_latest_pipeline_id ON vulnerability_occurrences USING btree (latest_pipeline_id);

CREATE INDEX index_vulnerability_occurrences_on_location_image ON vulnerability_occurrences USING gin (((location -> 'image'::text))) WHERE (report_type = ANY (ARRAY[2, 7]));

CREATE INDEX index_vulnerability_occurrences_on_location_k8s_agent_id ON vulnerability_occurrences USING gin ((((location -> 'kubernetes_resource'::text) -> 'agent_id'::text))) WHERE (report_type = 7);

CREATE INDEX index_vulnerability_occurrences_on_location_k8s_cluster_id ON vulnerability_occurrences USING gin ((((location -> 'kubernetes_resource'::text) -> 'cluster_id'::text))) WHERE (report_type = 7);

CREATE INDEX index_vulnerability_occurrences_on_scanner_id ON vulnerability_occurrences USING btree (scanner_id);

CREATE INDEX index_vulnerability_occurrences_on_vulnerability_id ON vulnerability_occurrences USING btree (vulnerability_id);

CREATE INDEX index_vulnerability_occurrences_prim_iden_id_and_vuln_id ON vulnerability_occurrences USING btree (primary_identifier_id, vulnerability_id);

CREATE INDEX index_vulnerability_partial_scans_on_project_id ON vulnerability_partial_scans USING btree (project_id);

CREATE INDEX index_vulnerability_partial_scans_on_scan_id ON vulnerability_partial_scans USING btree (scan_id);

CREATE INDEX index_vulnerability_reads_common_attrs_for_groups ON vulnerability_reads USING btree (resolved_on_default_branch, state, report_type, severity, traversal_ids, vulnerability_id, has_vulnerability_resolution) WHERE (archived = false);

CREATE INDEX index_vulnerability_reads_common_finder_query ON vulnerability_reads USING btree (project_id, state, report_type, severity, vulnerability_id DESC, dismissal_reason, has_vulnerability_resolution);

CREATE INDEX index_vulnerability_reads_for_filtered_removal ON vulnerability_reads USING btree (project_id, resolved_on_default_branch);

CREATE INDEX index_vulnerability_reads_for_vulnerability_export ON vulnerability_reads USING btree (traversal_ids, vulnerability_id) WHERE (archived = false);

CREATE INDEX index_vulnerability_reads_on_cluster_agent_id ON vulnerability_reads USING btree (cluster_agent_id) WHERE (report_type = 7);

CREATE INDEX index_vulnerability_reads_on_location_image ON vulnerability_reads USING btree (location_image) WHERE (report_type = ANY (ARRAY[2, 7]));

CREATE INDEX index_vulnerability_reads_on_location_image_partial ON vulnerability_reads USING btree (project_id, location_image) WHERE ((report_type = ANY (ARRAY[2, 7])) AND (location_image IS NOT NULL));

CREATE INDEX index_vulnerability_reads_on_location_image_trigram ON vulnerability_reads USING gin (location_image gin_trgm_ops) WHERE ((report_type = ANY (ARRAY[2, 7])) AND (location_image IS NOT NULL));

CREATE INDEX index_vulnerability_reads_on_project_id_and_vulnerability_id ON vulnerability_reads USING btree (project_id, vulnerability_id);

CREATE INDEX index_vulnerability_reads_on_scanner_id ON vulnerability_reads USING btree (scanner_id);

CREATE UNIQUE INDEX index_vulnerability_reads_on_uuid ON vulnerability_reads USING btree (uuid);

CREATE INDEX index_vulnerability_reads_on_uuid_project_id_and_state ON vulnerability_reads USING btree (uuid, project_id, state);

CREATE UNIQUE INDEX index_vulnerability_reads_on_vulnerability_id ON vulnerability_reads USING btree (vulnerability_id);

CREATE UNIQUE INDEX index_vulnerability_remediations_on_project_id_and_checksum ON vulnerability_remediations USING btree (project_id, checksum);

CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON vulnerability_scanners USING btree (project_id, external_id);

CREATE INDEX index_vulnerability_severity_overrides_on_author_id ON vulnerability_severity_overrides USING btree (author_id);

CREATE INDEX index_vulnerability_severity_overrides_on_project_id ON vulnerability_severity_overrides USING btree (project_id);

CREATE INDEX index_vulnerability_severity_overrides_on_vulnerability_id ON vulnerability_severity_overrides USING btree (vulnerability_id);

CREATE INDEX index_vulnerability_state_transitions_id_and_vulnerability_id ON vulnerability_state_transitions USING btree (vulnerability_id, id);

CREATE INDEX index_vulnerability_state_transitions_on_author_id ON vulnerability_state_transitions USING btree (author_id);

CREATE INDEX index_vulnerability_state_transitions_on_project_id ON vulnerability_state_transitions USING btree (project_id);

CREATE INDEX index_vulnerability_state_transitions_resolved_activity ON vulnerability_state_transitions USING btree (created_at, vulnerability_id) WHERE (to_state = 3);

CREATE INDEX index_vulnerability_statistics_on_latest_pipeline_id ON vulnerability_statistics USING btree (latest_pipeline_id);

CREATE INDEX index_vulnerability_statistics_on_letter_grade ON vulnerability_statistics USING btree (letter_grade);

CREATE UNIQUE INDEX index_vulnerability_statistics_on_unique_project_id ON vulnerability_statistics USING btree (project_id);

CREATE UNIQUE INDEX index_vulnerability_user_mentions_on_note_id ON vulnerability_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);

CREATE INDEX index_vulnerability_user_mentions_on_project_id ON vulnerability_user_mentions USING btree (project_id);

CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id ON vulnerability_user_mentions USING btree (vulnerability_id) WHERE (note_id IS NULL);

CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id_and_note_id ON vulnerability_user_mentions USING btree (vulnerability_id, note_id);

CREATE INDEX index_web_hook_logs_daily_on_web_hook_id_and_created_at ON ONLY web_hook_logs_daily USING btree (web_hook_id, created_at);

CREATE INDEX index_web_hook_logs_daily_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs_daily USING btree (created_at, web_hook_id);

CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHERE ((type)::text = 'GroupHook'::text);

CREATE INDEX index_web_hooks_on_integration_id ON web_hooks USING btree (integration_id);

CREATE INDEX index_web_hooks_on_project_id_and_id ON web_hooks USING btree (project_id, id) WHERE ((type)::text = 'ProjectHook'::text);

CREATE INDEX index_web_hooks_on_project_id_recent_failures ON web_hooks USING btree (project_id, recent_failures);

CREATE INDEX index_web_hooks_on_type ON web_hooks USING btree (type);

CREATE UNIQUE INDEX index_webauthn_registrations_on_credential_xid ON webauthn_registrations USING btree (credential_xid);

CREATE INDEX index_webauthn_registrations_on_user_id ON webauthn_registrations USING btree (user_id);

CREATE UNIQUE INDEX index_wiki_meta_user_mentions_on_wiki_page_meta_id_and_note_id ON wiki_page_meta_user_mentions USING btree (wiki_page_meta_id, note_id);

CREATE INDEX index_wiki_page_meta_on_namespace_id ON wiki_page_meta USING btree (namespace_id);

CREATE INDEX index_wiki_page_meta_on_project_id ON wiki_page_meta USING btree (project_id);

CREATE INDEX index_wiki_page_meta_user_mentions_on_namespace_id ON wiki_page_meta_user_mentions USING btree (namespace_id);

CREATE INDEX index_wiki_page_meta_user_mentions_on_note_id ON wiki_page_meta_user_mentions USING btree (note_id);

CREATE INDEX index_wiki_page_slugs_on_namespace_id ON wiki_page_slugs USING btree (namespace_id);

CREATE INDEX index_wiki_page_slugs_on_project_id ON wiki_page_slugs USING btree (project_id);

CREATE UNIQUE INDEX index_wiki_page_slugs_on_slug_and_wiki_page_meta_id ON wiki_page_slugs USING btree (slug, wiki_page_meta_id);

CREATE INDEX index_wiki_page_slugs_on_wiki_page_meta_id ON wiki_page_slugs USING btree (wiki_page_meta_id);

CREATE INDEX index_wiki_repository_states_failed_verification ON wiki_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX index_wiki_repository_states_needs_verification ON wiki_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX index_wiki_repository_states_on_project_id ON wiki_repository_states USING btree (project_id);

CREATE UNIQUE INDEX index_wiki_repository_states_on_project_wiki_repository_id ON wiki_repository_states USING btree (project_wiki_repository_id);

CREATE INDEX index_wiki_repository_states_on_verification_state ON wiki_repository_states USING btree (verification_state);

CREATE INDEX index_wiki_repository_states_pending_verification ON wiki_repository_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX index_work_item_current_statuses_on_custom_status_id ON work_item_current_statuses USING btree (custom_status_id);

CREATE INDEX index_work_item_current_statuses_on_namespace_id ON work_item_current_statuses USING btree (namespace_id);

CREATE UNIQUE INDEX index_work_item_current_statuses_on_work_item_id ON work_item_current_statuses USING btree (work_item_id);

CREATE INDEX index_work_item_custom_lifecycles_on_created_by_id ON work_item_custom_lifecycles USING btree (created_by_id);

CREATE UNIQUE INDEX index_work_item_custom_lifecycles_on_namespace_id_and_name ON work_item_custom_lifecycles USING btree (namespace_id, name);

CREATE INDEX index_work_item_custom_lifecycles_on_updated_by_id ON work_item_custom_lifecycles USING btree (updated_by_id);

CREATE INDEX index_work_item_custom_statuses_on_created_by_id ON work_item_custom_statuses USING btree (created_by_id);

CREATE UNIQUE INDEX index_work_item_custom_statuses_on_namespace_id_and_lower_name ON work_item_custom_statuses USING btree (namespace_id, TRIM(BOTH FROM lower(name)));

CREATE INDEX index_work_item_custom_statuses_on_updated_by_id ON work_item_custom_statuses USING btree (updated_by_id);

CREATE INDEX index_work_item_hierarchy_restrictions_on_child_type_id ON work_item_hierarchy_restrictions USING btree (child_type_id);

CREATE UNIQUE INDEX index_work_item_hierarchy_restrictions_on_parent_and_child ON work_item_hierarchy_restrictions USING btree (parent_type_id, child_type_id);

CREATE INDEX index_work_item_hierarchy_restrictions_on_parent_type_id ON work_item_hierarchy_restrictions USING btree (parent_type_id);

CREATE UNIQUE INDEX index_work_item_link_restrictions_on_source_link_type_target ON work_item_related_link_restrictions USING btree (source_type_id, link_type, target_type_id);

CREATE INDEX index_work_item_number_field_values_on_custom_field_id ON work_item_number_field_values USING btree (custom_field_id);

CREATE INDEX index_work_item_number_field_values_on_namespace_id ON work_item_number_field_values USING btree (namespace_id);

CREATE INDEX index_work_item_parent_links_on_namespace_id ON work_item_parent_links USING btree (namespace_id);

CREATE UNIQUE INDEX index_work_item_parent_links_on_work_item_id ON work_item_parent_links USING btree (work_item_id);

CREATE INDEX index_work_item_parent_links_on_work_item_parent_id ON work_item_parent_links USING btree (work_item_parent_id);

CREATE INDEX index_work_item_progresses_on_namespace_id ON work_item_progresses USING btree (namespace_id);

CREATE INDEX index_work_item_related_link_restrictions_on_target_type_id ON work_item_related_link_restrictions USING btree (target_type_id);

CREATE INDEX index_work_item_select_field_values_on_custom_field_id ON work_item_select_field_values USING btree (custom_field_id);

CREATE INDEX index_work_item_select_field_values_on_namespace_id ON work_item_select_field_values USING btree (namespace_id);

CREATE INDEX index_work_item_text_field_values_on_custom_field_id ON work_item_text_field_values USING btree (custom_field_id);

CREATE INDEX index_work_item_text_field_values_on_namespace_id ON work_item_text_field_values USING btree (namespace_id);

CREATE INDEX index_work_item_type_custom_fields_on_custom_field_id ON work_item_type_custom_fields USING btree (custom_field_id);

CREATE INDEX index_work_item_type_custom_fields_on_work_item_type_id ON work_item_type_custom_fields USING btree (work_item_type_id);

CREATE INDEX index_work_item_type_user_preferences_on_namespace_id ON work_item_type_user_preferences USING btree (namespace_id);

CREATE INDEX index_work_item_type_user_preferences_on_work_item_type_id ON work_item_type_user_preferences USING btree (work_item_type_id);

CREATE INDEX index_work_item_types_on_base_type_and_id ON work_item_types USING btree (base_type, id);

CREATE UNIQUE INDEX index_work_item_types_on_name_unique ON work_item_types USING btree (TRIM(BOTH FROM lower(name)));

CREATE INDEX index_work_item_weights_sources_on_namespace_id ON work_item_weights_sources USING btree (namespace_id);

CREATE INDEX index_work_item_weights_sources_on_work_item_id ON work_item_weights_sources USING btree (work_item_id);

CREATE UNIQUE INDEX index_work_item_widget_definitions_on_type_id_and_name ON work_item_widget_definitions USING btree (work_item_type_id, TRIM(BOTH FROM lower(name)));

CREATE INDEX index_work_item_widget_definitions_on_work_item_type_id ON work_item_widget_definitions USING btree (work_item_type_id);

CREATE INDEX index_workspace_agentk_states_on_project_id ON workspace_agentk_states USING btree (project_id);

CREATE UNIQUE INDEX index_workspace_agentk_states_on_workspace_id ON workspace_agentk_states USING btree (workspace_id);

CREATE INDEX index_workspace_tokens_on_project_id ON workspace_tokens USING btree (project_id);

CREATE INDEX index_workspace_tokens_on_token_encrypted ON workspace_tokens USING btree (token_encrypted);

CREATE UNIQUE INDEX index_workspace_tokens_on_workspace_id ON workspace_tokens USING btree (workspace_id);

CREATE INDEX index_workspace_variables_on_project_id ON workspace_variables USING btree (project_id);

CREATE INDEX index_workspace_variables_on_workspace_id ON workspace_variables USING btree (workspace_id);

CREATE INDEX index_workspaces_agent_config_versions_on_item_id ON workspaces_agent_config_versions USING btree (item_id);

CREATE INDEX index_workspaces_agent_config_versions_on_project_id ON workspaces_agent_config_versions USING btree (project_id);

CREATE INDEX index_workspaces_agent_configs_on_project_id ON workspaces_agent_configs USING btree (project_id);

CREATE UNIQUE INDEX index_workspaces_agent_configs_on_unique_cluster_agent_id ON workspaces_agent_configs USING btree (cluster_agent_id);

CREATE INDEX index_workspaces_on_cluster_agent_id ON workspaces USING btree (cluster_agent_id);

CREATE UNIQUE INDEX index_workspaces_on_name ON workspaces USING btree (name);

CREATE INDEX index_workspaces_on_personal_access_token_id ON workspaces USING btree (personal_access_token_id);

CREATE INDEX index_workspaces_on_project_id ON workspaces USING btree (project_id);

CREATE INDEX index_workspaces_on_user_id ON workspaces USING btree (user_id);

CREATE INDEX index_x509_certificates_on_subject_key_identifier ON x509_certificates USING btree (subject_key_identifier);

CREATE INDEX index_x509_certificates_on_x509_issuer_id ON x509_certificates USING btree (x509_issuer_id);

CREATE INDEX index_x509_commit_signatures_on_commit_sha ON x509_commit_signatures USING btree (commit_sha);

CREATE INDEX index_x509_commit_signatures_on_project_id ON x509_commit_signatures USING btree (project_id);

CREATE INDEX index_x509_commit_signatures_on_x509_certificate_id ON x509_commit_signatures USING btree (x509_certificate_id);

CREATE INDEX index_x509_issuers_on_subject_key_identifier ON x509_issuers USING btree (subject_key_identifier);

CREATE UNIQUE INDEX index_xray_reports_on_project_id_and_lang ON xray_reports USING btree (project_id, lang);

CREATE INDEX index_zens_on_last_rollout_failed_at ON zoekt_enabled_namespaces USING btree (last_rollout_failed_at);

CREATE INDEX index_zentao_tracker_data_on_group_id ON zentao_tracker_data USING btree (group_id);

CREATE INDEX index_zentao_tracker_data_on_instance_integration_id ON zentao_tracker_data USING btree (instance_integration_id);

CREATE INDEX index_zentao_tracker_data_on_integration_id ON zentao_tracker_data USING btree (integration_id);

CREATE INDEX index_zentao_tracker_data_on_organization_id ON zentao_tracker_data USING btree (organization_id);

CREATE INDEX index_zentao_tracker_data_on_project_id ON zentao_tracker_data USING btree (project_id);

CREATE INDEX index_zoekt_indices_on_id_conditional_watermark_level_state ON zoekt_indices USING btree (id) WHERE (((watermark_level = 10) AND (state = 10)) OR (watermark_level = 60));

CREATE INDEX index_zoekt_indices_on_namespace_id ON zoekt_indices USING btree (namespace_id, zoekt_enabled_namespace_id);

CREATE INDEX index_zoekt_indices_on_replica_id ON zoekt_indices USING btree (zoekt_replica_id);

CREATE UNIQUE INDEX index_zoekt_indices_on_state_and_id ON zoekt_indices USING btree (state, id);

CREATE INDEX index_zoekt_indices_on_state_and_zoekt_node_id ON zoekt_indices USING btree (state, zoekt_node_id);

CREATE INDEX index_zoekt_indices_on_watermark_level_and_id ON zoekt_indices USING btree (watermark_level, id);

CREATE INDEX index_zoekt_indices_on_watermark_level_reserved_storage_bytes ON zoekt_indices USING btree (watermark_level, id) WHERE (reserved_storage_bytes > 0);

CREATE UNIQUE INDEX index_zoekt_indices_on_zoekt_node_id_and_id ON zoekt_indices USING btree (zoekt_node_id, id);

CREATE INDEX index_zoekt_nodes_on_last_seen_at ON zoekt_nodes USING btree (last_seen_at);

CREATE UNIQUE INDEX index_zoekt_nodes_on_uuid ON zoekt_nodes USING btree (uuid);

CREATE INDEX index_zoekt_replicas_on_enabled_namespace_id ON zoekt_replicas USING btree (zoekt_enabled_namespace_id);

CREATE INDEX index_zoekt_replicas_on_namespace_id_enabled_namespace_id ON zoekt_replicas USING btree (namespace_id, zoekt_enabled_namespace_id);

CREATE INDEX index_zoekt_replicas_on_state ON zoekt_replicas USING btree (state);

CREATE INDEX index_zoekt_repos_with_missing_project_id ON zoekt_repositories USING btree (project_id) WHERE (project_id IS NULL);

CREATE INDEX index_zoekt_repositories_on_project_id ON zoekt_repositories USING btree (project_id);

CREATE INDEX index_zoekt_repositories_on_state ON zoekt_repositories USING btree (state);

CREATE INDEX index_zoekt_tasks_on_state ON ONLY zoekt_tasks USING btree (state);

CREATE INDEX index_zoekt_tasks_on_zoekt_node_id_and_state_and_perform_at ON ONLY zoekt_tasks USING btree (zoekt_node_id, state, perform_at);

CREATE INDEX index_zoekt_tasks_on_zoekt_repository_id ON ONLY zoekt_tasks USING btree (zoekt_repository_id);

CREATE INDEX index_zoom_meetings_on_issue_id ON zoom_meetings USING btree (issue_id);

CREATE UNIQUE INDEX index_zoom_meetings_on_issue_id_and_issue_status ON zoom_meetings USING btree (issue_id, issue_status) WHERE (issue_status = 1);

CREATE INDEX index_zoom_meetings_on_issue_status ON zoom_meetings USING btree (issue_status);

CREATE INDEX index_zoom_meetings_on_project_id ON zoom_meetings USING btree (project_id);

CREATE UNIQUE INDEX instance_type_ci_runner_machi_runner_id_runner_type_system__idx ON instance_type_ci_runner_machines USING btree (runner_id, runner_type, system_xid);

CREATE INDEX instance_type_ci_runner_machin_substring_version_runner_id_idx1 ON instance_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);

CREATE INDEX instance_type_ci_runner_machin_substring_version_runner_id_idx2 ON instance_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);

CREATE INDEX instance_type_ci_runner_machine_substring_version_runner_id_idx ON instance_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);

CREATE INDEX instance_type_ci_runner_machines_687967fa8a_contacted_at_id_idx ON instance_type_ci_runner_machines USING btree (contacted_at DESC, id DESC);

CREATE INDEX instance_type_ci_runner_machines_687967fa8a_created_at_id_idx ON instance_type_ci_runner_machines USING btree (created_at, id DESC);

CREATE INDEX instance_type_ci_runner_machines_687967fa8a_sharding_key_id_idx ON instance_type_ci_runner_machines USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX instance_type_ci_runner_machines_687967fa8a_version_idx ON instance_type_ci_runner_machines USING btree (version);

CREATE INDEX instance_type_ci_runners_e59bb2812d_active_id_idx ON instance_type_ci_runners USING btree (active, id);

CREATE INDEX instance_type_ci_runners_e59bb2812d_contacted_at_id_idx ON instance_type_ci_runners USING btree (contacted_at, id DESC);

CREATE INDEX instance_type_ci_runners_e59bb2812d_contacted_at_id_idx1 ON instance_type_ci_runners USING btree (contacted_at DESC, id DESC) WHERE (active = false);

CREATE INDEX instance_type_ci_runners_e59bb2812d_contacted_at_id_idx2 ON instance_type_ci_runners USING btree (contacted_at DESC, id DESC);

CREATE INDEX instance_type_ci_runners_e59bb2812d_created_at_id_idx ON instance_type_ci_runners USING btree (created_at, id DESC);

CREATE INDEX instance_type_ci_runners_e59bb2812d_created_at_id_idx1 ON instance_type_ci_runners USING btree (created_at DESC, id DESC) WHERE (active = false);

CREATE INDEX instance_type_ci_runners_e59bb2812d_created_at_id_idx2 ON instance_type_ci_runners USING btree (created_at DESC, id DESC);

CREATE INDEX instance_type_ci_runners_e59bb2812d_creator_id_idx ON instance_type_ci_runners USING btree (creator_id) WHERE (creator_id IS NOT NULL);

CREATE INDEX instance_type_ci_runners_e59bb2812d_description_idx ON instance_type_ci_runners USING gin (description gin_trgm_ops);

CREATE INDEX instance_type_ci_runners_e59bb2812d_locked_idx ON instance_type_ci_runners USING btree (locked);

CREATE INDEX instance_type_ci_runners_e59bb2812d_sharding_key_id_idx ON instance_type_ci_runners USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX instance_type_ci_runners_e59bb2812d_token_expires_at_id_idx ON instance_type_ci_runners USING btree (token_expires_at, id DESC);

CREATE INDEX instance_type_ci_runners_e59bb2812d_token_expires_at_id_idx1 ON instance_type_ci_runners USING btree (token_expires_at DESC, id DESC);

CREATE UNIQUE INDEX instance_type_ci_runners_e59bb2812d_token_runner_type_idx ON instance_type_ci_runners USING btree (token, runner_type) WHERE (token IS NOT NULL);

CREATE UNIQUE INDEX instance_type_ci_runners_e59bb2_token_encrypted_runner_type_idx ON instance_type_ci_runners USING btree (token_encrypted, runner_type);

CREATE INDEX issuable_metric_image_uploads_checksum_idx ON issuable_metric_image_uploads USING btree (checksum);

CREATE INDEX issuable_metric_image_uploads_model_id_model_type_uploader__idx ON issuable_metric_image_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX issuable_metric_image_uploads_namespace_id_idx ON issuable_metric_image_uploads USING btree (namespace_id);

CREATE INDEX issuable_metric_image_uploads_organization_id_idx ON issuable_metric_image_uploads USING btree (organization_id);

CREATE INDEX issuable_metric_image_uploads_project_id_idx ON issuable_metric_image_uploads USING btree (project_id);

CREATE INDEX issuable_metric_image_uploads_store_idx ON issuable_metric_image_uploads USING btree (store);

CREATE INDEX issuable_metric_image_uploads_uploaded_by_user_id_idx ON issuable_metric_image_uploads USING btree (uploaded_by_user_id);

CREATE INDEX issuable_metric_image_uploads_uploader_path_idx ON issuable_metric_image_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_and_note_id_index ON issue_user_mentions USING btree (issue_id, note_id);

CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_index ON issue_user_mentions USING btree (issue_id) WHERE (note_id IS NULL);

CREATE UNIQUE INDEX kubernetes_namespaces_cluster_and_namespace ON clusters_kubernetes_namespaces USING btree (cluster_id, namespace);

CREATE UNIQUE INDEX lfs_objects_projects_on_project_id_lfs_object_id_null_repo_type ON lfs_objects_projects USING btree (project_id, lfs_object_id) WHERE (repository_type IS NULL);

CREATE UNIQUE INDEX lfs_objects_projects_on_project_id_lfs_object_id_with_repo_type ON lfs_objects_projects USING btree (project_id, lfs_object_id, repository_type) WHERE (repository_type IS NOT NULL);

CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_and_note_id_index ON merge_request_user_mentions USING btree (merge_request_id, note_id);

CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_index ON merge_request_user_mentions USING btree (merge_request_id) WHERE (note_id IS NULL);

CREATE INDEX namespace_uploads_checksum_idx ON namespace_uploads USING btree (checksum);

CREATE INDEX namespace_uploads_model_id_model_type_uploader_created_at_idx ON namespace_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX namespace_uploads_namespace_id_idx ON namespace_uploads USING btree (namespace_id);

CREATE INDEX namespace_uploads_organization_id_idx ON namespace_uploads USING btree (organization_id);

CREATE INDEX namespace_uploads_project_id_idx ON namespace_uploads USING btree (project_id);

CREATE INDEX namespace_uploads_store_idx ON namespace_uploads USING btree (store);

CREATE INDEX namespace_uploads_uploaded_by_user_id_idx ON namespace_uploads USING btree (uploaded_by_user_id);

CREATE INDEX namespace_uploads_uploader_path_idx ON namespace_uploads USING btree (uploader, path);

CREATE INDEX note_uploads_checksum_idx ON note_uploads USING btree (checksum);

CREATE INDEX note_uploads_model_id_model_type_uploader_created_at_idx ON note_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX note_uploads_namespace_id_idx ON note_uploads USING btree (namespace_id);

CREATE INDEX note_uploads_organization_id_idx ON note_uploads USING btree (organization_id);

CREATE INDEX note_uploads_project_id_idx ON note_uploads USING btree (project_id);

CREATE INDEX note_uploads_store_idx ON note_uploads USING btree (store);

CREATE INDEX note_uploads_uploaded_by_user_id_idx ON note_uploads USING btree (uploaded_by_user_id);

CREATE INDEX note_uploads_uploader_path_idx ON note_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON wiki_page_slugs USING btree (wiki_page_meta_id) WHERE (canonical = true);

CREATE INDEX organization_detail_uploads_checksum_idx ON organization_detail_uploads USING btree (checksum);

CREATE INDEX organization_detail_uploads_model_id_model_type_uploader_cr_idx ON organization_detail_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX organization_detail_uploads_namespace_id_idx ON organization_detail_uploads USING btree (namespace_id);

CREATE INDEX organization_detail_uploads_organization_id_idx ON organization_detail_uploads USING btree (organization_id);

CREATE INDEX organization_detail_uploads_project_id_idx ON organization_detail_uploads USING btree (project_id);

CREATE INDEX organization_detail_uploads_store_idx ON organization_detail_uploads USING btree (store);

CREATE INDEX organization_detail_uploads_uploaded_by_user_id_idx ON organization_detail_uploads USING btree (uploaded_by_user_id);

CREATE INDEX organization_detail_uploads_uploader_path_idx ON organization_detail_uploads USING btree (uploader, path);

CREATE INDEX p_ci_builds_auto_canceled_by_id_idx ON ONLY p_ci_builds USING btree (auto_canceled_by_id) WHERE (auto_canceled_by_id IS NOT NULL);

CREATE INDEX p_ci_builds_commit_id_artifacts_expire_at_id_idx ON ONLY p_ci_builds USING btree (commit_id, artifacts_expire_at, id) WHERE (((type)::text = 'Ci::Build'::text) AND ((retried = false) OR (retried IS NULL)) AND ((name)::text = ANY (ARRAY[('sast'::character varying)::text, ('secret_detection'::character varying)::text, ('dependency_scanning'::character varying)::text, ('container_scanning'::character varying)::text, ('dast'::character varying)::text])));

CREATE INDEX p_ci_builds_commit_id_stage_idx_created_at_idx ON ONLY p_ci_builds USING btree (commit_id, stage_idx, created_at);

CREATE INDEX p_ci_builds_commit_id_status_type_idx ON ONLY p_ci_builds USING btree (commit_id, status, type);

CREATE INDEX p_ci_builds_commit_id_type_name_ref_idx ON ONLY p_ci_builds USING btree (commit_id, type, name, ref);

CREATE INDEX p_ci_builds_commit_id_type_ref_idx ON ONLY p_ci_builds USING btree (commit_id, type, ref);

CREATE INDEX p_ci_builds_metadata_build_id_id_idx ON ONLY p_ci_builds_metadata USING btree (build_id) INCLUDE (id) WHERE (interruptible = true);

CREATE INDEX p_ci_builds_metadata_build_id_idx ON ONLY p_ci_builds_metadata USING btree (build_id) WHERE (has_exposed_artifacts IS TRUE);

CREATE UNIQUE INDEX p_ci_builds_metadata_build_id_partition_id_idx ON ONLY p_ci_builds_metadata USING btree (build_id, partition_id);

CREATE INDEX p_ci_builds_metadata_project_id_idx ON ONLY p_ci_builds_metadata USING btree (project_id);

CREATE INDEX p_ci_builds_name_id_idx ON ONLY p_ci_builds USING btree (name, id) WHERE (((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('secret_detection'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('license_scanning'::character varying)::text, ('apifuzzer_fuzz'::character varying)::text, ('apifuzzer_fuzz_dnd'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text));

CREATE INDEX p_ci_builds_project_id_id_idx ON ONLY p_ci_builds USING btree (project_id, id);

CREATE INDEX p_ci_builds_project_id_name_ref_idx ON ONLY p_ci_builds USING btree (project_id, name, ref) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = 'success'::text) AND ((retried = false) OR (retried IS NULL)));

CREATE INDEX p_ci_builds_project_id_status_idx ON ONLY p_ci_builds USING btree (project_id, status) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])));

CREATE INDEX p_ci_builds_resource_group_id_status_commit_id_idx ON ONLY p_ci_builds USING btree (resource_group_id, status, commit_id) WHERE (resource_group_id IS NOT NULL);

CREATE INDEX p_ci_builds_runner_id_id_idx ON ONLY p_ci_builds USING btree (runner_id, id DESC);

CREATE INDEX p_ci_builds_runner_id_idx ON ONLY p_ci_builds USING btree (runner_id) WHERE (((status)::text = 'running'::text) AND ((type)::text = 'Ci::Build'::text));

CREATE INDEX p_ci_builds_scheduled_at_idx ON ONLY p_ci_builds USING btree (scheduled_at) WHERE ((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text));

CREATE INDEX p_ci_builds_stage_id_idx ON ONLY p_ci_builds USING btree (stage_id);

CREATE INDEX p_ci_builds_status_created_at_project_id_idx ON ONLY p_ci_builds USING btree (status, created_at, project_id) WHERE ((type)::text = 'Ci::Build'::text);

CREATE INDEX p_ci_builds_status_type_runner_id_idx ON ONLY p_ci_builds USING btree (status, type, runner_id);

CREATE UNIQUE INDEX p_ci_builds_token_encrypted_partition_id_idx ON ONLY p_ci_builds USING btree (token_encrypted, partition_id) WHERE (token_encrypted IS NOT NULL);

CREATE INDEX p_ci_builds_updated_at_idx ON ONLY p_ci_builds USING btree (updated_at);

CREATE INDEX p_ci_builds_upstream_pipeline_id_idx ON ONLY p_ci_builds USING btree (upstream_pipeline_id) WHERE (upstream_pipeline_id IS NOT NULL);

CREATE INDEX p_ci_builds_user_id_created_at_idx ON ONLY p_ci_builds USING btree (user_id, created_at) WHERE ((type)::text = 'Ci::Build'::text);

CREATE INDEX p_ci_builds_user_id_idx ON ONLY p_ci_builds USING btree (user_id);

CREATE INDEX p_ci_builds_user_id_name_created_at_idx ON ONLY p_ci_builds USING btree (user_id, name, created_at) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('apifuzzer_fuzz'::character varying)::text, ('apifuzzer_fuzz_dnd'::character varying)::text, ('secret_detection'::character varying)::text])));

CREATE INDEX p_ci_builds_user_id_name_idx ON ONLY p_ci_builds USING btree (user_id, name) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('secret_detection'::character varying)::text])));

CREATE INDEX p_ci_job_artifacts_expire_at_idx ON ONLY p_ci_job_artifacts USING btree (expire_at) WHERE ((locked = 0) AND (file_type <> 3) AND (expire_at IS NOT NULL));

CREATE INDEX p_ci_job_artifacts_expire_at_job_id_idx1 ON ONLY p_ci_job_artifacts USING btree (expire_at, job_id) WHERE ((locked = 2) AND (expire_at IS NOT NULL));

CREATE INDEX p_ci_job_artifacts_file_final_path_idx ON ONLY p_ci_job_artifacts USING btree (file_final_path) WHERE (file_final_path IS NOT NULL);

CREATE INDEX p_ci_job_artifacts_file_store_idx ON ONLY p_ci_job_artifacts USING btree (file_store);

CREATE INDEX p_ci_job_artifacts_file_type_project_id_created_at_idx ON ONLY p_ci_job_artifacts USING btree (file_type, project_id, created_at) WHERE (file_type = ANY (ARRAY[5, 6, 8, 23]));

CREATE INDEX p_ci_job_artifacts_id_idx ON ONLY p_ci_job_artifacts USING btree (id) WHERE (file_type = 18);

CREATE UNIQUE INDEX p_ci_job_artifacts_job_id_file_type_partition_id_idx ON ONLY p_ci_job_artifacts USING btree (job_id, file_type, partition_id);

CREATE INDEX p_ci_job_artifacts_project_id_created_at_id_idx ON ONLY p_ci_job_artifacts USING btree (project_id, created_at, id);

CREATE INDEX p_ci_job_artifacts_project_id_file_type_id_idx ON ONLY p_ci_job_artifacts USING btree (project_id, file_type, id);

CREATE INDEX p_ci_job_artifacts_project_id_id_idx ON ONLY p_ci_job_artifacts USING btree (project_id, id) WHERE (file_type = 18);

CREATE INDEX p_ci_job_artifacts_project_id_id_idx1 ON ONLY p_ci_job_artifacts USING btree (project_id, id);

CREATE INDEX p_ci_job_artifacts_project_id_idx1 ON ONLY p_ci_job_artifacts USING btree (project_id) WHERE (file_type = ANY (ARRAY[5, 6, 7, 8]));

CREATE UNIQUE INDEX p_ci_pipeline_variables_pipeline_id_key_partition_id_idx ON ONLY p_ci_pipeline_variables USING btree (pipeline_id, key, partition_id);

CREATE INDEX p_ci_pipelines_auto_canceled_by_id_idx ON ONLY p_ci_pipelines USING btree (auto_canceled_by_id);

CREATE INDEX p_ci_pipelines_ci_ref_id_id_idx ON ONLY p_ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1);

CREATE INDEX p_ci_pipelines_ci_ref_id_id_source_status_idx ON ONLY p_ci_pipelines USING btree (ci_ref_id, id DESC, source, status) WHERE (ci_ref_id IS NOT NULL);

CREATE INDEX p_ci_pipelines_external_pull_request_id_idx ON ONLY p_ci_pipelines USING btree (external_pull_request_id) WHERE (external_pull_request_id IS NOT NULL);

CREATE INDEX p_ci_pipelines_id_idx ON ONLY p_ci_pipelines USING btree (id) WHERE (source = 13);

CREATE INDEX p_ci_pipelines_merge_request_id_idx ON ONLY p_ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL);

CREATE INDEX p_ci_pipelines_pipeline_schedule_id_id_idx ON ONLY p_ci_pipelines USING btree (pipeline_schedule_id, id);

CREATE INDEX p_ci_pipelines_project_id_id_idx ON ONLY p_ci_pipelines USING btree (project_id, id DESC);

CREATE UNIQUE INDEX p_ci_pipelines_project_id_iid_partition_id_idx ON ONLY p_ci_pipelines USING btree (project_id, iid, partition_id) WHERE (iid IS NOT NULL);

CREATE INDEX p_ci_pipelines_project_id_ref_id_idx ON ONLY p_ci_pipelines USING btree (project_id, ref, id DESC);

CREATE INDEX p_ci_pipelines_project_id_ref_status_id_idx ON ONLY p_ci_pipelines USING btree (project_id, ref, status, id);

CREATE INDEX p_ci_pipelines_project_id_sha_idx ON ONLY p_ci_pipelines USING btree (project_id, sha);

CREATE INDEX p_ci_pipelines_project_id_source_idx ON ONLY p_ci_pipelines USING btree (project_id, source);

CREATE INDEX p_ci_pipelines_project_id_status_config_source_idx ON ONLY p_ci_pipelines USING btree (project_id, status, config_source);

CREATE INDEX p_ci_pipelines_project_id_status_created_at_idx ON ONLY p_ci_pipelines USING btree (project_id, status, created_at);

CREATE INDEX p_ci_pipelines_project_id_status_updated_at_idx ON ONLY p_ci_pipelines USING btree (project_id, status, updated_at);

CREATE INDEX p_ci_pipelines_project_id_user_id_status_ref_idx ON ONLY p_ci_pipelines USING btree (project_id, user_id, status, ref) WHERE (source <> 12);

CREATE INDEX p_ci_pipelines_status_id_idx ON ONLY p_ci_pipelines USING btree (status, id);

CREATE INDEX p_ci_pipelines_trigger_id_id_desc_idx ON ONLY p_ci_pipelines USING btree (trigger_id, id DESC);

CREATE INDEX p_ci_pipelines_user_id_created_at_config_source_idx ON ONLY p_ci_pipelines USING btree (user_id, created_at, config_source);

CREATE INDEX p_ci_pipelines_user_id_created_at_source_idx ON ONLY p_ci_pipelines USING btree (user_id, created_at, source);

CREATE INDEX p_ci_pipelines_user_id_id_idx ON ONLY p_ci_pipelines USING btree (user_id, id) WHERE ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('waiting_for_resource'::character varying)::text, ('preparing'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text, ('scheduled'::character varying)::text]));

CREATE INDEX p_ci_pipelines_user_id_id_idx1 ON ONLY p_ci_pipelines USING btree (user_id, id DESC) WHERE (failure_reason = 3);

CREATE INDEX p_ci_stages_pipeline_id_id_idx ON ONLY p_ci_stages USING btree (pipeline_id, id) WHERE (status = ANY (ARRAY[0, 1, 2, 8, 9, 10]));

CREATE UNIQUE INDEX p_ci_stages_pipeline_id_name_partition_id_idx ON ONLY p_ci_stages USING btree (pipeline_id, name, partition_id);

CREATE INDEX p_ci_stages_pipeline_id_position_idx ON ONLY p_ci_stages USING btree (pipeline_id, "position");

CREATE INDEX p_ci_stages_project_id_idx ON ONLY p_ci_stages USING btree (project_id);

CREATE UNIQUE INDEX p_ci_workloads_pipeline_id_idx ON ONLY p_ci_workloads USING btree (pipeline_id, partition_id);

CREATE UNIQUE INDEX p_knowledge_graph_replicas_namespace_id_and_zoekt_node_id ON ONLY p_knowledge_graph_replicas USING btree (knowledge_graph_enabled_namespace_id, zoekt_node_id, namespace_id);

CREATE INDEX package_name_index ON packages_packages USING btree (name);

CREATE INDEX packages_packages_failed_verification ON packages_package_files USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);

CREATE INDEX packages_packages_needs_verification ON packages_package_files USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));

CREATE INDEX packages_packages_pending_verification ON packages_package_files USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);

CREATE INDEX pages_deployments_deleted_at_null_index ON pages_deployments USING btree (project_id, path_prefix, id) WHERE (deleted_at IS NULL);

CREATE UNIQUE INDEX partial_idx_bulk_import_exports_on_group_user_and_relation ON bulk_import_exports USING btree (group_id, relation, user_id) WHERE ((group_id IS NOT NULL) AND (user_id IS NOT NULL));

CREATE UNIQUE INDEX partial_idx_bulk_import_exports_on_project_user_and_relation ON bulk_import_exports USING btree (project_id, relation, user_id) WHERE ((project_id IS NOT NULL) AND (user_id IS NOT NULL));

CREATE INDEX partial_index_slack_integrations_with_bot_user_id ON slack_integrations USING btree (id) WHERE (bot_user_id IS NOT NULL);

CREATE UNIQUE INDEX partial_index_sop_configs_on_namespace_id ON security_orchestration_policy_configurations USING btree (namespace_id) WHERE (namespace_id IS NOT NULL);

CREATE UNIQUE INDEX partial_index_sop_configs_on_project_id ON security_orchestration_policy_configurations USING btree (project_id) WHERE (project_id IS NOT NULL);

CREATE INDEX partial_index_user_id_app_id_created_at_token_not_revoked ON oauth_access_tokens USING btree (resource_owner_id, application_id, created_at) WHERE (revoked_at IS NULL);

CREATE UNIQUE INDEX pm_checkpoints_path_components ON pm_checkpoints USING btree (purl_type, data_type, version_format);

CREATE INDEX project_import_export_relatio_model_id_model_type_uploader__idx ON project_import_export_relation_export_upload_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX project_import_export_relation_export_u_uploaded_by_user_id_idx ON project_import_export_relation_export_upload_uploads USING btree (uploaded_by_user_id);

CREATE INDEX project_import_export_relation_export_uploa_organization_id_idx ON project_import_export_relation_export_upload_uploads USING btree (organization_id);

CREATE INDEX project_import_export_relation_export_upload__uploader_path_idx ON project_import_export_relation_export_upload_uploads USING btree (uploader, path);

CREATE INDEX project_import_export_relation_export_upload_u_namespace_id_idx ON project_import_export_relation_export_upload_uploads USING btree (namespace_id);

CREATE INDEX project_import_export_relation_export_upload_upl_project_id_idx ON project_import_export_relation_export_upload_uploads USING btree (project_id);

CREATE INDEX project_import_export_relation_export_upload_uploa_checksum_idx ON project_import_export_relation_export_upload_uploads USING btree (checksum);

CREATE INDEX project_import_export_relation_export_upload_uploads_store_idx ON project_import_export_relation_export_upload_uploads USING btree (store);

CREATE INDEX project_topic_uploads_checksum_idx ON project_topic_uploads USING btree (checksum);

CREATE INDEX project_topic_uploads_model_id_model_type_uploader_created__idx ON project_topic_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX project_topic_uploads_namespace_id_idx ON project_topic_uploads USING btree (namespace_id);

CREATE INDEX project_topic_uploads_organization_id_idx ON project_topic_uploads USING btree (organization_id);

CREATE INDEX project_topic_uploads_project_id_idx ON project_topic_uploads USING btree (project_id);

CREATE INDEX project_topic_uploads_store_idx ON project_topic_uploads USING btree (store);

CREATE INDEX project_topic_uploads_uploaded_by_user_id_idx ON project_topic_uploads USING btree (uploaded_by_user_id);

CREATE INDEX project_topic_uploads_uploader_path_idx ON project_topic_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX project_type_ci_runner_machin_runner_id_runner_type_system__idx ON project_type_ci_runner_machines USING btree (runner_id, runner_type, system_xid);

CREATE INDEX project_type_ci_runner_machine_substring_version_runner_id_idx1 ON project_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.'::text), version, runner_id);

CREATE INDEX project_type_ci_runner_machine_substring_version_runner_id_idx2 ON project_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.\d+\.\d+'::text), version, runner_id);

CREATE INDEX project_type_ci_runner_machines_687967fa8a_contacted_at_id_idx ON project_type_ci_runner_machines USING btree (contacted_at DESC, id DESC);

CREATE INDEX project_type_ci_runner_machines_687967fa8a_created_at_id_idx ON project_type_ci_runner_machines USING btree (created_at, id DESC);

CREATE INDEX project_type_ci_runner_machines_687967fa8a_sharding_key_id_idx ON project_type_ci_runner_machines USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX project_type_ci_runner_machines_687967fa8a_version_idx ON project_type_ci_runner_machines USING btree (version);

CREATE INDEX project_type_ci_runner_machines_substring_version_runner_id_idx ON project_type_ci_runner_machines USING btree ("substring"(version, '^\d+\.'::text), version, runner_id);

CREATE INDEX project_type_ci_runners_e59bb2812d_active_id_idx ON project_type_ci_runners USING btree (active, id);

CREATE INDEX project_type_ci_runners_e59bb2812d_contacted_at_id_idx ON project_type_ci_runners USING btree (contacted_at, id DESC);

CREATE INDEX project_type_ci_runners_e59bb2812d_contacted_at_id_idx1 ON project_type_ci_runners USING btree (contacted_at DESC, id DESC) WHERE (active = false);

CREATE INDEX project_type_ci_runners_e59bb2812d_contacted_at_id_idx2 ON project_type_ci_runners USING btree (contacted_at DESC, id DESC);

CREATE INDEX project_type_ci_runners_e59bb2812d_created_at_id_idx ON project_type_ci_runners USING btree (created_at, id DESC);

CREATE INDEX project_type_ci_runners_e59bb2812d_created_at_id_idx1 ON project_type_ci_runners USING btree (created_at DESC, id DESC) WHERE (active = false);

CREATE INDEX project_type_ci_runners_e59bb2812d_created_at_id_idx2 ON project_type_ci_runners USING btree (created_at DESC, id DESC);

CREATE INDEX project_type_ci_runners_e59bb2812d_creator_id_idx ON project_type_ci_runners USING btree (creator_id) WHERE (creator_id IS NOT NULL);

CREATE INDEX project_type_ci_runners_e59bb2812d_description_idx ON project_type_ci_runners USING gin (description gin_trgm_ops);

CREATE INDEX project_type_ci_runners_e59bb2812d_locked_idx ON project_type_ci_runners USING btree (locked);

CREATE INDEX project_type_ci_runners_e59bb2812d_sharding_key_id_idx ON project_type_ci_runners USING btree (sharding_key_id) WHERE (sharding_key_id IS NOT NULL);

CREATE INDEX project_type_ci_runners_e59bb2812d_token_expires_at_id_idx ON project_type_ci_runners USING btree (token_expires_at, id DESC);

CREATE INDEX project_type_ci_runners_e59bb2812d_token_expires_at_id_idx1 ON project_type_ci_runners USING btree (token_expires_at DESC, id DESC);

CREATE UNIQUE INDEX project_type_ci_runners_e59bb2812d_token_runner_type_idx ON project_type_ci_runners USING btree (token, runner_type) WHERE (token IS NOT NULL);

CREATE UNIQUE INDEX project_type_ci_runners_e59bb28_token_encrypted_runner_type_idx ON project_type_ci_runners USING btree (token_encrypted, runner_type);

CREATE INDEX project_uploads_checksum_idx ON project_uploads USING btree (checksum);

CREATE INDEX project_uploads_model_id_model_type_uploader_created_at_idx ON project_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX project_uploads_namespace_id_idx ON project_uploads USING btree (namespace_id);

CREATE INDEX project_uploads_organization_id_idx ON project_uploads USING btree (organization_id);

CREATE INDEX project_uploads_project_id_idx ON project_uploads USING btree (project_id);

CREATE INDEX project_uploads_store_idx ON project_uploads USING btree (store);

CREATE INDEX project_uploads_uploaded_by_user_id_idx ON project_uploads USING btree (uploaded_by_user_id);

CREATE INDEX project_uploads_uploader_path_idx ON project_uploads USING btree (uploader, path);

CREATE INDEX releases_published_at_index ON releases USING btree (release_published_at);

CREATE INDEX revised_idx_for_owasp_top_10_group_level_reports ON vulnerability_reads USING btree (owasp_top_10, state, report_type, resolved_on_default_branch, severity, traversal_ids, vulnerability_id) WHERE (archived = false);

CREATE INDEX scan_finding_approval_mr_rule_index_id ON approval_merge_request_rules USING btree (id) WHERE (report_type = 4);

CREATE INDEX scan_finding_approval_mr_rule_index_merge_request_id ON approval_merge_request_rules USING btree (merge_request_id) WHERE (report_type = 4);

CREATE INDEX scan_finding_approval_mr_rule_index_mr_id_and_created_at ON approval_merge_request_rules USING btree (merge_request_id, created_at) WHERE (report_type = 4);

CREATE INDEX scan_finding_approval_project_rule_index_created_at_project_id ON approval_project_rules USING btree (created_at, project_id) WHERE (report_type = 4);

CREATE INDEX scan_finding_approval_project_rule_index_project_id ON approval_project_rules USING btree (project_id) WHERE (report_type = 4);

CREATE INDEX security_findings_scan_id_deduplicated_idx ON ONLY security_findings USING btree (scan_id, deduplicated);

CREATE INDEX security_findings_scan_id_id_idx ON ONLY security_findings USING btree (scan_id, id);

CREATE INDEX security_findings_scanner_id_idx ON ONLY security_findings USING btree (scanner_id);

CREATE INDEX security_findings_severity_idx ON ONLY security_findings USING btree (severity);

CREATE UNIQUE INDEX security_findings_uuid_scan_id_partition_number_idx ON ONLY security_findings USING btree (uuid, scan_id, partition_number);

CREATE INDEX security_policy_approval_mr_rule_index_merge_request_id ON approval_merge_request_rules USING btree (merge_request_id) WHERE (report_type = ANY (ARRAY[4, 2, 5]));

CREATE INDEX snippet_uploads_checksum_idx ON snippet_uploads USING btree (checksum);

CREATE INDEX snippet_uploads_model_id_model_type_uploader_created_at_idx ON snippet_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX snippet_uploads_namespace_id_idx ON snippet_uploads USING btree (namespace_id);

CREATE INDEX snippet_uploads_organization_id_idx ON snippet_uploads USING btree (organization_id);

CREATE INDEX snippet_uploads_project_id_idx ON snippet_uploads USING btree (project_id);

CREATE INDEX snippet_uploads_store_idx ON snippet_uploads USING btree (store);

CREATE INDEX snippet_uploads_uploaded_by_user_id_idx ON snippet_uploads USING btree (uploaded_by_user_id);

CREATE INDEX snippet_uploads_uploader_path_idx ON snippet_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_and_note_id_index ON snippet_user_mentions USING btree (snippet_id, note_id);

CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_index ON snippet_user_mentions USING btree (snippet_id) WHERE (note_id IS NULL);

CREATE INDEX temp_index_on_users_where_dark_theme ON users USING btree (id) WHERE (theme_id = 11);

CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id);

CREATE INDEX tmp_idx_orphaned_approval_merge_request_rules ON approval_merge_request_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL));

CREATE INDEX tmp_idx_orphaned_approval_project_rules ON approval_project_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL));

CREATE INDEX tmp_idx_pkgs_pkgs_on_id_when_terraform_module_installable ON packages_packages USING btree (id) WHERE ((package_type = 12) AND (status = ANY (ARRAY[0, 1])));

CREATE INDEX tmp_idx_redirect_routes_on_source_type_id_where_namespace_null ON redirect_routes USING btree (source_type, id) WHERE (namespace_id IS NULL);

CREATE INDEX tmp_index_for_null_member_namespace_id ON members USING btree (member_namespace_id) WHERE (member_namespace_id IS NULL);

CREATE INDEX tmp_index_for_project_namespace_id_migration_on_routes ON routes USING btree (id) WHERE ((namespace_id IS NULL) AND ((source_type)::text = 'Project'::text));

CREATE INDEX tmp_index_null_project_id_on_notes ON notes USING btree (id) WHERE (project_id IS NULL);

CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0);

CREATE INDEX tmp_index_users_on_external_where_external_is_null ON users USING btree (external) WHERE (external IS NULL);

CREATE UNIQUE INDEX u_compliance_requirements_for_framework ON compliance_requirements USING btree (framework_id, name);

CREATE UNIQUE INDEX u_project_compliance_standards_adherence_for_reporting ON project_compliance_standards_adherence USING btree (project_id, check_name, standard);

CREATE UNIQUE INDEX u_zoekt_indices_zoekt_enabled_namespace_id_and_zoekt_node_id ON zoekt_indices USING btree (zoekt_enabled_namespace_id, zoekt_node_id);

CREATE UNIQUE INDEX u_zoekt_repositories_zoekt_index_id_and_project_id ON zoekt_repositories USING btree (zoekt_index_id, project_id);

CREATE UNIQUE INDEX uniq_audit_group_event_filters_destination_id_and_event_type ON audit_events_group_streaming_event_type_filters USING btree (external_streaming_destination_id, audit_event_type);

CREATE UNIQUE INDEX uniq_audit_instance_event_filters_destination_id_and_event_type ON audit_events_instance_streaming_event_type_filters USING btree (external_streaming_destination_id, audit_event_type);

CREATE UNIQUE INDEX uniq_compliance_controls_requirement_id_and_name ON compliance_requirements_controls USING btree (compliance_requirement_id, name) WHERE (control_type <> 1);

CREATE UNIQUE INDEX uniq_compliance_statuses_control_project_id ON project_control_compliance_statuses USING btree (compliance_requirements_control_id, project_id);

CREATE UNIQUE INDEX uniq_compliance_statuses_requirement_project_id ON project_requirement_compliance_statuses USING btree (compliance_requirement_id, project_id);

CREATE UNIQUE INDEX uniq_google_cloud_logging_configuration_namespace_id_and_name ON audit_events_google_cloud_logging_configurations USING btree (namespace_id, name);

CREATE UNIQUE INDEX uniq_idx_ai_active_context_collections_on_connection_id_name ON ai_active_context_collections USING btree (connection_id, name);

CREATE UNIQUE INDEX uniq_idx_audit_events_aws_configs_stream_dests ON audit_events_amazon_s3_configurations USING btree (stream_destination_id) WHERE (stream_destination_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_audit_events_ext_audit_event_stream_dests ON audit_events_external_audit_event_destinations USING btree (stream_destination_id) WHERE (stream_destination_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_audit_events_gcp_configs_stream_dests ON audit_events_google_cloud_logging_configurations USING btree (stream_destination_id) WHERE (stream_destination_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_audit_events_instance_aws_configs_stream_dests ON audit_events_instance_amazon_s3_configurations USING btree (stream_destination_id) WHERE (stream_destination_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_audit_events_instance_ext_audit_event_stream_dests ON audit_events_instance_external_audit_event_destinations USING btree (stream_destination_id) WHERE (stream_destination_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_audit_events_instance_gcp_configs_stream_dests ON audit_events_instance_google_cloud_logging_configurations USING btree (stream_destination_id) WHERE (stream_destination_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_on_packages_conan_package_references_package_reference ON packages_conan_package_references USING btree (package_id, recipe_revision_id, reference);

CREATE UNIQUE INDEX uniq_idx_on_packages_conan_package_revisions_revision ON packages_conan_package_revisions USING btree (package_id, package_reference_id, revision);

CREATE UNIQUE INDEX uniq_idx_packages_packages_on_project_id_name_version_ml_model ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 14) AND (status <> 4));

CREATE UNIQUE INDEX uniq_idx_project_compliance_framework_on_project_framework ON project_compliance_framework_settings USING btree (project_id, framework_id);

CREATE UNIQUE INDEX uniq_idx_security_policy_requirements_on_requirement_and_policy ON security_policy_requirements USING btree (compliance_framework_security_policy_id, compliance_requirement_id);

CREATE UNIQUE INDEX uniq_idx_streaming_destination_id_and_namespace_id ON audit_events_streaming_instance_namespace_filters USING btree (external_streaming_destination_id, namespace_id);

CREATE UNIQUE INDEX uniq_idx_streaming_group_destination_id_and_namespace_id ON audit_events_streaming_group_namespace_filters USING btree (external_streaming_destination_id, namespace_id);

CREATE UNIQUE INDEX uniq_idx_subscription_seat_assignments_on_namespace_id_and_user ON subscription_seat_assignments USING btree (namespace_id, user_id) WHERE (namespace_id IS NOT NULL);

CREATE UNIQUE INDEX uniq_idx_user_add_on_assignments_on_add_on_purchase_and_user ON subscription_user_add_on_assignments USING btree (add_on_purchase_id, user_id);

CREATE UNIQUE INDEX uniq_index_pkg_refs_on_ref_and_pkg_id_when_rev_is_null ON packages_conan_package_references USING btree (package_id, reference) WHERE (recipe_revision_id IS NULL);

CREATE UNIQUE INDEX uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name ON packages_debian_group_architectures USING btree (distribution_id, name);

CREATE UNIQUE INDEX uniq_pkgs_deb_grp_components_on_distribution_id_and_name ON packages_debian_group_components USING btree (distribution_id, name);

CREATE UNIQUE INDEX uniq_pkgs_deb_proj_architectures_on_distribution_id_and_name ON packages_debian_project_architectures USING btree (distribution_id, name);

CREATE UNIQUE INDEX uniq_pkgs_deb_proj_components_on_distribution_id_and_name ON packages_debian_project_components USING btree (distribution_id, name);

CREATE UNIQUE INDEX uniq_pkgs_debian_group_distributions_group_id_and_codename ON packages_debian_group_distributions USING btree (group_id, codename);

CREATE UNIQUE INDEX uniq_pkgs_debian_group_distributions_group_id_and_suite ON packages_debian_group_distributions USING btree (group_id, suite);

CREATE UNIQUE INDEX uniq_pkgs_debian_project_distributions_project_id_and_codename ON packages_debian_project_distributions USING btree (project_id, codename);

CREATE UNIQUE INDEX uniq_pkgs_debian_project_distributions_project_id_and_suite ON packages_debian_project_distributions USING btree (project_id, suite);

CREATE INDEX uniq_preference_by_user_namespace_and_work_item_type ON work_item_type_user_preferences USING btree (user_id, namespace_id, work_item_type_id);

CREATE UNIQUE INDEX unique_amazon_s3_configurations_namespace_id_and_bucket_name ON audit_events_amazon_s3_configurations USING btree (namespace_id, bucket_name);

CREATE UNIQUE INDEX unique_amazon_s3_configurations_namespace_id_and_name ON audit_events_amazon_s3_configurations USING btree (namespace_id, name);

CREATE UNIQUE INDEX unique_any_approver_merge_request_rule_type_post_merge ON approval_merge_request_rules USING btree (merge_request_id, rule_type, applicable_post_merge) WHERE (rule_type = 4);

CREATE UNIQUE INDEX unique_audit_events_group_namespace_filters_destination_id ON audit_events_streaming_http_group_namespace_filters USING btree (external_audit_event_destination_id);

CREATE UNIQUE INDEX unique_audit_events_group_namespace_filters_namespace_id ON audit_events_streaming_http_group_namespace_filters USING btree (namespace_id);

CREATE UNIQUE INDEX unique_audit_events_instance_namespace_filters_destination_id ON audit_events_streaming_http_instance_namespace_filters USING btree (audit_events_instance_external_audit_event_destination_id);

CREATE UNIQUE INDEX unique_batched_background_migrations_queued_migration_version ON batched_background_migrations USING btree (queued_migration_version);

CREATE UNIQUE INDEX unique_compliance_security_policies_framework_id_policy_index ON compliance_framework_security_policies USING btree (framework_id, policy_configuration_id, policy_index) WHERE (security_policy_id IS NULL);

CREATE UNIQUE INDEX unique_compliance_security_policies_security_policy_id ON compliance_framework_security_policies USING btree (security_policy_id, framework_id) WHERE (security_policy_id IS NOT NULL);

CREATE UNIQUE INDEX unique_external_audit_event_destination_namespace_id_and_name ON audit_events_external_audit_event_destinations USING btree (namespace_id, name);

CREATE UNIQUE INDEX unique_google_cloud_logging_configurations_on_namespace_id ON audit_events_google_cloud_logging_configurations USING btree (namespace_id, google_project_id_name, log_id_name);

CREATE UNIQUE INDEX unique_idx_group_destinations_on_name_category_group ON audit_events_group_external_streaming_destinations USING btree (group_id, category, name);

CREATE UNIQUE INDEX unique_idx_instance_destinations_on_name_category ON audit_events_instance_external_streaming_destinations USING btree (category, name);

CREATE UNIQUE INDEX unique_idx_member_approvals_on_pending_status ON member_approvals USING btree (user_id, member_namespace_id) WHERE (status = 0);

CREATE UNIQUE INDEX unique_idx_namespaces_storage_limit_exclusions_on_namespace_id ON namespaces_storage_limit_exclusions USING btree (namespace_id);

CREATE UNIQUE INDEX unique_import_source_users_on_reassign_to_user_id_and_import ON import_source_users USING btree (reassign_to_user_id, namespace_id, source_hostname, import_type);

CREATE UNIQUE INDEX unique_import_source_users_source_identifier_and_import_source ON import_source_users USING btree (source_user_identifier, namespace_id, source_hostname, import_type);

CREATE UNIQUE INDEX unique_index_ci_build_pending_states_on_partition_id_build_id ON ci_build_pending_states USING btree (partition_id, build_id);

CREATE UNIQUE INDEX unique_index_for_credit_card_validation_payment_method_xid ON user_credit_card_validations USING btree (zuora_payment_method_xid) WHERE (zuora_payment_method_xid IS NOT NULL);

CREATE UNIQUE INDEX unique_index_for_project_pages_unique_domain ON project_settings USING btree (pages_unique_domain) WHERE (pages_unique_domain IS NOT NULL);

CREATE UNIQUE INDEX unique_index_group_ms_access_tokens_on_ms_app_id ON system_access_group_microsoft_graph_access_tokens USING btree (system_access_group_microsoft_application_id);

CREATE UNIQUE INDEX unique_index_instance_ms_access_tokens_on_ms_app_id ON system_access_instance_microsoft_graph_access_tokens USING btree (system_access_instance_microsoft_application_id);

CREATE UNIQUE INDEX unique_index_ml_model_metadata_name ON ml_model_metadata USING btree (model_id, name);

CREATE UNIQUE INDEX unique_index_ml_model_version_metadata_name ON ml_model_version_metadata USING btree (model_version_id, name);

CREATE UNIQUE INDEX unique_index_on_system_note_metadata_id ON resource_link_events USING btree (system_note_metadata_id);

CREATE UNIQUE INDEX unique_index_sysaccess_ms_access_tokens_on_sysaccess_ms_app_id ON system_access_microsoft_graph_access_tokens USING btree (system_access_microsoft_application_id);

CREATE UNIQUE INDEX unique_instance_amazon_s3_configurations_bucket_name ON audit_events_instance_amazon_s3_configurations USING btree (bucket_name);

CREATE UNIQUE INDEX unique_instance_amazon_s3_configurations_name ON audit_events_instance_amazon_s3_configurations USING btree (name);

CREATE UNIQUE INDEX unique_instance_audit_event_destination_name ON audit_events_instance_external_audit_event_destinations USING btree (name);

CREATE UNIQUE INDEX unique_instance_google_cloud_logging_configurations ON audit_events_instance_google_cloud_logging_configurations USING btree (google_project_id_name, log_id_name);

CREATE UNIQUE INDEX unique_instance_google_cloud_logging_configurations_name ON audit_events_instance_google_cloud_logging_configurations USING btree (name);

CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);

CREATE INDEX unique_ml_model_versions_on_model_id_and_id ON ml_model_versions USING btree (model_id, id DESC);

CREATE UNIQUE INDEX unique_namespace_cluster_agent_mappings_for_agent_association ON namespace_cluster_agent_mappings USING btree (namespace_id, cluster_agent_id);

CREATE UNIQUE INDEX unique_organization_user_alias_organization_id_user_id ON organization_user_aliases USING btree (organization_id, user_id);

CREATE UNIQUE INDEX unique_organization_user_alias_organization_id_username ON organization_user_aliases USING btree (organization_id, username);

CREATE UNIQUE INDEX unique_organization_user_details_organization_id_user_id ON organization_user_details USING btree (organization_id, user_id);

CREATE UNIQUE INDEX unique_organization_user_details_organization_id_username ON organization_user_details USING btree (organization_id, username);

CREATE UNIQUE INDEX unique_organizations_on_path_case_insensitive ON organizations USING btree (lower(path));

CREATE UNIQUE INDEX unique_packages_project_id_and_name_and_version_when_debian ON packages_packages USING btree (project_id, name, version) WHERE ((package_type = 9) AND (status <> 4));

CREATE UNIQUE INDEX unique_pep_policy_config_links_project_security_policy ON security_pipeline_execution_policy_config_links USING btree (project_id, security_policy_id);

CREATE UNIQUE INDEX unique_pool_repositories_on_disk_path_and_shard_id ON pool_repositories USING btree (disk_path, shard_id);

CREATE UNIQUE INDEX unique_postgres_async_fk_validations_name_and_table_name ON postgres_async_foreign_key_validations USING btree (name, table_name);

CREATE UNIQUE INDEX unique_projects_on_name_namespace_id ON projects USING btree (name, namespace_id);

CREATE UNIQUE INDEX unique_protection_tag_rules_project_id_and_tag_name_pattern ON container_registry_protection_tag_rules USING btree (project_id, tag_name_pattern);

CREATE UNIQUE INDEX unique_scim_group_memberships_user_id_and_scim_group_uid ON scim_group_memberships USING btree (user_id, scim_group_uid);

CREATE UNIQUE INDEX unique_streaming_event_type_filters_destination_id ON audit_events_streaming_event_type_filters USING btree (external_audit_event_destination_id, audit_event_type);

CREATE UNIQUE INDEX unique_streaming_instance_event_type_filters_destination_id ON audit_events_streaming_instance_event_type_filters USING btree (instance_external_audit_event_destination_id, audit_event_type);

CREATE UNIQUE INDEX unique_user_group_member_roles_user_group ON user_group_member_roles USING btree (user_id, group_id) WHERE (shared_with_group_id IS NULL);

CREATE UNIQUE INDEX unique_user_group_member_roles_user_group_shared_with_group ON user_group_member_roles USING btree (user_id, group_id, shared_with_group_id) WHERE (shared_with_group_id IS NOT NULL);

CREATE UNIQUE INDEX unique_user_id_setting_type_and_settings_context_hash ON vs_code_settings USING btree (user_id, setting_type, settings_context_hash);

CREATE UNIQUE INDEX unique_vuln_merge_request_link_vuln_id_and_mr_id ON vulnerability_merge_request_links USING btree (vulnerability_id, merge_request_id);

CREATE UNIQUE INDEX unique_zoekt_enabled_namespaces_on_root_namespace_id ON zoekt_enabled_namespaces USING btree (root_namespace_id);

CREATE INDEX user_follow_users_followee_id_idx ON user_follow_users USING btree (followee_id);

CREATE INDEX user_permission_export_upload_model_id_model_type_uploader__idx ON user_permission_export_upload_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX user_permission_export_upload_uploads_checksum_idx ON user_permission_export_upload_uploads USING btree (checksum);

CREATE INDEX user_permission_export_upload_uploads_namespace_id_idx ON user_permission_export_upload_uploads USING btree (namespace_id);

CREATE INDEX user_permission_export_upload_uploads_organization_id_idx ON user_permission_export_upload_uploads USING btree (organization_id);

CREATE INDEX user_permission_export_upload_uploads_project_id_idx ON user_permission_export_upload_uploads USING btree (project_id);

CREATE INDEX user_permission_export_upload_uploads_store_idx ON user_permission_export_upload_uploads USING btree (store);

CREATE INDEX user_permission_export_upload_uploads_uploaded_by_user_id_idx ON user_permission_export_upload_uploads USING btree (uploaded_by_user_id);

CREATE INDEX user_permission_export_upload_uploads_uploader_path_idx ON user_permission_export_upload_uploads USING btree (uploader, path);

CREATE INDEX user_uploads_checksum_idx ON user_uploads USING btree (checksum);

CREATE INDEX user_uploads_model_id_model_type_uploader_created_at_idx ON user_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX user_uploads_namespace_id_idx ON user_uploads USING btree (namespace_id);

CREATE INDEX user_uploads_organization_id_idx ON user_uploads USING btree (organization_id);

CREATE INDEX user_uploads_project_id_idx ON user_uploads USING btree (project_id);

CREATE INDEX user_uploads_store_idx ON user_uploads USING btree (store);

CREATE INDEX user_uploads_uploaded_by_user_id_idx ON user_uploads USING btree (uploaded_by_user_id);

CREATE INDEX user_uploads_uploader_path_idx ON user_uploads USING btree (uploader, path);

CREATE UNIQUE INDEX virtual_reg_pkgs_mvn_registries_on_unique_group_id_and_name ON virtual_registries_packages_maven_registries USING btree (group_id, name);

CREATE INDEX vulnerability_archive_export__model_id_model_type_uploader__idx ON vulnerability_archive_export_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX vulnerability_archive_export_uploads_checksum_idx ON vulnerability_archive_export_uploads USING btree (checksum);

CREATE INDEX vulnerability_archive_export_uploads_namespace_id_idx ON vulnerability_archive_export_uploads USING btree (namespace_id);

CREATE INDEX vulnerability_archive_export_uploads_organization_id_idx ON vulnerability_archive_export_uploads USING btree (organization_id);

CREATE INDEX vulnerability_archive_export_uploads_project_id_idx ON vulnerability_archive_export_uploads USING btree (project_id);

CREATE INDEX vulnerability_archive_export_uploads_store_idx ON vulnerability_archive_export_uploads USING btree (store);

CREATE INDEX vulnerability_archive_export_uploads_uploaded_by_user_id_idx ON vulnerability_archive_export_uploads USING btree (uploaded_by_user_id);

CREATE INDEX vulnerability_archive_export_uploads_uploader_path_idx ON vulnerability_archive_export_uploads USING btree (uploader, path);

CREATE INDEX vulnerability_export_part_upl_model_id_model_type_uploader__idx ON vulnerability_export_part_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX vulnerability_export_part_uploads_checksum_idx ON vulnerability_export_part_uploads USING btree (checksum);

CREATE INDEX vulnerability_export_part_uploads_namespace_id_idx ON vulnerability_export_part_uploads USING btree (namespace_id);

CREATE INDEX vulnerability_export_part_uploads_organization_id_idx ON vulnerability_export_part_uploads USING btree (organization_id);

CREATE INDEX vulnerability_export_part_uploads_project_id_idx ON vulnerability_export_part_uploads USING btree (project_id);

CREATE INDEX vulnerability_export_part_uploads_store_idx ON vulnerability_export_part_uploads USING btree (store);

CREATE INDEX vulnerability_export_part_uploads_uploaded_by_user_id_idx ON vulnerability_export_part_uploads USING btree (uploaded_by_user_id);

CREATE INDEX vulnerability_export_part_uploads_uploader_path_idx ON vulnerability_export_part_uploads USING btree (uploader, path);

CREATE INDEX vulnerability_export_uploads_checksum_idx ON vulnerability_export_uploads USING btree (checksum);

CREATE INDEX vulnerability_export_uploads_model_id_model_type_uploader_c_idx ON vulnerability_export_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX vulnerability_export_uploads_namespace_id_idx ON vulnerability_export_uploads USING btree (namespace_id);

CREATE INDEX vulnerability_export_uploads_organization_id_idx ON vulnerability_export_uploads USING btree (organization_id);

CREATE INDEX vulnerability_export_uploads_project_id_idx ON vulnerability_export_uploads USING btree (project_id);

CREATE INDEX vulnerability_export_uploads_store_idx ON vulnerability_export_uploads USING btree (store);

CREATE INDEX vulnerability_export_uploads_uploaded_by_user_id_idx ON vulnerability_export_uploads USING btree (uploaded_by_user_id);

CREATE INDEX vulnerability_export_uploads_uploader_path_idx ON vulnerability_export_uploads USING btree (uploader, path);

CREATE INDEX vulnerability_remediation_upl_model_id_model_type_uploader__idx ON vulnerability_remediation_uploads USING btree (model_id, model_type, uploader, created_at);

CREATE INDEX vulnerability_remediation_uploads_checksum_idx ON vulnerability_remediation_uploads USING btree (checksum);

CREATE INDEX vulnerability_remediation_uploads_namespace_id_idx ON vulnerability_remediation_uploads USING btree (namespace_id);

CREATE INDEX vulnerability_remediation_uploads_organization_id_idx ON vulnerability_remediation_uploads USING btree (organization_id);

CREATE INDEX vulnerability_remediation_uploads_project_id_idx ON vulnerability_remediation_uploads USING btree (project_id);

CREATE INDEX vulnerability_remediation_uploads_store_idx ON vulnerability_remediation_uploads USING btree (store);

CREATE INDEX vulnerability_remediation_uploads_uploaded_by_user_id_idx ON vulnerability_remediation_uploads USING btree (uploaded_by_user_id);

CREATE INDEX vulnerability_remediation_uploads_uploader_path_idx ON vulnerability_remediation_uploads USING btree (uploader, path);

CREATE INDEX wi_colors_namespace_id_index ON work_item_colors USING btree (namespace_id);

CREATE INDEX wi_datessources_due_date_sourcing_milestone_id_index ON work_item_dates_sources USING btree (due_date_sourcing_milestone_id);

CREATE INDEX wi_datessources_due_date_sourcing_work_item_id_index ON work_item_dates_sources USING btree (due_date_sourcing_work_item_id);

CREATE INDEX wi_datessources_namespace_id_index ON work_item_dates_sources USING btree (namespace_id);

CREATE INDEX wi_datessources_start_date_sourcing_milestone_id_index ON work_item_dates_sources USING btree (start_date_sourcing_milestone_id);

CREATE INDEX wi_datessources_start_date_sourcing_work_item_id_index ON work_item_dates_sources USING btree (start_date_sourcing_work_item_id);

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30_pkey;

ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30_pkey;

ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31_pkey;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_000925dbd7;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_0051c4d20c;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_006f943df6;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_009e6c1133;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_0264b93cfb;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_02749b504c;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_0287f5ba09;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_03aa30a758;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_055179c3ea;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_061fe00461;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_070cef72c3;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_08b7071d9b;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_08e3cfc564;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_09af45dd6f;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_09fe0c1886;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_0c153e2eae;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_0ca85f3d71;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_0d837a5dda;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_0e98daa03c;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_0f28a65451;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_10588dbff0;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_106d7d97e8;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_1076a9a98a;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_107e123e17;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1230a7a402;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_142c4e7ea4;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_14e4fa1d7d;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_14f3645821;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_16627b455e;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_17fa2812c5;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_19aa18ccc9;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_19f4ed8614;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_1a0388713a;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1a349ed064;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1af932a3c7;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1b0ea30bdb;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_1b47bbbb6a;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1f6c3faabe;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_1f8af04ed1;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_1fa613e160;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_201c5ddbe9;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_20353089e0;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_203dd694bc;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_206349925b;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_208e7ef042;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_2098118748;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_20c6491c6e;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_21db459e34;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_21e262390a;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_2208bd7d7f;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_223592b4a1;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_22acc9ab11;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_22ed8f01dd;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_234d38a657;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_23783dc748;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_241e9a574c;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_2439930f8c;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_2442d1fbd9;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_24ac321751;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_25e2aaee9b;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_2653e7eeb8;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_2745f5a388;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_27739b516b;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_27759556bc;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_27d7ad78d8;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_281840d2d1;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_2945cf4c6d;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_296f64df5c;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2ad4b4fdbc;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2b7c0a294e;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_2bac9d64a0;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2c6422f668;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2dfcdbe81e;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_2e1054b181;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2e6991d05b;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_2f80c360c3;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_2fc271c673;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_2fcfd0dc70;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_3005c75335;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_3206c1e6af;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_3249505125;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_331eb67441;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_34a8b08081;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_3640194b77;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_372160a706;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_389dd3c9fc;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_38a538234e;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_39625b8a41;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_399dc06649;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_3a10b315c0;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3a7d21a6ee;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_3a8848c00b;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3b09ab5902;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3bc2eedca5;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_3c2a3a6ac9;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_3dbde77b8b;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_3e6be332b7;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_4137a6fac3;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_41a1c3a4c6;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_435802dd01;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_436fa9ad5f;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_43aff761b5;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_453a659cb6;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_46b989b294;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_4717e7049b;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_47638677a3;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4810ac88f5;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_482a09e0ee;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_491b4b749e;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4a243772d7;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_4b1793a4c4;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_4b22560035;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4c2645eef2;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_4c9d14f978;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_4d04210a95;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_4d4f2f7de6;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_4db5aa5872;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4dead6f314;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4e6ce1c371;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_4ea50d3a5b;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_4efb1529af;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_4f2eb7a06b;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_4f6fc34e57;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_50272372ba;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5034eae5ff;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_50c09f6e04;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5111e3e7e7;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_52ea79bf8e;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_541cc045fc;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5445e466ee;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_551676e972;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_56281bfb73;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_5660b1b38e;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_584c1e6fb0;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5913107510;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_5968e77935;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_59a8209ab6;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_59ce40fcc4;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_59cfd5bc9a;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5a5f39d824;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5b613b5fcf;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_5b944f308d;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_5bc2f32084;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5bfa62771b;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5c4053b63d;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_5db09170d4;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5e46aea379;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_5e78c2eac1;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5ee060202f;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5f24f6ead2;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_5f96b344e2;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_5fb1867c41;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_5fe1d00845;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_60e3480f23;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_6137e27484;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_620fe77c99;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_625ed9e965;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_64e3a1dfa1;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_64eb4cf8bd;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_6578d04baa;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6580ecb2db;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_66a736da09;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_680d7ab4a6;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_682eba05f6;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_69bdcf213e;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_6a39f6d5ac;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6add8e74cf;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6b1ce61c8f;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_6b431c9952;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_6bf2b9282c;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_6cfb391b86;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_6daa12da84;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_6e560c1a4d;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_6e64aa1646;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6e6c2e6a1d;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_6ea423bbd1;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6ec4c4afd4;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6f4e0abe54;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_6fa47e1334;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_708d792ae9;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_70c657954b;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_713f462d76;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_71c0e45eca;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_71c2b26944;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_72027c157f;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_739845f617;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_74addd1240;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_75dc81d1d7;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_765b0cd8db;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_77096a1dc6;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_77c6293242;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_77f67bf238;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_7822759674;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_7a0b7ffadf;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_7b7c85eceb;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_7da2307d2e;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_7ead2300ca;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_7ecb5b68b4;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_7f543eed8d;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_7f8a80dd47;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_80305b1eed;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_807671c4be;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_807fa83fc0;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_80a81ac235;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_80c65daf20;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_81b31eafac;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_81b9cf594f;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_82c675952c;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_831e7f124f;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_837a193bf2;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_837cc295f1;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_83c5049b3e;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_83edf231b8;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_844abd2888;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_8464227c80;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_8685d7c69c;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_8688b40056;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_876145d1d5;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_87d40fb9f9;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_88b40d6740;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_89c49cf697;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_89c79afe5c;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_8a0fc3de4f;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_8a8eb06b9a;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_8b1b6b03b4;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_8b9f9a19a4;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_8c8835ac5e;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_8fb48e72ce;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_907e12b7ba;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_918bb2ebbb;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_91c432a4bd;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_91d5e4e3df;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_9201b952a0;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_927796f71d;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_92c09e352b;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_9490e0e0b7;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_9555c2ae92;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_95a353f50b;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_971af9481e;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_994aa245b7;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_9955b1dc59;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_9a2eb72a3b;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_9b8e89ae41;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_9d0e953ab3;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_9ee83b068b;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_a016d4ed08;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a1a9dc36c1;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a2d9f185a5;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a3feed3097;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_a46b7b7f26;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_a4f5106804;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_a5d8ab0218;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a6999c65c9;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_a6c68d16b2;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_a8276a450f;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_a849f1bbcc;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a88f20fc98;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_a8fe03fe34;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a9424aa392;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_a99cee1904;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_a9b1763c36;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_a9ba23c88e;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_a9deff2159;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_aa92d75d85;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_aabc184267;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_ab22231a16;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_abbdf80ab1;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_aca42d7cff;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ad55e8b11c;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_adc159c3fe;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_aed7f7b10c;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_aee84adb5b;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_af8368d587;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_b1dda405af;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b24e8538c8;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b286c595e8;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b377ac6784;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b3b64068e7;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b3c4c9a53f;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_b4b2bba753;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_b607012614;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b6cc38a848;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_b748a3e0a6;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_b7f21460bb;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_b83fe1306b;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_bb41d5837a;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_bb6defaa27;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_bc189e47ab;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_bca83177ef;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_bcaa8dcd34;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_bcae2cf631;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_be0a028bcc;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_beaa329ca0;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_bedd7e160b;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_bee2b94a80;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_bf1809b19e;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_c02f569fba;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c08e669dfa;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c09bb66559;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_c119f5b92e;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c17dae3605;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c1cdd90d0d;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_c2b951bf20;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_c3a2cf8b3b;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c42b2e7eae;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c435d904ce;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c473921734;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c546bb0736;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c59cde6209;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c66758baa7;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c6ea8a0e26;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_c7ac8595d3;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_c7fa6f402d;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_c8bbf2b334;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_c8c4219c0a;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_c971e6c5ce;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_c9b14a3d9f;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_cb0e4510aa;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_cb222425ed;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_cbb61ea269;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_cc0ba6343b;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ccb4f5c5a6;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_cd2b2939a4;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_cda41e106e;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ce87cbaf2d;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_cfa4237c83;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_d01ea0126a;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d03e9cdfae;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_d0d285c264;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d17b82ddd9;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d1c24d8199;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_d1c6c67ec1;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d27b4c84e7;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d2fe918e83;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d35c969634;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_d3b6418940;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d493a5c171;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_d6047ee813;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_d69c2485f4;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_d70379e22c;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_d87775b2e7;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_d8fa9793ad;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_d9384b768d;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_db2753330c;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_db6477916f;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_dc571ba649;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_dc7ca9eb1d;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_de0334da63;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_df62a8c50e;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_e1a4f994d8;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_e38489ea98;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_e3d1fd5b19;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_e3d6234929;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_e54adf9acb;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_e6405afea0;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_e64588e276;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_e716b8ac3f;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_e73bc5ba6a;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_e8f3a327b2;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_ea0c2d3361;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ea1b583157;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_eadcc94c4e;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_eb558957f0;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_eb5a7f918a;

ALTER INDEX index_merge_request_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_ec25d494e6;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ece25b5987;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_ed094a4f13;

ALTER INDEX index_issue_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_ed6dbac8c0;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_ee4c549a2d;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_ef6a48bd29;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_ef7be2ae94;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_efa25b26bd;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f06b4c7a23;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f0cdd09a5e;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f112fae8ac;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f1c3d14cdc;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f256d3f6a1;

ALTER INDEX index_issue_stage_events_group_duration ATTACH PARTITION gitlab_partitions_static.index_f2848acfc7;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f3d7d86e09;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f402f6a388;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f415dc2abd;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f47327ec1f;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_uniq_object_storage_key ATTACH PARTITION gitlab_partitions_static.index_f586c952e6;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f5f0e8eefd;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_f6b0d458a3;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f705dc8541;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f76e8a5304;

ALTER INDEX index_issue_search_data_on_namespace_id ATTACH PARTITION gitlab_partitions_static.index_f836021e1e;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f86acdc2ff;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_f86f73056d;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f878aab8e3;

ALTER INDEX index_issue_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_f902c261ce;

ALTER INDEX index_mr_stage_events_for_consistency_check ATTACH PARTITION gitlab_partitions_static.index_f91599d825;

ALTER INDEX index_merge_request_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_fbccc855cf;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_fbf2d3310b;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_fccbe45c32;

ALTER INDEX index_merge_request_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_fee429223e;

ALTER INDEX index_merge_request_stage_events_project_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_ff00c038cc;

ALTER INDEX index_issue_stage_events_project_duration ATTACH PARTITION gitlab_partitions_static.index_ff39be5400;

ALTER INDEX index_issue_stage_events_group_in_progress_duration ATTACH PARTITION gitlab_partitions_static.index_ff8741d8d7;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_00_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_00_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_00_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_01_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_01_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_01_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_02_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_02_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_02_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_03_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_03_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_03_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_04_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_04_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_04_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_05_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_05_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_05_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_06_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_06_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_06_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_07_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_07_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_07_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_08_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_08_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_08_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_09_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_09_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_09_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_10_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_10_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_10_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_11_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_11_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_11_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_12_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_12_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_12_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_13_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_13_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_13_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_14_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_14_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_14_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_15_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_15_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_15_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_16_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_16_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_16_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_17_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_17_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_17_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_18_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_18_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_18_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_19_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_19_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_19_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_20_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_20_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_20_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_21_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_21_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_21_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_22_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_22_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_22_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_23_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_23_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_23_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_24_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_24_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_24_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_25_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_25_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_25_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_26_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_26_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_26_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_27_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_27_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_27_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_28_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_28_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_28_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_29_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_29_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_29_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_30_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_30_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_30_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_31_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_31_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_31_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_32_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_32_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_32_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_33_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_33_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_33_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_34_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_34_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_34_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_35_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_35_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_35_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_36_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_36_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_36_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_37_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_37_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_37_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_38_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_38_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_38_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_39_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_39_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_39_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_40_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_40_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_40_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_41_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_41_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_41_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_42_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_42_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_42_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_43_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_43_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_43_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_44_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_44_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_44_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_45_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_45_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_45_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_46_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_46_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_46_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_47_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_47_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_47_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_48_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_48_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_48_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_49_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_49_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_49_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_50_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_50_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_50_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_51_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_51_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_51_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_52_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_52_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_52_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_53_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_53_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_53_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_54_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_54_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_54_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_55_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_55_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_55_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_56_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_56_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_56_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_57_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_57_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_57_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_58_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_58_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_58_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_59_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_59_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_59_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_60_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_60_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_60_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_61_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_61_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_61_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_62_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_62_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_62_search_vector_idx;

ALTER INDEX index_issue_search_data_on_issue_id ATTACH PARTITION gitlab_partitions_static.issue_search_data_63_issue_id_idx;

ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.issue_search_data_63_pkey;

ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_63_search_vector_idx;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_00_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_00_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_01_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_01_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_02_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_02_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_03_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_03_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_04_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_04_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_05_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_05_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_06_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_06_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_07_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_07_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_08_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_08_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_09_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_09_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_10_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_10_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_11_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_11_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_12_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_12_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_13_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_13_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_14_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_14_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_15_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_15_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_16_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_16_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_17_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_17_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_18_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_18_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_19_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_19_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_20_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_20_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_21_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_21_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_22_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_22_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_23_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_23_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_24_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_24_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_25_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_25_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_26_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_26_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_27_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_27_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_28_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_28_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_29_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_29_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_30_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_30_pkey;

ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_31_namespace_id_idx;

ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_31_pkey;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mav_upstream_id_relative_path_idx10;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mav_upstream_id_relative_path_idx11;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mav_upstream_id_relative_path_idx12;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mav_upstream_id_relative_path_idx13;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mav_upstream_id_relative_path_idx14;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mav_upstream_id_relative_path_idx15;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx1;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx2;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx3;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx4;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx5;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx6;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx7;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx8;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_mave_upstream_id_relative_path_idx9;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven__upstream_id_created_at_idx10;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven__upstream_id_created_at_idx11;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven__upstream_id_created_at_idx12;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven__upstream_id_created_at_idx13;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven__upstream_id_created_at_idx14;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven__upstream_id_created_at_idx15;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx1;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx2;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx3;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx4;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx5;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx6;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx7;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx8;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_c_upstream_id_created_at_idx9;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_created_at ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_ca_upstream_id_created_at_idx;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_e_group_id_status_idx10;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_e_group_id_status_idx11;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_e_group_id_status_idx12;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_e_group_id_status_idx13;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_e_group_id_status_idx14;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_e_group_id_status_idx15;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx1;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx2;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx3;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx4;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx5;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx6;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx7;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx8;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_en_group_id_status_idx9;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_group_id_status ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_group_id_status_idx;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_relative_path_idx10;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_relative_path_idx11;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_relative_path_idx12;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_relative_path_idx13;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_relative_path_idx14;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_ent_relative_path_idx15;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx1;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx2;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx3;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx4;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx5;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx6;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx7;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx8;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entr_relative_path_idx9;

ALTER INDEX idx_vreg_pkgs_maven_cache_entries_on_relative_path_trigram ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entri_relative_path_idx;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_00_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_01_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_02_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_03_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_04_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_05_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_06_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_07_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_08_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_09_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_10_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_11_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_12_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_13_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_14_pkey;

ALTER INDEX virtual_registries_packages_maven_cache_entries_pkey ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_cache_entries_15_pkey;

ALTER INDEX idx_vregs_pkgs_mvn_cache_entries_on_pending_upt_id_relpath ATTACH PARTITION gitlab_partitions_static.virtual_registries_packages_maven_upstream_id_relative_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION abuse_report_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION abuse_report_uploads_model_id_model_type_uploader_created_a_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION abuse_report_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION abuse_report_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION abuse_report_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION abuse_report_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION abuse_report_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION abuse_report_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION abuse_report_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION achievement_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION achievement_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION achievement_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION achievement_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION achievement_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION achievement_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION achievement_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION achievement_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION achievement_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION ai_vectorizable_file_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION ai_vectorizable_file_uploads_model_id_model_type_uploader_c_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION ai_vectorizable_file_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION ai_vectorizable_file_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION ai_vectorizable_file_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION ai_vectorizable_file_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION ai_vectorizable_file_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION ai_vectorizable_file_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION ai_vectorizable_file_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION alert_management_alert_metric_image_upl_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION alert_management_alert_metric_image_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION alert_management_alert_metric_image_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION alert_management_alert_metric_image_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION alert_management_alert_metric_image_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION alert_management_alert_metric_image_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION alert_management_alert_metric_image_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION alert_management_alert_metric_image_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION alert_management_alert_metric_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION appearance_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION appearance_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION appearance_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION appearance_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION appearance_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION appearance_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION appearance_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION appearance_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION appearance_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION bulk_import_export_upload_upl_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION bulk_import_export_upload_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION bulk_import_export_upload_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION bulk_import_export_upload_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION bulk_import_export_upload_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION bulk_import_export_upload_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION bulk_import_export_upload_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION bulk_import_export_upload_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION bulk_import_export_upload_uploads_uploader_path_idx;

ALTER INDEX ci_runner_taggings_pkey ATTACH PARTITION ci_runner_taggings_group_type_pkey;

ALTER INDEX index_ci_runner_taggings_on_runner_id_and_runner_type ATTACH PARTITION ci_runner_taggings_group_type_runner_id_runner_type_idx;

ALTER INDEX index_ci_runner_taggings_on_sharding_key_id ATTACH PARTITION ci_runner_taggings_group_type_sharding_key_id_idx;

ALTER INDEX index_ci_runner_taggings_on_tag_id_runner_id_and_runner_type ATTACH PARTITION ci_runner_taggings_group_type_tag_id_runner_id_runner_type_idx;

ALTER INDEX index_ci_runner_taggings_on_tag_id_runner_id_and_runner_type ATTACH PARTITION ci_runner_taggings_instance_ty_tag_id_runner_id_runner_type_idx;

ALTER INDEX ci_runner_taggings_pkey ATTACH PARTITION ci_runner_taggings_instance_type_pkey;

ALTER INDEX index_ci_runner_taggings_on_runner_id_and_runner_type ATTACH PARTITION ci_runner_taggings_instance_type_runner_id_runner_type_idx;

ALTER INDEX index_ci_runner_taggings_on_sharding_key_id ATTACH PARTITION ci_runner_taggings_instance_type_sharding_key_id_idx;

ALTER INDEX index_ci_runner_taggings_on_tag_id_runner_id_and_runner_type ATTACH PARTITION ci_runner_taggings_project_typ_tag_id_runner_id_runner_type_idx;

ALTER INDEX ci_runner_taggings_pkey ATTACH PARTITION ci_runner_taggings_project_type_pkey;

ALTER INDEX index_ci_runner_taggings_on_runner_id_and_runner_type ATTACH PARTITION ci_runner_taggings_project_type_runner_id_runner_type_idx;

ALTER INDEX index_ci_runner_taggings_on_sharding_key_id ATTACH PARTITION ci_runner_taggings_project_type_sharding_key_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION dependency_list_export_part_u_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION dependency_list_export_part_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION dependency_list_export_part_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION dependency_list_export_part_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION dependency_list_export_part_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION dependency_list_export_part_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION dependency_list_export_part_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION dependency_list_export_part_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION dependency_list_export_part_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION dependency_list_export_upload_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION dependency_list_export_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION dependency_list_export_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION dependency_list_export_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION dependency_list_export_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION dependency_list_export_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION dependency_list_export_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION dependency_list_export_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION dependency_list_export_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION design_management_action_uplo_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION design_management_action_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION design_management_action_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION design_management_action_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION design_management_action_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION design_management_action_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION design_management_action_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION design_management_action_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION design_management_action_uploads_uploader_path_idx;

ALTER INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ATTACH PARTITION group_type_ci_runner_machines_687967fa8a_contacted_at_id_idx;

ALTER INDEX index_ci_runner_machines_on_created_at_and_id_desc ATTACH PARTITION group_type_ci_runner_machines_687967fa8a_created_at_id_idx;

ALTER INDEX index_ci_runner_machines_on_sharding_key_id_when_not_null ATTACH PARTITION group_type_ci_runner_machines_687967fa8a_sharding_key_id_idx;

ALTER INDEX index_ci_runner_machines_on_version ATTACH PARTITION group_type_ci_runner_machines_687967fa8a_version_idx;

ALTER INDEX index_ci_runner_machines_on_major_version ATTACH PARTITION group_type_ci_runner_machines_6_substring_version_runner_id_idx;

ALTER INDEX index_ci_runner_machines_on_minor_version ATTACH PARTITION group_type_ci_runner_machines__substring_version_runner_id_idx1;

ALTER INDEX index_ci_runner_machines_on_patch_version ATTACH PARTITION group_type_ci_runner_machines__substring_version_runner_id_idx2;

ALTER INDEX ci_runner_machines_pkey ATTACH PARTITION group_type_ci_runner_machines_pkey;

ALTER INDEX index_ci_runner_machines_on_runner_id_and_type_and_system_xid ATTACH PARTITION group_type_ci_runner_machines_runner_id_runner_type_system__idx;

ALTER INDEX index_ci_runners_on_token_encrypted_and_runner_type ATTACH PARTITION group_type_ci_runners_e59bb2812_token_encrypted_runner_type_idx;

ALTER INDEX index_ci_runners_on_active_and_id ATTACH PARTITION group_type_ci_runners_e59bb2812d_active_id_idx;

ALTER INDEX index_ci_runners_on_contacted_at_and_id_desc ATTACH PARTITION group_type_ci_runners_e59bb2812d_contacted_at_id_idx;

ALTER INDEX index_ci_runners_on_contacted_at_and_id_where_inactive ATTACH PARTITION group_type_ci_runners_e59bb2812d_contacted_at_id_idx1;

ALTER INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ATTACH PARTITION group_type_ci_runners_e59bb2812d_contacted_at_id_idx2;

ALTER INDEX index_ci_runners_on_created_at_and_id_desc ATTACH PARTITION group_type_ci_runners_e59bb2812d_created_at_id_idx;

ALTER INDEX index_ci_runners_on_created_at_and_id_where_inactive ATTACH PARTITION group_type_ci_runners_e59bb2812d_created_at_id_idx1;

ALTER INDEX index_ci_runners_on_created_at_desc_and_id_desc ATTACH PARTITION group_type_ci_runners_e59bb2812d_created_at_id_idx2;

ALTER INDEX index_ci_runners_on_creator_id_where_creator_id_not_null ATTACH PARTITION group_type_ci_runners_e59bb2812d_creator_id_idx;

ALTER INDEX index_ci_runners_on_description_trigram ATTACH PARTITION group_type_ci_runners_e59bb2812d_description_idx;

ALTER INDEX index_ci_runners_on_locked ATTACH PARTITION group_type_ci_runners_e59bb2812d_locked_idx;

ALTER INDEX index_ci_runners_on_sharding_key_id_when_not_null ATTACH PARTITION group_type_ci_runners_e59bb2812d_sharding_key_id_idx;

ALTER INDEX index_ci_runners_on_token_expires_at_and_id_desc ATTACH PARTITION group_type_ci_runners_e59bb2812d_token_expires_at_id_idx;

ALTER INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ATTACH PARTITION group_type_ci_runners_e59bb2812d_token_expires_at_id_idx1;

ALTER INDEX index_ci_runners_on_token_and_runner_type_when_token_not_null ATTACH PARTITION group_type_ci_runners_e59bb2812d_token_runner_type_idx;

ALTER INDEX ci_runners_pkey ATTACH PARTITION group_type_ci_runners_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION import_export_upload_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION import_export_upload_uploads_model_id_model_type_uploader_c_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION import_export_upload_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION import_export_upload_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION import_export_upload_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION import_export_upload_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION import_export_upload_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION import_export_upload_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION import_export_upload_uploads_uploader_path_idx;

ALTER INDEX index_ci_runner_machines_on_executor_type ATTACH PARTITION index_012094097c;

ALTER INDEX index_ci_runner_taggings_on_organization_id ATTACH PARTITION index_03bce7b65b;

ALTER INDEX index_ci_runner_machines_on_ip_address ATTACH PARTITION index_053d12f7ee;

ALTER INDEX index_ci_runners_on_organization_id ATTACH PARTITION index_11eb9d1747;

ALTER INDEX index_ci_runner_machines_on_organization_id ATTACH PARTITION index_8cc4cbb7d2;

ALTER INDEX index_ci_runner_taggings_on_organization_id ATTACH PARTITION index_8f3cd552cd;

ALTER INDEX index_ci_runners_on_organization_id ATTACH PARTITION index_92f173730f;

ALTER INDEX index_ci_runner_taggings_on_organization_id ATTACH PARTITION index_934f0e59cf;

ALTER INDEX index_ci_runners_on_organization_id ATTACH PARTITION index_a3343eff0d;

ALTER INDEX index_ci_runner_machines_on_executor_type ATTACH PARTITION index_aa3b4fe8c6;

ALTER INDEX index_ci_runner_machines_on_ip_address ATTACH PARTITION index_d2746151f0;

ALTER INDEX index_ci_runner_machines_on_executor_type ATTACH PARTITION index_d58435d85e;

ALTER INDEX index_ci_runner_machines_on_organization_id ATTACH PARTITION index_e4459c2bb7;

ALTER INDEX index_ci_runner_machines_on_ip_address ATTACH PARTITION index_ee7c87e634;

ALTER INDEX index_ci_runner_machines_on_organization_id ATTACH PARTITION index_f4903d2246;

ALTER INDEX index_ci_runner_machines_on_runner_id_and_type_and_system_xid ATTACH PARTITION instance_type_ci_runner_machi_runner_id_runner_type_system__idx;

ALTER INDEX index_ci_runner_machines_on_minor_version ATTACH PARTITION instance_type_ci_runner_machin_substring_version_runner_id_idx1;

ALTER INDEX index_ci_runner_machines_on_patch_version ATTACH PARTITION instance_type_ci_runner_machin_substring_version_runner_id_idx2;

ALTER INDEX index_ci_runner_machines_on_major_version ATTACH PARTITION instance_type_ci_runner_machine_substring_version_runner_id_idx;

ALTER INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ATTACH PARTITION instance_type_ci_runner_machines_687967fa8a_contacted_at_id_idx;

ALTER INDEX index_ci_runner_machines_on_created_at_and_id_desc ATTACH PARTITION instance_type_ci_runner_machines_687967fa8a_created_at_id_idx;

ALTER INDEX index_ci_runner_machines_on_sharding_key_id_when_not_null ATTACH PARTITION instance_type_ci_runner_machines_687967fa8a_sharding_key_id_idx;

ALTER INDEX index_ci_runner_machines_on_version ATTACH PARTITION instance_type_ci_runner_machines_687967fa8a_version_idx;

ALTER INDEX ci_runner_machines_pkey ATTACH PARTITION instance_type_ci_runner_machines_pkey;

ALTER INDEX index_ci_runners_on_active_and_id ATTACH PARTITION instance_type_ci_runners_e59bb2812d_active_id_idx;

ALTER INDEX index_ci_runners_on_contacted_at_and_id_desc ATTACH PARTITION instance_type_ci_runners_e59bb2812d_contacted_at_id_idx;

ALTER INDEX index_ci_runners_on_contacted_at_and_id_where_inactive ATTACH PARTITION instance_type_ci_runners_e59bb2812d_contacted_at_id_idx1;

ALTER INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ATTACH PARTITION instance_type_ci_runners_e59bb2812d_contacted_at_id_idx2;

ALTER INDEX index_ci_runners_on_created_at_and_id_desc ATTACH PARTITION instance_type_ci_runners_e59bb2812d_created_at_id_idx;

ALTER INDEX index_ci_runners_on_created_at_and_id_where_inactive ATTACH PARTITION instance_type_ci_runners_e59bb2812d_created_at_id_idx1;

ALTER INDEX index_ci_runners_on_created_at_desc_and_id_desc ATTACH PARTITION instance_type_ci_runners_e59bb2812d_created_at_id_idx2;

ALTER INDEX index_ci_runners_on_creator_id_where_creator_id_not_null ATTACH PARTITION instance_type_ci_runners_e59bb2812d_creator_id_idx;

ALTER INDEX index_ci_runners_on_description_trigram ATTACH PARTITION instance_type_ci_runners_e59bb2812d_description_idx;

ALTER INDEX index_ci_runners_on_locked ATTACH PARTITION instance_type_ci_runners_e59bb2812d_locked_idx;

ALTER INDEX index_ci_runners_on_sharding_key_id_when_not_null ATTACH PARTITION instance_type_ci_runners_e59bb2812d_sharding_key_id_idx;

ALTER INDEX index_ci_runners_on_token_expires_at_and_id_desc ATTACH PARTITION instance_type_ci_runners_e59bb2812d_token_expires_at_id_idx;

ALTER INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ATTACH PARTITION instance_type_ci_runners_e59bb2812d_token_expires_at_id_idx1;

ALTER INDEX index_ci_runners_on_token_and_runner_type_when_token_not_null ATTACH PARTITION instance_type_ci_runners_e59bb2812d_token_runner_type_idx;

ALTER INDEX index_ci_runners_on_token_encrypted_and_runner_type ATTACH PARTITION instance_type_ci_runners_e59bb2_token_encrypted_runner_type_idx;

ALTER INDEX ci_runners_pkey ATTACH PARTITION instance_type_ci_runners_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION issuable_metric_image_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION issuable_metric_image_uploads_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION issuable_metric_image_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION issuable_metric_image_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION issuable_metric_image_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION issuable_metric_image_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION issuable_metric_image_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION issuable_metric_image_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION issuable_metric_image_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION namespace_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION namespace_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION namespace_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION namespace_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION namespace_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION namespace_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION namespace_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION namespace_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION namespace_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION note_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION note_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION note_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION note_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION note_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION note_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION note_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION note_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION note_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION organization_detail_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION organization_detail_uploads_model_id_model_type_uploader_cr_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION organization_detail_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION organization_detail_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION organization_detail_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION organization_detail_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION organization_detail_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION organization_detail_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION organization_detail_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION project_import_export_relatio_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION project_import_export_relation_export_u_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION project_import_export_relation_export_uploa_organization_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION project_import_export_relation_export_upload__uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION project_import_export_relation_export_upload_u_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION project_import_export_relation_export_upload_upl_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION project_import_export_relation_export_upload_uploa_checksum_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION project_import_export_relation_export_upload_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION project_import_export_relation_export_upload_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION project_topic_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION project_topic_uploads_model_id_model_type_uploader_created__idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION project_topic_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION project_topic_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION project_topic_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION project_topic_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION project_topic_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION project_topic_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION project_topic_uploads_uploader_path_idx;

ALTER INDEX index_ci_runner_machines_on_runner_id_and_type_and_system_xid ATTACH PARTITION project_type_ci_runner_machin_runner_id_runner_type_system__idx;

ALTER INDEX index_ci_runner_machines_on_minor_version ATTACH PARTITION project_type_ci_runner_machine_substring_version_runner_id_idx1;

ALTER INDEX index_ci_runner_machines_on_patch_version ATTACH PARTITION project_type_ci_runner_machine_substring_version_runner_id_idx2;

ALTER INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ATTACH PARTITION project_type_ci_runner_machines_687967fa8a_contacted_at_id_idx;

ALTER INDEX index_ci_runner_machines_on_created_at_and_id_desc ATTACH PARTITION project_type_ci_runner_machines_687967fa8a_created_at_id_idx;

ALTER INDEX index_ci_runner_machines_on_sharding_key_id_when_not_null ATTACH PARTITION project_type_ci_runner_machines_687967fa8a_sharding_key_id_idx;

ALTER INDEX index_ci_runner_machines_on_version ATTACH PARTITION project_type_ci_runner_machines_687967fa8a_version_idx;

ALTER INDEX ci_runner_machines_pkey ATTACH PARTITION project_type_ci_runner_machines_pkey;

ALTER INDEX index_ci_runner_machines_on_major_version ATTACH PARTITION project_type_ci_runner_machines_substring_version_runner_id_idx;

ALTER INDEX index_ci_runners_on_active_and_id ATTACH PARTITION project_type_ci_runners_e59bb2812d_active_id_idx;

ALTER INDEX index_ci_runners_on_contacted_at_and_id_desc ATTACH PARTITION project_type_ci_runners_e59bb2812d_contacted_at_id_idx;

ALTER INDEX index_ci_runners_on_contacted_at_and_id_where_inactive ATTACH PARTITION project_type_ci_runners_e59bb2812d_contacted_at_id_idx1;

ALTER INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ATTACH PARTITION project_type_ci_runners_e59bb2812d_contacted_at_id_idx2;

ALTER INDEX index_ci_runners_on_created_at_and_id_desc ATTACH PARTITION project_type_ci_runners_e59bb2812d_created_at_id_idx;

ALTER INDEX index_ci_runners_on_created_at_and_id_where_inactive ATTACH PARTITION project_type_ci_runners_e59bb2812d_created_at_id_idx1;

ALTER INDEX index_ci_runners_on_created_at_desc_and_id_desc ATTACH PARTITION project_type_ci_runners_e59bb2812d_created_at_id_idx2;

ALTER INDEX index_ci_runners_on_creator_id_where_creator_id_not_null ATTACH PARTITION project_type_ci_runners_e59bb2812d_creator_id_idx;

ALTER INDEX index_ci_runners_on_description_trigram ATTACH PARTITION project_type_ci_runners_e59bb2812d_description_idx;

ALTER INDEX index_ci_runners_on_locked ATTACH PARTITION project_type_ci_runners_e59bb2812d_locked_idx;

ALTER INDEX index_ci_runners_on_sharding_key_id_when_not_null ATTACH PARTITION project_type_ci_runners_e59bb2812d_sharding_key_id_idx;

ALTER INDEX index_ci_runners_on_token_expires_at_and_id_desc ATTACH PARTITION project_type_ci_runners_e59bb2812d_token_expires_at_id_idx;

ALTER INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ATTACH PARTITION project_type_ci_runners_e59bb2812d_token_expires_at_id_idx1;

ALTER INDEX index_ci_runners_on_token_and_runner_type_when_token_not_null ATTACH PARTITION project_type_ci_runners_e59bb2812d_token_runner_type_idx;

ALTER INDEX index_ci_runners_on_token_encrypted_and_runner_type ATTACH PARTITION project_type_ci_runners_e59bb28_token_encrypted_runner_type_idx;

ALTER INDEX ci_runners_pkey ATTACH PARTITION project_type_ci_runners_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION project_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION project_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION project_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION project_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION project_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION project_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION project_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION project_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION project_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION snippet_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION snippet_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION snippet_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION snippet_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION snippet_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION snippet_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION snippet_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION snippet_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION snippet_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION user_permission_export_upload_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION user_permission_export_upload_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION user_permission_export_upload_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION user_permission_export_upload_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION user_permission_export_upload_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION user_permission_export_upload_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION user_permission_export_upload_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION user_permission_export_upload_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION user_permission_export_upload_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION user_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION user_uploads_model_id_model_type_uploader_created_at_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION user_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION user_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION user_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION user_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION user_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION user_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION user_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION vulnerability_archive_export__model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION vulnerability_archive_export_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION vulnerability_archive_export_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION vulnerability_archive_export_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION vulnerability_archive_export_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION vulnerability_archive_export_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION vulnerability_archive_export_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION vulnerability_archive_export_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION vulnerability_archive_export_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION vulnerability_export_part_upl_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION vulnerability_export_part_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION vulnerability_export_part_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION vulnerability_export_part_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION vulnerability_export_part_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION vulnerability_export_part_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION vulnerability_export_part_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION vulnerability_export_part_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION vulnerability_export_part_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION vulnerability_export_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION vulnerability_export_uploads_model_id_model_type_uploader_c_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION vulnerability_export_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION vulnerability_export_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION vulnerability_export_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION vulnerability_export_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION vulnerability_export_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION vulnerability_export_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION vulnerability_export_uploads_uploader_path_idx;

ALTER INDEX index_uploads_9ba88c4165_on_model_uploader_created_at ATTACH PARTITION vulnerability_remediation_upl_model_id_model_type_uploader__idx;

ALTER INDEX index_uploads_9ba88c4165_on_checksum ATTACH PARTITION vulnerability_remediation_uploads_checksum_idx;

ALTER INDEX index_uploads_9ba88c4165_on_namespace_id ATTACH PARTITION vulnerability_remediation_uploads_namespace_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_organization_id ATTACH PARTITION vulnerability_remediation_uploads_organization_id_idx;

ALTER INDEX uploads_9ba88c4165_pkey ATTACH PARTITION vulnerability_remediation_uploads_pkey;

ALTER INDEX index_uploads_9ba88c4165_on_project_id ATTACH PARTITION vulnerability_remediation_uploads_project_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_store ATTACH PARTITION vulnerability_remediation_uploads_store_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploaded_by_user_id ATTACH PARTITION vulnerability_remediation_uploads_uploaded_by_user_id_idx;

ALTER INDEX index_uploads_9ba88c4165_on_uploader_and_path ATTACH PARTITION vulnerability_remediation_uploads_uploader_path_idx;

CREATE TRIGGER ai_active_context_connections_loose_fk_trigger AFTER DELETE ON ai_active_context_connections REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER ai_conversation_threads_loose_fk_trigger AFTER DELETE ON ai_conversation_threads REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER approval_policy_rules_loose_fk_trigger AFTER DELETE ON approval_policy_rules REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER assign_ci_runner_machines_id_trigger BEFORE INSERT ON ci_runner_machines FOR EACH ROW EXECUTE FUNCTION assign_ci_runner_machines_id_value();

CREATE TRIGGER assign_ci_runner_taggings_id_trigger BEFORE INSERT ON ci_runner_taggings FOR EACH ROW EXECUTE FUNCTION assign_ci_runner_taggings_id_value();

CREATE TRIGGER assign_ci_runners_id_trigger BEFORE INSERT ON ci_runners FOR EACH ROW EXECUTE FUNCTION assign_ci_runners_id_value();

CREATE TRIGGER assign_p_ci_build_tags_id_trigger BEFORE INSERT ON p_ci_build_tags FOR EACH ROW EXECUTE FUNCTION assign_p_ci_build_tags_id_value();

CREATE TRIGGER assign_p_ci_builds_execution_configs_id_trigger BEFORE INSERT ON p_ci_builds_execution_configs FOR EACH ROW EXECUTE FUNCTION assign_p_ci_builds_execution_configs_id_value();

CREATE TRIGGER assign_p_ci_builds_id_trigger BEFORE INSERT ON p_ci_builds FOR EACH ROW EXECUTE FUNCTION assign_p_ci_builds_id_value();

CREATE TRIGGER assign_p_ci_job_annotations_id_trigger BEFORE INSERT ON p_ci_job_annotations FOR EACH ROW EXECUTE FUNCTION assign_p_ci_job_annotations_id_value();

CREATE TRIGGER assign_p_ci_job_artifacts_id_trigger BEFORE INSERT ON p_ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION assign_p_ci_job_artifacts_id_value();

CREATE TRIGGER assign_p_ci_pipeline_variables_id_trigger BEFORE INSERT ON p_ci_pipeline_variables FOR EACH ROW EXECUTE FUNCTION assign_p_ci_pipeline_variables_id_value();

CREATE TRIGGER assign_p_ci_pipelines_id_trigger BEFORE INSERT ON p_ci_pipelines FOR EACH ROW EXECUTE FUNCTION assign_p_ci_pipelines_id_value();

CREATE TRIGGER assign_p_ci_stages_id_trigger BEFORE INSERT ON p_ci_stages FOR EACH ROW EXECUTE FUNCTION assign_p_ci_stages_id_value();

CREATE TRIGGER assign_p_duo_workflows_checkpoints_id_trigger BEFORE INSERT ON p_duo_workflows_checkpoints FOR EACH ROW EXECUTE FUNCTION assign_p_duo_workflows_checkpoints_id_value();

CREATE TRIGGER assign_p_knowledge_graph_tasks_id_trigger BEFORE INSERT ON p_knowledge_graph_tasks FOR EACH ROW EXECUTE FUNCTION assign_p_knowledge_graph_tasks_id_value();

CREATE TRIGGER assign_zoekt_tasks_id_trigger BEFORE INSERT ON zoekt_tasks FOR EACH ROW EXECUTE FUNCTION assign_zoekt_tasks_id_value();

CREATE TRIGGER chat_names_loose_fk_trigger AFTER DELETE ON chat_names REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER ci_runner_machines_loose_fk_trigger AFTER DELETE ON ci_runner_machines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runner_machines');

CREATE TRIGGER ci_runners_loose_fk_trigger AFTER DELETE ON ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runners');

CREATE TRIGGER ci_triggers_loose_fk_trigger AFTER DELETE ON ci_triggers REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER cluster_agents_loose_fk_trigger AFTER DELETE ON cluster_agents REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER clusters_loose_fk_trigger AFTER DELETE ON clusters REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER group_type_ci_runner_machines_loose_fk_trigger AFTER DELETE ON group_type_ci_runner_machines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runner_machines');

CREATE TRIGGER group_type_ci_runners_loose_fk_trigger AFTER DELETE ON group_type_ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runners');

CREATE TRIGGER instance_type_ci_runner_machines_loose_fk_trigger AFTER DELETE ON instance_type_ci_runner_machines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runner_machines');

CREATE TRIGGER instance_type_ci_runners_loose_fk_trigger AFTER DELETE ON instance_type_ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runners');

CREATE TRIGGER issues_loose_fk_trigger AFTER DELETE ON issues REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER lfs_objects_loose_fk_trigger AFTER DELETE ON lfs_objects REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER merge_requests_loose_fk_trigger AFTER DELETE ON merge_requests REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER namespaces_loose_fk_trigger AFTER DELETE ON namespaces REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER notes_loose_fk_trigger AFTER DELETE ON notes REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER nullify_merge_request_metrics_build_data_on_update BEFORE UPDATE ON merge_request_metrics FOR EACH ROW EXECUTE FUNCTION nullify_merge_request_metrics_build_data();

CREATE TRIGGER organizations_loose_fk_trigger AFTER DELETE ON organizations REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER p_ai_active_context_code_enabled_namespaces_loose_fk_trigger AFTER DELETE ON p_ai_active_context_code_enabled_namespaces REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER p_ci_builds_loose_fk_trigger AFTER DELETE ON p_ci_builds REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('p_ci_builds');

CREATE TRIGGER p_ci_pipelines_loose_fk_trigger AFTER DELETE ON p_ci_pipelines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('p_ci_pipelines');

CREATE TRIGGER p_ci_workloads_loose_fk_trigger AFTER DELETE ON p_ci_workloads REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('p_ci_workloads');

CREATE TRIGGER p_knowledge_graph_enabled_namespaces_loose_fk_trigger AFTER DELETE ON p_knowledge_graph_enabled_namespaces REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('p_knowledge_graph_enabled_namespaces');

CREATE TRIGGER plans_loose_fk_trigger AFTER DELETE ON plans REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER pool_repositories_loose_fk_trigger AFTER DELETE ON pool_repositories REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER prevent_delete_of_default_organization_before_destroy BEFORE DELETE ON organizations FOR EACH ROW EXECUTE FUNCTION prevent_delete_of_default_organization();

CREATE TRIGGER project_type_ci_runner_machines_loose_fk_trigger AFTER DELETE ON project_type_ci_runner_machines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runner_machines');

CREATE TRIGGER project_type_ci_runners_loose_fk_trigger AFTER DELETE ON project_type_ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records_override_table('ci_runners');

CREATE TRIGGER projects_loose_fk_trigger AFTER DELETE ON projects REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER push_rules_loose_fk_trigger AFTER DELETE ON push_rules REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER sync_project_authorizations_to_migration AFTER INSERT OR DELETE OR UPDATE ON project_authorizations FOR EACH ROW EXECUTE FUNCTION sync_project_authorizations_to_migration_table();

CREATE TRIGGER table_sync_trigger_4ea4473e79 AFTER INSERT OR DELETE OR UPDATE ON uploads FOR EACH ROW EXECUTE FUNCTION table_sync_function_40ecbfb353();

CREATE TRIGGER table_sync_trigger_a747bc4a6e AFTER INSERT OR DELETE OR UPDATE ON sent_notifications FOR EACH ROW EXECUTE FUNCTION table_sync_function_d452a5847a();

CREATE TRIGGER tags_loose_fk_trigger AFTER DELETE ON tags REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER terraform_state_versions_loose_fk_trigger AFTER DELETE ON terraform_state_versions REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER trigger_009314eae986 BEFORE INSERT OR UPDATE ON protected_branch_push_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_009314eae986();

CREATE TRIGGER trigger_01b3fc052119 BEFORE INSERT OR UPDATE ON approval_merge_request_rules FOR EACH ROW EXECUTE FUNCTION trigger_01b3fc052119();

CREATE TRIGGER trigger_02450faab875 BEFORE INSERT OR UPDATE ON vulnerability_occurrence_identifiers FOR EACH ROW EXECUTE FUNCTION trigger_02450faab875();

CREATE TRIGGER trigger_038fe84feff7 BEFORE INSERT OR UPDATE ON approvals FOR EACH ROW EXECUTE FUNCTION trigger_038fe84feff7();

CREATE TRIGGER trigger_03be0f8add7e BEFORE UPDATE OF all_active_project_ids ON namespace_descendants FOR EACH ROW EXECUTE FUNCTION function_for_trigger_03be0f8add7e();

CREATE TRIGGER trigger_05cc4448a8aa BEFORE INSERT OR UPDATE ON protected_branch_merge_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_05cc4448a8aa();

CREATE TRIGGER trigger_05ce163deddf BEFORE INSERT OR UPDATE ON status_check_responses FOR EACH ROW EXECUTE FUNCTION trigger_05ce163deddf();

CREATE TRIGGER trigger_0a1b0adcf686 BEFORE INSERT OR UPDATE ON packages_debian_project_components FOR EACH ROW EXECUTE FUNCTION trigger_0a1b0adcf686();

CREATE TRIGGER trigger_0a29d4d42b62 BEFORE INSERT OR UPDATE ON approval_project_rules_protected_branches FOR EACH ROW EXECUTE FUNCTION trigger_0a29d4d42b62();

CREATE TRIGGER trigger_0aea02e5a699 BEFORE INSERT OR UPDATE ON protected_branch_merge_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_0aea02e5a699();

CREATE TRIGGER trigger_0af180e1ec89 BEFORE INSERT OR UPDATE ON packages_debian_project_component_files FOR EACH ROW EXECUTE FUNCTION trigger_0af180e1ec89();

CREATE TRIGGER trigger_0c326daf67cf BEFORE INSERT OR UPDATE ON analytics_cycle_analytics_value_stream_settings FOR EACH ROW EXECUTE FUNCTION trigger_0c326daf67cf();

CREATE TRIGGER trigger_0d96daa4d734 BEFORE INSERT OR UPDATE ON bulk_import_export_uploads FOR EACH ROW EXECUTE FUNCTION trigger_0d96daa4d734();

CREATE TRIGGER trigger_0da002390fdc BEFORE INSERT OR UPDATE ON operations_feature_flags_issues FOR EACH ROW EXECUTE FUNCTION trigger_0da002390fdc();

CREATE TRIGGER trigger_0ddb594934c9 BEFORE INSERT OR UPDATE ON incident_management_oncall_participants FOR EACH ROW EXECUTE FUNCTION trigger_0ddb594934c9();

CREATE TRIGGER trigger_0e13f214e504 BEFORE INSERT OR UPDATE ON merge_request_assignment_events FOR EACH ROW EXECUTE FUNCTION trigger_0e13f214e504();

CREATE TRIGGER trigger_0f38e5af9adf BEFORE INSERT OR UPDATE ON ml_candidate_params FOR EACH ROW EXECUTE FUNCTION trigger_0f38e5af9adf();

CREATE TRIGGER trigger_13d4aa8fe3dd BEFORE INSERT OR UPDATE ON draft_notes FOR EACH ROW EXECUTE FUNCTION trigger_13d4aa8fe3dd();

CREATE TRIGGER trigger_14a39509be0a BEFORE INSERT OR UPDATE ON packages_nuget_metadata FOR EACH ROW EXECUTE FUNCTION trigger_14a39509be0a();

CREATE TRIGGER trigger_1513378d715d BEFORE INSERT OR UPDATE ON issue_assignment_events FOR EACH ROW EXECUTE FUNCTION trigger_1513378d715d();

CREATE TRIGGER trigger_158ac875f254 BEFORE INSERT OR UPDATE ON approval_group_rules_users FOR EACH ROW EXECUTE FUNCTION trigger_158ac875f254();

CREATE TRIGGER trigger_174b23fa3dfb BEFORE INSERT OR UPDATE ON approval_project_rules_users FOR EACH ROW EXECUTE FUNCTION trigger_174b23fa3dfb();

CREATE TRIGGER trigger_18bc439a6741 BEFORE INSERT OR UPDATE ON packages_conan_metadata FOR EACH ROW EXECUTE FUNCTION trigger_18bc439a6741();

CREATE TRIGGER trigger_1baf8c8e1f66 BEFORE UPDATE OF secret_push_protection_available ON application_settings FOR EACH ROW EXECUTE FUNCTION function_for_trigger_1baf8c8e1f66();

CREATE TRIGGER trigger_1c0f1ca199a3 BEFORE INSERT OR UPDATE ON ci_resources FOR EACH ROW EXECUTE FUNCTION trigger_1c0f1ca199a3();

CREATE TRIGGER trigger_1ed40f4d5f4e BEFORE INSERT OR UPDATE ON packages_maven_metadata FOR EACH ROW EXECUTE FUNCTION trigger_1ed40f4d5f4e();

CREATE TRIGGER trigger_1eda1bc6ef53 BEFORE INSERT OR UPDATE ON merge_request_diff_details FOR EACH ROW EXECUTE FUNCTION trigger_1eda1bc6ef53();

CREATE TRIGGER trigger_1f57c71a69fb BEFORE INSERT OR UPDATE ON snippet_repositories FOR EACH ROW EXECUTE FUNCTION trigger_1f57c71a69fb();

CREATE TRIGGER trigger_206cbe2dc1a2 BEFORE INSERT OR UPDATE ON packages_package_files FOR EACH ROW EXECUTE FUNCTION trigger_206cbe2dc1a2();

CREATE TRIGGER trigger_207005e8e995 BEFORE INSERT OR UPDATE ON operations_strategies FOR EACH ROW EXECUTE FUNCTION trigger_207005e8e995();

CREATE TRIGGER trigger_218433b4faa5 BEFORE INSERT OR UPDATE ON packages_conan_file_metadata FOR EACH ROW EXECUTE FUNCTION trigger_218433b4faa5();

CREATE TRIGGER trigger_219952df8fc4 BEFORE INSERT OR UPDATE ON merge_request_blocks FOR EACH ROW EXECUTE FUNCTION trigger_219952df8fc4();

CREATE TRIGGER trigger_22262f5f16d8 BEFORE INSERT OR UPDATE ON issues FOR EACH ROW EXECUTE FUNCTION trigger_22262f5f16d8();

CREATE TRIGGER trigger_238f37f25bb2 BEFORE INSERT OR UPDATE ON boards_epic_list_user_preferences FOR EACH ROW EXECUTE FUNCTION trigger_238f37f25bb2();

CREATE TRIGGER trigger_243aecba8654 BEFORE INSERT OR UPDATE ON dast_site_profiles_builds FOR EACH ROW EXECUTE FUNCTION trigger_243aecba8654();

CREATE TRIGGER trigger_248cafd363ff BEFORE INSERT OR UPDATE ON packages_npm_metadata FOR EACH ROW EXECUTE FUNCTION trigger_248cafd363ff();

CREATE TRIGGER trigger_2514245c7fc5 BEFORE INSERT OR UPDATE ON dast_site_profile_secret_variables FOR EACH ROW EXECUTE FUNCTION trigger_2514245c7fc5();

CREATE TRIGGER trigger_25c44c30884f BEFORE INSERT OR UPDATE ON work_item_parent_links FOR EACH ROW EXECUTE FUNCTION trigger_25c44c30884f();

CREATE TRIGGER trigger_25d35f02ab55 BEFORE INSERT OR UPDATE ON ml_candidate_metadata FOR EACH ROW EXECUTE FUNCTION trigger_25d35f02ab55();

CREATE TRIGGER trigger_25fe4f7da510 BEFORE INSERT OR UPDATE ON vulnerability_issue_links FOR EACH ROW EXECUTE FUNCTION trigger_25fe4f7da510();

CREATE TRIGGER trigger_29128c51c7c6 BEFORE INSERT OR UPDATE ON dast_pre_scan_verification_steps FOR EACH ROW EXECUTE FUNCTION trigger_29128c51c7c6();

CREATE TRIGGER trigger_292097dea85c BEFORE INSERT OR UPDATE ON terraform_state_version_states FOR EACH ROW EXECUTE FUNCTION trigger_292097dea85c();

CREATE TRIGGER trigger_2a994bb5629f BEFORE INSERT OR UPDATE ON incident_management_pending_alert_escalations FOR EACH ROW EXECUTE FUNCTION trigger_2a994bb5629f();

CREATE TRIGGER trigger_2b8fdc9b4a4e BEFORE INSERT OR UPDATE ON ml_experiment_metadata FOR EACH ROW EXECUTE FUNCTION trigger_2b8fdc9b4a4e();

CREATE TRIGGER trigger_2cb7e7147818 BEFORE INSERT OR UPDATE ON wiki_page_meta_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_2cb7e7147818();

CREATE TRIGGER trigger_2dafd0d13605 BEFORE INSERT OR UPDATE ON pages_domain_acme_orders FOR EACH ROW EXECUTE FUNCTION trigger_2dafd0d13605();

CREATE TRIGGER trigger_2e4861e8640c BEFORE INSERT OR UPDATE ON packages_helm_file_metadata FOR EACH ROW EXECUTE FUNCTION trigger_2e4861e8640c();

CREATE TRIGGER trigger_30209d0fba3e BEFORE INSERT OR UPDATE ON alert_management_alert_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_30209d0fba3e();

CREATE TRIGGER trigger_309294c3b889 BEFORE INSERT OR UPDATE ON snippet_statistics FOR EACH ROW EXECUTE FUNCTION trigger_309294c3b889();

CREATE TRIGGER trigger_363d0fd35f2c BEFORE INSERT OR UPDATE ON packages_nuget_dependency_link_metadata FOR EACH ROW EXECUTE FUNCTION trigger_363d0fd35f2c();

CREATE TRIGGER trigger_36cb404f9a02 BEFORE INSERT OR UPDATE ON bulk_import_failures FOR EACH ROW EXECUTE FUNCTION trigger_36cb404f9a02();

CREATE TRIGGER trigger_388de55cd36c BEFORE INSERT OR UPDATE ON ci_builds_runner_session FOR EACH ROW EXECUTE FUNCTION trigger_388de55cd36c();

CREATE TRIGGER trigger_38bfee591e40 BEFORE INSERT OR UPDATE ON dependency_proxy_blob_states FOR EACH ROW EXECUTE FUNCTION trigger_38bfee591e40();

CREATE TRIGGER trigger_397d1b13068e BEFORE INSERT OR UPDATE ON issue_customer_relations_contacts FOR EACH ROW EXECUTE FUNCTION trigger_397d1b13068e();

CREATE TRIGGER trigger_3be1956babdb BEFORE INSERT OR UPDATE ON snippet_repository_storage_moves FOR EACH ROW EXECUTE FUNCTION trigger_3be1956babdb();

CREATE TRIGGER trigger_3c1a5f58a668 BEFORE INSERT OR UPDATE ON incident_management_oncall_shifts FOR EACH ROW EXECUTE FUNCTION trigger_3c1a5f58a668();

CREATE TRIGGER trigger_3d1a58344b29 BEFORE INSERT OR UPDATE ON alert_management_alert_assignees FOR EACH ROW EXECUTE FUNCTION trigger_3d1a58344b29();

CREATE TRIGGER trigger_3e067fa9bfe3 BEFORE INSERT OR UPDATE ON incident_management_timeline_event_tag_links FOR EACH ROW EXECUTE FUNCTION trigger_3e067fa9bfe3();

CREATE TRIGGER trigger_3f28a0bfdb16 BEFORE INSERT OR UPDATE ON merge_request_cleanup_schedules FOR EACH ROW EXECUTE FUNCTION trigger_3f28a0bfdb16();

CREATE TRIGGER trigger_3fe922f4db67 BEFORE INSERT OR UPDATE ON vulnerability_merge_request_links FOR EACH ROW EXECUTE FUNCTION trigger_3fe922f4db67();

CREATE TRIGGER trigger_41eaf23bf547 BEFORE INSERT OR UPDATE ON release_links FOR EACH ROW EXECUTE FUNCTION trigger_41eaf23bf547();

CREATE TRIGGER trigger_43484cb41aca BEFORE INSERT OR UPDATE ON wiki_repository_states FOR EACH ROW EXECUTE FUNCTION trigger_43484cb41aca();

CREATE TRIGGER trigger_44558add1625 BEFORE INSERT OR UPDATE ON merge_request_assignees FOR EACH ROW EXECUTE FUNCTION trigger_44558add1625();

CREATE TRIGGER trigger_44ff19ad0ab2 BEFORE INSERT OR UPDATE ON packages_pypi_metadata FOR EACH ROW EXECUTE FUNCTION trigger_44ff19ad0ab2();

CREATE TRIGGER trigger_468b8554e533 BEFORE INSERT OR UPDATE ON security_findings FOR EACH ROW EXECUTE FUNCTION trigger_468b8554e533();

CREATE TRIGGER trigger_46ebe375f632 BEFORE INSERT OR UPDATE ON epic_issues FOR EACH ROW EXECUTE FUNCTION trigger_46ebe375f632();

CREATE TRIGGER trigger_47b402bdab5f BEFORE INSERT OR UPDATE ON bulk_import_export_batches FOR EACH ROW EXECUTE FUNCTION trigger_47b402bdab5f();

CREATE TRIGGER trigger_49862b4b3035 BEFORE INSERT OR UPDATE ON approval_group_rules_protected_branches FOR EACH ROW EXECUTE FUNCTION trigger_49862b4b3035();

CREATE TRIGGER trigger_49b563d0130b BEFORE INSERT OR UPDATE ON dast_scanner_profiles_builds FOR EACH ROW EXECUTE FUNCTION trigger_49b563d0130b();

CREATE TRIGGER trigger_49e070da6320 BEFORE INSERT OR UPDATE ON packages_dependency_links FOR EACH ROW EXECUTE FUNCTION trigger_49e070da6320();

CREATE TRIGGER trigger_4ad9a52a6614 BEFORE INSERT OR UPDATE ON sbom_occurrences_vulnerabilities FOR EACH ROW EXECUTE FUNCTION trigger_4ad9a52a6614();

CREATE TRIGGER trigger_4b43790d717f BEFORE INSERT OR UPDATE ON protected_environment_approval_rules FOR EACH ROW EXECUTE FUNCTION trigger_4b43790d717f();

CREATE TRIGGER trigger_4c320a13bc8d BEFORE INSERT OR UPDATE ON scan_result_policies FOR EACH ROW EXECUTE FUNCTION trigger_4c320a13bc8d();

CREATE TRIGGER trigger_4cc5c3ac4d7f BEFORE INSERT OR UPDATE ON bulk_import_export_uploads FOR EACH ROW EXECUTE FUNCTION trigger_4cc5c3ac4d7f();

CREATE TRIGGER trigger_4dc8ec48e038 BEFORE INSERT OR UPDATE ON requirements_management_test_reports FOR EACH ROW EXECUTE FUNCTION trigger_4dc8ec48e038();

CREATE TRIGGER trigger_4fc14aa830b1 BEFORE INSERT OR UPDATE ON work_item_current_statuses FOR EACH ROW EXECUTE FUNCTION trigger_4fc14aa830b1();

CREATE TRIGGER trigger_54707c384ad7 BEFORE INSERT OR UPDATE ON security_orchestration_policy_rule_schedules FOR EACH ROW EXECUTE FUNCTION trigger_54707c384ad7();

CREATE TRIGGER trigger_56d49f4ed623 BEFORE INSERT OR UPDATE ON workspace_variables FOR EACH ROW EXECUTE FUNCTION trigger_56d49f4ed623();

CREATE TRIGGER trigger_57ad2742ac16 BEFORE INSERT OR UPDATE ON user_achievements FOR EACH ROW EXECUTE FUNCTION trigger_57ad2742ac16();

CREATE TRIGGER trigger_57d53b2ab135 BEFORE INSERT OR UPDATE ON issuable_resource_links FOR EACH ROW EXECUTE FUNCTION trigger_57d53b2ab135();

CREATE TRIGGER trigger_589db52d2d69 BEFORE INSERT OR UPDATE ON sentry_issues FOR EACH ROW EXECUTE FUNCTION trigger_589db52d2d69();

CREATE TRIGGER trigger_5ca97b87ee30 BEFORE INSERT OR UPDATE ON merge_request_context_commits FOR EACH ROW EXECUTE FUNCTION trigger_5ca97b87ee30();

CREATE TRIGGER trigger_5cf44cd40f22 BEFORE INSERT OR UPDATE ON operations_scopes FOR EACH ROW EXECUTE FUNCTION trigger_5cf44cd40f22();

CREATE TRIGGER trigger_5ed68c226e97 BEFORE INSERT OR UPDATE ON approval_merge_request_rules_approved_approvers FOR EACH ROW EXECUTE FUNCTION trigger_5ed68c226e97();

CREATE TRIGGER trigger_5f6432d2dccc BEFORE INSERT OR UPDATE ON operations_strategies_user_lists FOR EACH ROW EXECUTE FUNCTION trigger_5f6432d2dccc();

CREATE TRIGGER trigger_627949f72f05 BEFORE INSERT OR UPDATE ON packages_rpm_metadata FOR EACH ROW EXECUTE FUNCTION trigger_627949f72f05();

CREATE TRIGGER trigger_664594a3d0a7 BEFORE INSERT OR UPDATE ON merge_request_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_664594a3d0a7();

CREATE TRIGGER trigger_68435a54ee2b BEFORE INSERT OR UPDATE ON packages_debian_project_architectures FOR EACH ROW EXECUTE FUNCTION trigger_68435a54ee2b();

CREATE TRIGGER trigger_6bf50b363152 BEFORE INSERT OR UPDATE ON compliance_framework_security_policies FOR EACH ROW EXECUTE FUNCTION trigger_6bf50b363152();

CREATE TRIGGER trigger_6c38ba395cc1 BEFORE INSERT OR UPDATE ON error_tracking_error_events FOR EACH ROW EXECUTE FUNCTION trigger_6c38ba395cc1();

CREATE TRIGGER trigger_6cdea9559242 BEFORE INSERT OR UPDATE ON issue_links FOR EACH ROW EXECUTE FUNCTION trigger_6cdea9559242();

CREATE TRIGGER trigger_6d6c79ce74e1 BEFORE INSERT OR UPDATE ON protected_environment_deploy_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_6d6c79ce74e1();

CREATE TRIGGER trigger_6fc75a2395f3 BEFORE INSERT OR UPDATE ON packages_package_file_build_infos FOR EACH ROW EXECUTE FUNCTION trigger_6fc75a2395f3();

CREATE TRIGGER trigger_700f29b1312e BEFORE INSERT OR UPDATE ON packages_rubygems_metadata FOR EACH ROW EXECUTE FUNCTION trigger_700f29b1312e();

CREATE TRIGGER trigger_70d3f0bba1de BEFORE INSERT OR UPDATE ON compliance_framework_security_policies FOR EACH ROW EXECUTE FUNCTION trigger_70d3f0bba1de();

CREATE TRIGGER trigger_738125833856 BEFORE INSERT OR UPDATE ON bulk_import_configurations FOR EACH ROW EXECUTE FUNCTION trigger_738125833856();

CREATE TRIGGER trigger_740afa9807b8 BEFORE INSERT OR UPDATE ON subscription_user_add_on_assignments FOR EACH ROW EXECUTE FUNCTION trigger_740afa9807b8();

CREATE TRIGGER trigger_744ab45ee5ac BEFORE INSERT OR UPDATE ON protected_branch_push_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_744ab45ee5ac();

CREATE TRIGGER trigger_7495f5e0efcb BEFORE INSERT OR UPDATE ON snippet_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_7495f5e0efcb();

CREATE TRIGGER trigger_765cae42cd77 BEFORE INSERT OR UPDATE ON bulk_import_trackers FOR EACH ROW EXECUTE FUNCTION trigger_765cae42cd77();

CREATE TRIGGER trigger_77d9fbad5b12 BEFORE INSERT OR UPDATE ON packages_debian_project_distribution_keys FOR EACH ROW EXECUTE FUNCTION trigger_77d9fbad5b12();

CREATE TRIGGER trigger_78c85ddc4031 BEFORE INSERT OR UPDATE ON issue_emails FOR EACH ROW EXECUTE FUNCTION trigger_78c85ddc4031();

CREATE TRIGGER trigger_7943cb549289 BEFORE INSERT OR UPDATE ON issuable_metric_images FOR EACH ROW EXECUTE FUNCTION trigger_7943cb549289();

CREATE TRIGGER trigger_7a6d75e9eecd BEFORE INSERT OR UPDATE ON project_relation_export_uploads FOR EACH ROW EXECUTE FUNCTION trigger_7a6d75e9eecd();

CREATE TRIGGER trigger_7a8b08eed782 BEFORE INSERT OR UPDATE ON boards_epic_board_positions FOR EACH ROW EXECUTE FUNCTION trigger_7a8b08eed782();

CREATE TRIGGER trigger_7b21c87a1f91 BEFORE INSERT OR UPDATE ON bulk_import_failures FOR EACH ROW EXECUTE FUNCTION trigger_7b21c87a1f91();

CREATE TRIGGER trigger_7b378a0c402b BEFORE INSERT OR UPDATE ON issue_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_7b378a0c402b();

CREATE TRIGGER trigger_7d6a4f5b82c2 BEFORE UPDATE OF all_unarchived_project_ids ON namespace_descendants FOR EACH ROW EXECUTE FUNCTION function_for_trigger_7d6a4f5b82c2();

CREATE TRIGGER trigger_7de792ddbc05 BEFORE INSERT OR UPDATE ON dast_site_validations FOR EACH ROW EXECUTE FUNCTION trigger_7de792ddbc05();

CREATE TRIGGER trigger_7e2eed79e46e BEFORE INSERT OR UPDATE ON abuse_reports FOR EACH ROW EXECUTE FUNCTION trigger_7e2eed79e46e();

CREATE TRIGGER trigger_7f41427eda69 BEFORE UPDATE OF pre_receive_secret_detection_enabled ON application_settings FOR EACH ROW EXECUTE FUNCTION function_for_trigger_7f41427eda69();

CREATE TRIGGER trigger_7f84f9c7b945 BEFORE INSERT OR UPDATE ON bulk_import_trackers FOR EACH ROW EXECUTE FUNCTION trigger_7f84f9c7b945();

CREATE TRIGGER trigger_7fbecfcdf89a BEFORE UPDATE OF secret_push_protection_enabled ON project_security_settings FOR EACH ROW EXECUTE FUNCTION function_for_trigger_7fbecfcdf89a();

CREATE TRIGGER trigger_80578cfbdaf9 BEFORE INSERT OR UPDATE ON push_event_payloads FOR EACH ROW EXECUTE FUNCTION trigger_80578cfbdaf9();

CREATE TRIGGER trigger_81b4c93e7133 BEFORE INSERT OR UPDATE ON pages_deployment_states FOR EACH ROW EXECUTE FUNCTION trigger_81b4c93e7133();

CREATE TRIGGER trigger_81b53b626109 BEFORE INSERT OR UPDATE ON packages_debian_file_metadata FOR EACH ROW EXECUTE FUNCTION trigger_81b53b626109();

CREATE TRIGGER trigger_8204480b3a2e BEFORE INSERT OR UPDATE ON incident_management_escalation_rules FOR EACH ROW EXECUTE FUNCTION trigger_8204480b3a2e();

CREATE TRIGGER trigger_84d67ad63e93 BEFORE INSERT OR UPDATE ON wiki_page_slugs FOR EACH ROW EXECUTE FUNCTION trigger_84d67ad63e93();

CREATE TRIGGER trigger_85d89f0f11db BEFORE INSERT OR UPDATE ON issue_metrics FOR EACH ROW EXECUTE FUNCTION trigger_85d89f0f11db();

CREATE TRIGGER trigger_897f35481f9a BEFORE UPDATE OF pre_receive_secret_detection_enabled ON project_security_settings FOR EACH ROW EXECUTE FUNCTION function_for_trigger_897f35481f9a();

CREATE TRIGGER trigger_8a11b103857c BEFORE INSERT OR UPDATE ON packages_debian_group_component_files FOR EACH ROW EXECUTE FUNCTION trigger_8a11b103857c();

CREATE TRIGGER trigger_8a38ce2327de BEFORE INSERT OR UPDATE ON boards_epic_user_preferences FOR EACH ROW EXECUTE FUNCTION trigger_8a38ce2327de();

CREATE TRIGGER trigger_8ac78f164b2d BEFORE INSERT OR UPDATE ON design_management_repositories FOR EACH ROW EXECUTE FUNCTION trigger_8ac78f164b2d();

CREATE TRIGGER trigger_8b39d532224c BEFORE INSERT OR UPDATE ON ci_secure_file_states FOR EACH ROW EXECUTE FUNCTION trigger_8b39d532224c();

CREATE TRIGGER trigger_8ba074736a77 BEFORE INSERT OR UPDATE ON snippet_repository_storage_moves FOR EACH ROW EXECUTE FUNCTION trigger_8ba074736a77();

CREATE TRIGGER trigger_8cb8ad095bf6 BEFORE INSERT OR UPDATE ON bulk_import_failures FOR EACH ROW EXECUTE FUNCTION trigger_8cb8ad095bf6();

CREATE TRIGGER trigger_8cf1745cf163 BEFORE INSERT OR UPDATE ON design_management_repository_states FOR EACH ROW EXECUTE FUNCTION trigger_8cf1745cf163();

CREATE TRIGGER trigger_8d002f38bdef BEFORE INSERT OR UPDATE ON packages_debian_group_components FOR EACH ROW EXECUTE FUNCTION trigger_8d002f38bdef();

CREATE TRIGGER trigger_8d17725116fe BEFORE INSERT OR UPDATE ON merge_request_reviewers FOR EACH ROW EXECUTE FUNCTION trigger_8d17725116fe();

CREATE TRIGGER trigger_8d661362aa1a BEFORE INSERT OR UPDATE ON issue_email_participants FOR EACH ROW EXECUTE FUNCTION trigger_8d661362aa1a();

CREATE TRIGGER trigger_8e66b994e8f0 BEFORE INSERT OR UPDATE ON audit_events_streaming_event_type_filters FOR EACH ROW EXECUTE FUNCTION trigger_8e66b994e8f0();

CREATE TRIGGER trigger_8fbb044c64ad BEFORE INSERT OR UPDATE ON design_management_designs FOR EACH ROW EXECUTE FUNCTION trigger_8fbb044c64ad();

CREATE TRIGGER trigger_90fa5c6951f1 BEFORE INSERT OR UPDATE ON dast_profiles_tags FOR EACH ROW EXECUTE FUNCTION trigger_90fa5c6951f1();

CREATE TRIGGER trigger_91e1012b9851 BEFORE INSERT OR UPDATE ON merge_request_context_commit_diff_files FOR EACH ROW EXECUTE FUNCTION trigger_91e1012b9851();

CREATE TRIGGER trigger_9259aae92378 BEFORE INSERT OR UPDATE ON packages_build_infos FOR EACH ROW EXECUTE FUNCTION trigger_9259aae92378();

CREATE TRIGGER trigger_93a5b044f4e8 BEFORE INSERT OR UPDATE ON snippet_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_93a5b044f4e8();

CREATE TRIGGER trigger_94514aeadc50 BEFORE INSERT OR UPDATE ON deployment_approvals FOR EACH ROW EXECUTE FUNCTION trigger_94514aeadc50();

CREATE TRIGGER trigger_951ac22c24d7 BEFORE INSERT OR UPDATE ON required_code_owners_sections FOR EACH ROW EXECUTE FUNCTION trigger_951ac22c24d7();

CREATE TRIGGER trigger_96298f7da5d3 BEFORE INSERT OR UPDATE ON protected_branch_unprotect_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_96298f7da5d3();

CREATE TRIGGER trigger_9699ea03bb37 BEFORE INSERT OR UPDATE ON related_epic_links FOR EACH ROW EXECUTE FUNCTION trigger_9699ea03bb37();

CREATE TRIGGER trigger_96a76ee9f147 BEFORE INSERT OR UPDATE ON design_management_versions FOR EACH ROW EXECUTE FUNCTION trigger_96a76ee9f147();

CREATE TRIGGER trigger_979e7f45114f BEFORE INSERT OR UPDATE ON ml_candidate_metrics FOR EACH ROW EXECUTE FUNCTION trigger_979e7f45114f();

CREATE TRIGGER trigger_97e9245e767d BEFORE INSERT OR UPDATE ON issue_assignees FOR EACH ROW EXECUTE FUNCTION trigger_97e9245e767d();

CREATE TRIGGER trigger_9b944f36fdac BEFORE INSERT OR UPDATE ON approval_merge_request_rules_users FOR EACH ROW EXECUTE FUNCTION trigger_9b944f36fdac();

CREATE TRIGGER trigger_9e137c16de79 BEFORE INSERT OR UPDATE ON vulnerability_findings_remediations FOR EACH ROW EXECUTE FUNCTION trigger_9e137c16de79();

CREATE TRIGGER trigger_9e875cabe9c9 BEFORE INSERT OR UPDATE ON wiki_page_slugs FOR EACH ROW EXECUTE FUNCTION trigger_9e875cabe9c9();

CREATE TRIGGER trigger_9f3745f8fe32 BEFORE INSERT OR UPDATE ON merge_requests_closing_issues FOR EACH ROW EXECUTE FUNCTION trigger_9f3745f8fe32();

CREATE TRIGGER trigger_9f3de326ea61 BEFORE INSERT OR UPDATE ON ci_pipeline_schedule_variables FOR EACH ROW EXECUTE FUNCTION trigger_9f3de326ea61();

CREATE TRIGGER trigger_a1bc7c70cbdf BEFORE INSERT OR UPDATE ON vulnerability_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_a1bc7c70cbdf();

CREATE TRIGGER trigger_a22be47501db BEFORE INSERT OR UPDATE ON group_wiki_repository_states FOR EACH ROW EXECUTE FUNCTION trigger_a22be47501db();

CREATE TRIGGER trigger_a253cb3cacdf BEFORE INSERT OR UPDATE ON dora_daily_metrics FOR EACH ROW EXECUTE FUNCTION trigger_a253cb3cacdf();

CREATE TRIGGER trigger_a465de38164e BEFORE INSERT OR UPDATE ON ci_job_artifact_states FOR EACH ROW EXECUTE FUNCTION trigger_a465de38164e();

CREATE TRIGGER trigger_a4e4fb2451d9 BEFORE INSERT OR UPDATE ON epic_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_a4e4fb2451d9();

CREATE TRIGGER trigger_a7e0fb195210 BEFORE INSERT OR UPDATE ON vulnerability_finding_evidences FOR EACH ROW EXECUTE FUNCTION trigger_a7e0fb195210();

CREATE TRIGGER trigger_af3f17817e4d BEFORE INSERT OR UPDATE ON protected_tag_create_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_af3f17817e4d();

CREATE TRIGGER trigger_b046dd50c711 BEFORE INSERT OR UPDATE ON incident_management_oncall_rotations FOR EACH ROW EXECUTE FUNCTION trigger_b046dd50c711();

CREATE TRIGGER trigger_b0f4298cadff BEFORE INSERT OR UPDATE ON required_code_owners_sections FOR EACH ROW EXECUTE FUNCTION trigger_b0f4298cadff();

CREATE TRIGGER trigger_b2612138515d BEFORE INSERT OR UPDATE ON project_relation_exports FOR EACH ROW EXECUTE FUNCTION trigger_b2612138515d();

CREATE TRIGGER trigger_b4520c29ea74 BEFORE INSERT OR UPDATE ON approval_merge_request_rule_sources FOR EACH ROW EXECUTE FUNCTION trigger_b4520c29ea74();

CREATE TRIGGER trigger_b75e5731e305 BEFORE INSERT OR UPDATE ON dast_profiles_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_b75e5731e305();

CREATE TRIGGER trigger_b7abb8fc4cf0 BEFORE INSERT OR UPDATE ON work_item_progresses FOR EACH ROW EXECUTE FUNCTION trigger_b7abb8fc4cf0();

CREATE TRIGGER trigger_b83b7e51e2f5 BEFORE INSERT OR UPDATE ON scan_result_policies FOR EACH ROW EXECUTE FUNCTION trigger_b83b7e51e2f5();

CREATE TRIGGER trigger_b8eecea7f351 BEFORE INSERT OR UPDATE ON dependency_proxy_manifest_states FOR EACH ROW EXECUTE FUNCTION trigger_b8eecea7f351();

CREATE TRIGGER trigger_b9839c6d713f BEFORE INSERT ON application_settings FOR EACH ROW EXECUTE FUNCTION function_for_trigger_b9839c6d713f();

CREATE TRIGGER trigger_c17a166692a2 BEFORE INSERT OR UPDATE ON audit_events_streaming_headers FOR EACH ROW EXECUTE FUNCTION trigger_c17a166692a2();

CREATE TRIGGER trigger_c52d215d50a1 BEFORE INSERT OR UPDATE ON incident_management_pending_issue_escalations FOR EACH ROW EXECUTE FUNCTION trigger_c52d215d50a1();

CREATE TRIGGER trigger_c59fe6f31e71 BEFORE INSERT OR UPDATE ON security_orchestration_policy_rule_schedules FOR EACH ROW EXECUTE FUNCTION trigger_c59fe6f31e71();

CREATE TRIGGER trigger_c5eec113ea76 BEFORE INSERT OR UPDATE ON dast_pre_scan_verifications FOR EACH ROW EXECUTE FUNCTION trigger_c5eec113ea76();

CREATE TRIGGER trigger_c6728503decb BEFORE INSERT OR UPDATE ON design_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_c6728503decb();

CREATE TRIGGER trigger_c8bc8646bce9 BEFORE INSERT OR UPDATE ON vulnerability_state_transitions FOR EACH ROW EXECUTE FUNCTION trigger_c8bc8646bce9();

CREATE TRIGGER trigger_c9090feed334 BEFORE INSERT OR UPDATE ON boards_epic_lists FOR EACH ROW EXECUTE FUNCTION trigger_c9090feed334();

CREATE TRIGGER trigger_cac7c0698291 BEFORE INSERT OR UPDATE ON evidences FOR EACH ROW EXECUTE FUNCTION trigger_cac7c0698291();

CREATE TRIGGER trigger_catalog_resource_sync_event_on_project_update AFTER UPDATE ON projects FOR EACH ROW WHEN ((((old.name)::text IS DISTINCT FROM (new.name)::text) OR (old.description IS DISTINCT FROM new.description) OR (old.visibility_level IS DISTINCT FROM new.visibility_level))) EXECUTE FUNCTION insert_catalog_resource_sync_event();

CREATE TRIGGER trigger_cbecfadbc3e8 BEFORE INSERT ON project_security_settings FOR EACH ROW EXECUTE FUNCTION function_for_trigger_cbecfadbc3e8();

CREATE TRIGGER trigger_cd50823537a3 BEFORE INSERT OR UPDATE ON issuable_slas FOR EACH ROW EXECUTE FUNCTION trigger_cd50823537a3();

CREATE TRIGGER trigger_cdfa6500a121 BEFORE INSERT OR UPDATE ON snippet_statistics FOR EACH ROW EXECUTE FUNCTION trigger_cdfa6500a121();

CREATE TRIGGER trigger_cf646a118cbb BEFORE INSERT OR UPDATE ON milestone_releases FOR EACH ROW EXECUTE FUNCTION trigger_cf646a118cbb();

CREATE TRIGGER trigger_cfbec3f07e2b BEFORE INSERT OR UPDATE ON deployment_merge_requests FOR EACH ROW EXECUTE FUNCTION trigger_cfbec3f07e2b();

CREATE TRIGGER trigger_d4487a75bd44 BEFORE INSERT OR UPDATE ON terraform_state_versions FOR EACH ROW EXECUTE FUNCTION trigger_d4487a75bd44();

CREATE TRIGGER trigger_d5c895007948 BEFORE INSERT OR UPDATE ON protected_environment_approval_rules FOR EACH ROW EXECUTE FUNCTION trigger_d5c895007948();

CREATE TRIGGER trigger_d8c2de748d8c BEFORE INSERT OR UPDATE ON merge_request_predictions FOR EACH ROW EXECUTE FUNCTION trigger_d8c2de748d8c();

CREATE TRIGGER trigger_d9468bfbb0b4 BEFORE INSERT OR UPDATE ON snippet_repositories FOR EACH ROW EXECUTE FUNCTION trigger_d9468bfbb0b4();

CREATE TRIGGER trigger_da5fd3d6d75c BEFORE INSERT OR UPDATE ON packages_composer_metadata FOR EACH ROW EXECUTE FUNCTION trigger_da5fd3d6d75c();

CREATE TRIGGER trigger_dadd660afe2c BEFORE INSERT OR UPDATE ON packages_debian_group_distribution_keys FOR EACH ROW EXECUTE FUNCTION trigger_dadd660afe2c();

CREATE TRIGGER trigger_dbdd61a66a91 BEFORE INSERT OR UPDATE ON agent_activity_events FOR EACH ROW EXECUTE FUNCTION trigger_dbdd61a66a91();

CREATE TRIGGER trigger_dbe374a57cbb BEFORE INSERT OR UPDATE ON status_page_published_incidents FOR EACH ROW EXECUTE FUNCTION trigger_dbe374a57cbb();

CREATE TRIGGER trigger_dc13168b8025 BEFORE INSERT OR UPDATE ON vulnerability_flags FOR EACH ROW EXECUTE FUNCTION trigger_dc13168b8025();

CREATE TRIGGER trigger_de59b81d3044 BEFORE INSERT OR UPDATE ON bulk_import_export_batches FOR EACH ROW EXECUTE FUNCTION trigger_de59b81d3044();

CREATE TRIGGER trigger_de99bb993511 BEFORE INSERT ON namespace_descendants FOR EACH ROW EXECUTE FUNCTION function_for_trigger_de99bb993511();

CREATE TRIGGER trigger_delete_project_namespace_on_project_delete AFTER DELETE ON projects FOR EACH ROW WHEN ((old.project_namespace_id IS NOT NULL)) EXECUTE FUNCTION delete_associated_project_namespace();

CREATE TRIGGER trigger_dfad97659d5f BEFORE INSERT OR UPDATE ON issuable_severities FOR EACH ROW EXECUTE FUNCTION trigger_dfad97659d5f();

CREATE TRIGGER trigger_e0864d1cff37 BEFORE INSERT OR UPDATE ON packages_debian_group_architectures FOR EACH ROW EXECUTE FUNCTION trigger_e0864d1cff37();

CREATE TRIGGER trigger_e1da4a738230 BEFORE INSERT OR UPDATE ON vulnerability_external_issue_links FOR EACH ROW EXECUTE FUNCTION trigger_e1da4a738230();

CREATE TRIGGER trigger_e49ab4d904a0 BEFORE INSERT OR UPDATE ON vulnerability_finding_links FOR EACH ROW EXECUTE FUNCTION trigger_e49ab4d904a0();

CREATE TRIGGER trigger_e4a6cde57b42 BEFORE INSERT OR UPDATE ON resource_weight_events FOR EACH ROW EXECUTE FUNCTION trigger_e4a6cde57b42();

CREATE TRIGGER trigger_e815625b59fa BEFORE INSERT OR UPDATE ON resource_link_events FOR EACH ROW EXECUTE FUNCTION trigger_e815625b59fa();

CREATE TRIGGER trigger_ebab34f83f1d BEFORE INSERT OR UPDATE ON packages_debian_publications FOR EACH ROW EXECUTE FUNCTION trigger_ebab34f83f1d();

CREATE TRIGGER trigger_ec1934755627 BEFORE INSERT OR UPDATE ON alert_management_alert_metric_images FOR EACH ROW EXECUTE FUNCTION trigger_ec1934755627();

CREATE TRIGGER trigger_ed554313ca66 BEFORE INSERT OR UPDATE ON protected_branch_unprotect_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_ed554313ca66();

CREATE TRIGGER trigger_eeb25d23ab2d BEFORE INSERT OR UPDATE ON bulk_import_trackers FOR EACH ROW EXECUTE FUNCTION trigger_eeb25d23ab2d();

CREATE TRIGGER trigger_efb9d354f05a BEFORE INSERT OR UPDATE ON incident_management_issuable_escalation_statuses FOR EACH ROW EXECUTE FUNCTION trigger_efb9d354f05a();

CREATE TRIGGER trigger_eff80ead42ac BEFORE INSERT OR UPDATE ON ci_unit_test_failures FOR EACH ROW EXECUTE FUNCTION trigger_eff80ead42ac();

CREATE TRIGGER trigger_f6c61cdddf31 BEFORE INSERT OR UPDATE ON ml_model_metadata FOR EACH ROW EXECUTE FUNCTION trigger_f6c61cdddf31();

CREATE TRIGGER trigger_f6f59d8216b3 BEFORE INSERT OR UPDATE ON protected_environment_deploy_access_levels FOR EACH ROW EXECUTE FUNCTION trigger_f6f59d8216b3();

CREATE TRIGGER trigger_fac444e0cae6 BEFORE INSERT OR UPDATE ON design_management_designs_versions FOR EACH ROW EXECUTE FUNCTION trigger_fac444e0cae6();

CREATE TRIGGER trigger_fbd42ed69453 BEFORE INSERT OR UPDATE ON external_status_checks_protected_branches FOR EACH ROW EXECUTE FUNCTION trigger_fbd42ed69453();

CREATE TRIGGER trigger_fbd8825b3057 BEFORE INSERT OR UPDATE ON boards_epic_board_labels FOR EACH ROW EXECUTE FUNCTION trigger_fbd8825b3057();

CREATE TRIGGER trigger_fd4a1be98713 BEFORE INSERT OR UPDATE ON container_repository_states FOR EACH ROW EXECUTE FUNCTION trigger_fd4a1be98713();

CREATE TRIGGER trigger_fff8735b6b9a BEFORE INSERT OR UPDATE ON vulnerability_finding_signatures FOR EACH ROW EXECUTE FUNCTION trigger_fff8735b6b9a();

CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();

CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();

CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();

CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN (((old.type_new = 'Integrations::ExternalWiki'::text) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();

CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN (((new.active = true) AND (new.type_new = 'Integrations::ExternalWiki'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();

CREATE TRIGGER trigger_has_external_wiki_on_type_new_updated AFTER UPDATE OF type_new ON integrations FOR EACH ROW WHEN (((new.type_new = 'Integrations::ExternalWiki'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();

CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN (((new.type_new = 'Integrations::ExternalWiki'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();

CREATE TRIGGER trigger_insert_or_update_vulnerability_reads_from_occurrences AFTER INSERT OR UPDATE ON vulnerability_occurrences FOR EACH ROW EXECUTE FUNCTION insert_or_update_vulnerability_reads();

CREATE TRIGGER trigger_insert_vulnerability_reads_from_vulnerability AFTER UPDATE ON vulnerabilities FOR EACH ROW WHEN (((old.present_on_default_branch IS NOT TRUE) AND (new.present_on_default_branch IS TRUE))) EXECUTE FUNCTION insert_vulnerability_reads_from_vulnerability();

CREATE TRIGGER trigger_namespaces_traversal_ids_on_update AFTER UPDATE ON namespaces FOR EACH ROW WHEN ((old.traversal_ids IS DISTINCT FROM new.traversal_ids)) EXECUTE FUNCTION insert_namespaces_sync_event();

CREATE TRIGGER trigger_projects_parent_id_on_insert AFTER INSERT ON projects FOR EACH ROW EXECUTE FUNCTION insert_projects_sync_event();

CREATE TRIGGER trigger_projects_parent_id_on_update AFTER UPDATE ON projects FOR EACH ROW WHEN ((old.namespace_id IS DISTINCT FROM new.namespace_id)) EXECUTE FUNCTION insert_projects_sync_event();

CREATE TRIGGER trigger_sync_issues_dates_with_work_item_dates_sources AFTER INSERT OR UPDATE OF start_date, due_date ON work_item_dates_sources FOR EACH ROW EXECUTE FUNCTION sync_issues_dates_with_work_item_dates_sources();

CREATE TRIGGER trigger_sync_namespace_to_group_push_rules AFTER UPDATE ON namespaces FOR EACH ROW WHEN ((old.push_rule_id IS DISTINCT FROM new.push_rule_id)) EXECUTE FUNCTION sync_namespace_to_group_push_rules();

CREATE TRIGGER trigger_sync_organization_push_rules_delete BEFORE DELETE ON push_rules FOR EACH ROW EXECUTE FUNCTION sync_organization_push_rules_on_delete();

CREATE TRIGGER trigger_sync_organization_push_rules_insert_update AFTER INSERT OR UPDATE ON push_rules FOR EACH ROW EXECUTE FUNCTION sync_organization_push_rules_on_insert_update();

CREATE TRIGGER trigger_sync_packages_composer_with_composer_metadata AFTER INSERT OR UPDATE ON packages_composer_metadata FOR EACH ROW EXECUTE FUNCTION sync_packages_composer_with_composer_metadata();

CREATE TRIGGER trigger_sync_packages_composer_with_packages AFTER INSERT OR DELETE OR UPDATE ON packages_packages FOR EACH ROW EXECUTE FUNCTION sync_packages_composer_with_packages();

CREATE TRIGGER trigger_sync_push_rules_to_group_push_rules AFTER UPDATE ON push_rules FOR EACH ROW EXECUTE FUNCTION sync_push_rules_to_group_push_rules();

CREATE TRIGGER trigger_sync_redirect_routes_namespace_id BEFORE INSERT OR UPDATE ON redirect_routes FOR EACH ROW WHEN ((new.namespace_id IS NULL)) EXECUTE FUNCTION sync_redirect_routes_namespace_id();

CREATE TRIGGER trigger_update_details_on_namespace_insert AFTER INSERT ON namespaces FOR EACH ROW WHEN (((new.type)::text <> 'Project'::text)) EXECUTE FUNCTION update_namespace_details_from_namespaces();

CREATE TRIGGER trigger_update_details_on_namespace_update AFTER UPDATE ON namespaces FOR EACH ROW WHEN ((((new.type)::text <> 'Project'::text) AND (((old.description)::text IS DISTINCT FROM (new.description)::text) OR (old.description_html IS DISTINCT FROM new.description_html) OR (old.cached_markdown_version IS DISTINCT FROM new.cached_markdown_version)))) EXECUTE FUNCTION update_namespace_details_from_namespaces();

CREATE TRIGGER trigger_update_details_on_project_insert AFTER INSERT ON projects FOR EACH ROW EXECUTE FUNCTION update_namespace_details_from_projects();

CREATE TRIGGER trigger_update_details_on_project_update AFTER UPDATE ON projects FOR EACH ROW WHEN (((old.description IS DISTINCT FROM new.description) OR (old.description_html IS DISTINCT FROM new.description_html) OR (old.cached_markdown_version IS DISTINCT FROM new.cached_markdown_version))) EXECUTE FUNCTION update_namespace_details_from_projects();

CREATE TRIGGER trigger_update_has_issues_on_vulnerability_issue_links_delete AFTER DELETE ON vulnerability_issue_links FOR EACH ROW EXECUTE FUNCTION unset_has_issues_on_vulnerability_reads();

CREATE TRIGGER trigger_update_has_issues_on_vulnerability_issue_links_update AFTER INSERT ON vulnerability_issue_links FOR EACH ROW EXECUTE FUNCTION set_has_issues_on_vulnerability_reads();

CREATE TRIGGER trigger_update_has_merge_request_on_vulnerability_mr_links_dele AFTER DELETE ON vulnerability_merge_request_links FOR EACH ROW EXECUTE FUNCTION unset_has_merge_request_on_vulnerability_reads();

CREATE TRIGGER trigger_update_has_merge_request_on_vulnerability_mr_links_upda AFTER INSERT ON vulnerability_merge_request_links FOR EACH ROW EXECUTE FUNCTION set_has_merge_request_on_vulnerability_reads();

CREATE TRIGGER trigger_update_location_on_vulnerability_occurrences_update AFTER UPDATE ON vulnerability_occurrences FOR EACH ROW WHEN (((new.report_type = ANY (ARRAY[2, 7])) AND (((old.location ->> 'image'::text) IS DISTINCT FROM (new.location ->> 'image'::text)) OR (((old.location -> 'kubernetes_resource'::text) ->> 'agent_id'::text) IS DISTINCT FROM ((new.location -> 'kubernetes_resource'::text) ->> 'agent_id'::text))))) EXECUTE FUNCTION update_location_from_vulnerability_occurrences();

CREATE TRIGGER trigger_update_vulnerability_reads_on_vulnerability_update AFTER UPDATE ON vulnerabilities FOR EACH ROW WHEN (((old.present_on_default_branch IS TRUE) AND ((old.severity IS DISTINCT FROM new.severity) OR (old.state IS DISTINCT FROM new.state) OR (old.resolved_on_default_branch IS DISTINCT FROM new.resolved_on_default_branch)))) EXECUTE FUNCTION update_vulnerability_reads_from_vulnerability();

CREATE TRIGGER users_loose_fk_trigger AFTER DELETE ON users REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER virtual_registries_packages_maven_upstreams_loose_fk_trigger AFTER DELETE ON virtual_registries_packages_maven_upstreams REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

CREATE TRIGGER vulnerabilities_loose_fk_trigger AFTER DELETE ON vulnerabilities REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();

ALTER TABLE ONLY ai_conversation_threads
    ADD CONSTRAINT fk_00234c7444 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_active_context_collections
    ADD CONSTRAINT fk_008426fce1 FOREIGN KEY (connection_id) REFERENCES ai_active_context_connections(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_deletion_schedules
    ADD CONSTRAINT fk_009a52774d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployments
    ADD CONSTRAINT fk_009fd21147 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects_branch_rules_merge_request_approval_settings
    ADD CONSTRAINT fk_00acf20382 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT fk_00c659d395 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_013c9f36ca FOREIGN KEY (due_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;

ALTER TABLE ONLY namespace_deletion_schedules
    ADD CONSTRAINT fk_013e35d75a FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_policy_settings
    ADD CONSTRAINT fk_019d4dda87 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY environments
    ADD CONSTRAINT fk_01a033a308 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE SET NULL;

ALTER TABLE ONLY ai_catalog_items
    ADD CONSTRAINT fk_01a07cc378 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_user_access_project_authorizations
    ADD CONSTRAINT fk_0250c0ad51 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_url_configurations
    ADD CONSTRAINT fk_02c2a4f060 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_escalation_rules
    ADD CONSTRAINT fk_0314ee86eb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules
    ADD CONSTRAINT fk_03983bf729 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_instance_google_cloud_logging_configurations
    ADD CONSTRAINT fk_03a15ca4fa FOREIGN KEY (stream_destination_id) REFERENCES audit_events_instance_external_streaming_destinations(id) ON DELETE SET NULL;

ALTER TABLE ONLY service_desk_settings
    ADD CONSTRAINT fk_03afb71f06 FOREIGN KEY (file_template_project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY work_item_type_custom_lifecycles
    ADD CONSTRAINT fk_03c6229585 FOREIGN KEY (lifecycle_id) REFERENCES work_item_custom_lifecycles(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_designs_versions
    ADD CONSTRAINT fk_03c671965c FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_custom_lifecycles
    ADD CONSTRAINT fk_0425cd8e8b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY external_status_checks_protected_branches
    ADD CONSTRAINT fk_0480f2308c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_workloads
    ADD CONSTRAINT fk_04d2023c20 FOREIGN KEY (workflow_id) REFERENCES duo_workflows_workflows(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_requirement_compliance_statuses
    ADD CONSTRAINT fk_04ffb1e9ab FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE RESTRICT;

ALTER TABLE ONLY requirements_management_test_reports
    ADD CONSTRAINT fk_05094e3d87 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_tracker_data
    ADD CONSTRAINT fk_05895afb4c FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY analytics_dashboards_pointers
    ADD CONSTRAINT fk_05d96922bd FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_05f1e72feb FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ai_settings
    ADD CONSTRAINT fk_05f695565a FOREIGN KEY (amazon_q_oauth_application_id) REFERENCES oauth_applications(id) ON DELETE SET NULL;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_06067f5644 FOREIGN KEY (latest_merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE SET NULL;

ALTER TABLE ONLY clusters_managed_resources
    ADD CONSTRAINT fk_068dba90c3 FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_user_preferences
    ADD CONSTRAINT fk_0748f95f41 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_occurrences_vulnerabilities
    ADD CONSTRAINT fk_07b81e3a81 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_agent_version_attachments
    ADD CONSTRAINT fk_07db0a0e5b FOREIGN KEY (ai_agent_version_id) REFERENCES ai_agent_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_notes
    ADD CONSTRAINT fk_0801b83126 FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_stage_event_hashes
    ADD CONSTRAINT fk_0839874e4f FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_user_mentions
    ADD CONSTRAINT fk_088018ecd8 FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_assignees
    ADD CONSTRAINT fk_088f01d08d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY observability_traces_issues_connections
    ADD CONSTRAINT fk_08c2664321 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY targeted_message_dismissals
    ADD CONSTRAINT fk_08c30af7ff FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_lifecycle_statuses
    ADD CONSTRAINT fk_08e006a1a3 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_assignment_events
    ADD CONSTRAINT fk_08f7602bfd FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_groups
    ADD CONSTRAINT fk_094b4086a3 FOREIGN KEY (approval_rule_id) REFERENCES merge_requests_approval_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_component_last_usages
    ADD CONSTRAINT fk_094c686785 FOREIGN KEY (component_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_sites
    ADD CONSTRAINT fk_0a57f2271b FOREIGN KEY (dast_site_validation_id) REFERENCES dast_site_validations(id) ON DELETE SET NULL;

ALTER TABLE ONLY project_saved_replies
    ADD CONSTRAINT fk_0ace76afbb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT fk_0b028ab81c FOREIGN KEY (default_open_status_id) REFERENCES work_item_custom_statuses(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_seat_assignments
    ADD CONSTRAINT fk_0b6bc63773 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_protected_branches
    ADD CONSTRAINT fk_0b85e6c388 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_amazon_s3_configurations
    ADD CONSTRAINT fk_0bcc22194d FOREIGN KEY (stream_destination_id) REFERENCES audit_events_group_external_streaming_destinations(id) ON DELETE SET NULL;

ALTER TABLE ONLY issue_customer_relations_contacts
    ADD CONSTRAINT fk_0c0037f723 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_cluster_agent_mappings
    ADD CONSTRAINT fk_0c483ecb9d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoekt_replicas
    ADD CONSTRAINT fk_0c62cc0251 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ssh_signatures
    ADD CONSTRAINT fk_0c83baaa5f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY web_hooks
    ADD CONSTRAINT fk_0c8ca6d9d1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_0d3f677137 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_user_add_on_assignments
    ADD CONSTRAINT fk_0d89020c49 FOREIGN KEY (add_on_purchase_id) REFERENCES subscription_add_on_purchases(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_users
    ADD CONSTRAINT fk_0dfcd9e339 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diff_files
    ADD CONSTRAINT fk_0e3ba01603 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY security_policy_project_links
    ADD CONSTRAINT fk_0eba4d5d71 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_placeholder_user_details
    ADD CONSTRAINT fk_0f2747626d FOREIGN KEY (placeholder_user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployment_approvals
    ADD CONSTRAINT fk_0f58311058 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_relation_export_uploads
    ADD CONSTRAINT fk_0f7fad01a3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_assignees
    ADD CONSTRAINT fk_105c1d6d08 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_package_file_build_infos
    ADD CONSTRAINT fk_10705aa7b5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_event_type_filters
    ADD CONSTRAINT fk_107946dffb FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_placeholder_user_details
    ADD CONSTRAINT fk_10a16b0435 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_10deab2eef FOREIGN KEY (custom_status_id) REFERENCES work_item_custom_statuses(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_custom_lifecycles
    ADD CONSTRAINT fk_111d417cb7 FOREIGN KEY (work_item_type_id) REFERENCES work_item_types(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_deletion_schedules
    ADD CONSTRAINT fk_11e3ebfcdd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_deploy_access_levels
    ADD CONSTRAINT fk_11ede44198 FOREIGN KEY (protected_environment_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_migrations
    ADD CONSTRAINT fk_1211a345fb FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_cluster_agent_mappings
    ADD CONSTRAINT fk_124d8167c5 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ai_catalog_items
    ADD CONSTRAINT fk_128a8d1e59 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_url_configurations
    ADD CONSTRAINT fk_12d4a33b65 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY member_approvals
    ADD CONSTRAINT fk_1383c72212 FOREIGN KEY (member_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_migrations
    ADD CONSTRAINT fk_13af035625 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_trackers
    ADD CONSTRAINT fk_13c8d30bfb FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_control_compliance_statuses
    ADD CONSTRAINT fk_13fb61bcfa FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_headers
    ADD CONSTRAINT fk_1413743b7d FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules
    ADD CONSTRAINT fk_1485c451e3 FOREIGN KEY (scan_result_policy_id) REFERENCES scan_result_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY ldap_group_links
    ADD CONSTRAINT fk_14a86de4b3 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY ci_runner_namespaces
    ADD CONSTRAINT fk_14d16929fa FOREIGN KEY (runner_id) REFERENCES group_type_ci_runners(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_event_tag_links
    ADD CONSTRAINT fk_152216ca4f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_versions
    ADD CONSTRAINT fk_15376d917e FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_blocks
    ADD CONSTRAINT fk_1551efdd17 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY redirect_routes
    ADD CONSTRAINT fk_157ba4733c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policies
    ADD CONSTRAINT fk_159e8f8f79 FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT fk_15d2a7a4ae FOREIGN KEY (deploy_key_id) REFERENCES keys(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_achievements
    ADD CONSTRAINT fk_15d6451a81 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY internal_ids
    ADD CONSTRAINT fk_162941d509 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_tracker_data
    ADD CONSTRAINT fk_16ddb573de FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY incident_management_timeline_events
    ADD CONSTRAINT fk_17a5fafbd4 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_configurations
    ADD CONSTRAINT fk_17ae5587d3 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policy_violations
    ADD CONSTRAINT fk_17ce579abf FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_events
    ADD CONSTRAINT fk_1800597ef9 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY terraform_state_versions
    ADD CONSTRAINT fk_180cde327a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_features
    ADD CONSTRAINT fk_18513d9b92 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_events
    ADD CONSTRAINT fk_18c774c06b FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE p_ci_pipelines
    ADD CONSTRAINT fk_190998ef09 FOREIGN KEY (external_pull_request_id) REFERENCES external_pull_requests(id) ON DELETE SET NULL;

ALTER TABLE ONLY analytics_devops_adoption_segments
    ADD CONSTRAINT fk_190a24754d FOREIGN KEY (display_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_statistics
    ADD CONSTRAINT fk_198ad46fdc FOREIGN KEY (root_namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY work_item_current_statuses
    ADD CONSTRAINT fk_1bb76463e0 FOREIGN KEY (custom_status_id) REFERENCES work_item_custom_statuses(id) ON DELETE SET NULL;

ALTER TABLE ONLY board_user_preferences
    ADD CONSTRAINT fk_1c0b27016f FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_policy_rule_project_links
    ADD CONSTRAINT fk_1c78796d52 FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_links
    ADD CONSTRAINT fk_1cce06b868 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_project_authorizations
    ADD CONSTRAINT fk_1d30bb4987 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_agent_version_attachments
    ADD CONSTRAINT fk_1d4253673b FOREIGN KEY (ai_vectorizable_file_id) REFERENCES ai_vectorizable_files(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_merge_requests
    ADD CONSTRAINT fk_1d49645a27 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_versions
    ADD CONSTRAINT fk_1dccb304f8 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY sentry_issues
    ADD CONSTRAINT fk_1df79abe52 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards
    ADD CONSTRAINT fk_1e9a074a35 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoekt_enabled_namespaces
    ADD CONSTRAINT fk_1effa65b25 FOREIGN KEY (root_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_placeholder_memberships
    ADD CONSTRAINT fk_1f4659deee FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_approver_groups
    ADD CONSTRAINT fk_1f8729ebf4 FOREIGN KEY (approval_rule_id) REFERENCES merge_requests_approval_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_1fbed67632 FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT fk_20262abeba FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY ghost_user_migrations
    ADD CONSTRAINT fk_202e642a2f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY coverage_fuzzing_corpuses
    ADD CONSTRAINT fk_204d40056a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_catalog_item_consumers
    ADD CONSTRAINT fk_2081306886 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_select_field_values
    ADD CONSTRAINT fk_20ae82616c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_settings
    ADD CONSTRAINT fk_20cf0eb2f9 FOREIGN KEY (default_compliance_framework_id) REFERENCES compliance_management_frameworks(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_nuget_metadata
    ADD CONSTRAINT fk_21569c0856 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_user_mentions
    ADD CONSTRAINT fk_217c683366 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_pipeline_execution_project_schedules
    ADD CONSTRAINT fk_21a3dca413 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE p_ci_build_trace_metadata
    ADD CONSTRAINT fk_21d25cac1a_p FOREIGN KEY (partition_id, trace_artifact_id) REFERENCES p_ci_job_artifacts(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY users_star_projects
    ADD CONSTRAINT fk_22cd27ddfc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alerts
    ADD CONSTRAINT fk_2358b75436 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY design_management_designs
    ADD CONSTRAINT fk_239cd63678 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_uploads
    ADD CONSTRAINT fk_23e0e92313 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters
    ADD CONSTRAINT fk_23f3ab7df0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY zentao_tracker_data
    ADD CONSTRAINT fk_2417fd4262 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY import_failures
    ADD CONSTRAINT fk_24b824da43 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_ci_cd_settings
    ADD CONSTRAINT fk_24c15d2f2e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repository_storage_moves
    ADD CONSTRAINT fk_2522a20cfb FOREIGN KEY (snippet_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_pipeline_execution_policy_config_links
    ADD CONSTRAINT fk_256bbe966d FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT fk_256c631779 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY user_group_member_roles
    ADD CONSTRAINT fk_257d7c48b8 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoekt_repositories
    ADD CONSTRAINT fk_25a92aeccd FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE p_ci_pipelines
    ADD CONSTRAINT fk_262d4c2d19_p FOREIGN KEY (auto_canceled_by_partition_id, auto_canceled_by_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE SET NULL;

ALTER TABLE ONLY audit_events_instance_amazon_s3_configurations
    ADD CONSTRAINT fk_266365d2b0 FOREIGN KEY (stream_destination_id) REFERENCES audit_events_instance_external_streaming_destinations(id) ON DELETE SET NULL;

ALTER TABLE ONLY user_namespace_callouts
    ADD CONSTRAINT fk_27a69fd1bd FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_details
    ADD CONSTRAINT fk_27ac767d6a FOREIGN KEY (bot_namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY issuable_slas
    ADD CONSTRAINT fk_282ef683a5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT fk_283fb4ad36 FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;

ALTER TABLE ONLY resource_milestone_events
    ADD CONSTRAINT fk_2867e9284c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_group_links
    ADD CONSTRAINT fk_28a1244b01 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY merge_requests_compliance_violations
    ADD CONSTRAINT fk_290ec1ab02 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY system_access_group_microsoft_graph_access_tokens
    ADD CONSTRAINT fk_2957addd0d FOREIGN KEY (system_access_group_microsoft_application_id) REFERENCES system_access_group_microsoft_applications(id) ON DELETE CASCADE;

ALTER TABLE ONLY coverage_fuzzing_corpuses
    ADD CONSTRAINT fk_29f6f15f82 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_link_events
    ADD CONSTRAINT fk_2a039c40f4 FOREIGN KEY (system_note_metadata_id) REFERENCES system_note_metadata(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidates
    ADD CONSTRAINT fk_2a0421d824 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules
    ADD CONSTRAINT fk_2a74c6e52d FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_labels
    ADD CONSTRAINT fk_2adb910a2e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_group_authorizations
    ADD CONSTRAINT fk_2c9f941965 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployment_approvals
    ADD CONSTRAINT fk_2d060dfc73 FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_trackers
    ADD CONSTRAINT fk_2d0e051bc3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT fk_2d0f7ebf48 FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY audit_events_instance_external_audit_event_destinations
    ADD CONSTRAINT fk_2d3ebd0fbc FOREIGN KEY (stream_destination_id) REFERENCES audit_events_instance_external_streaming_destinations(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_conan_file_metadata
    ADD CONSTRAINT fk_2e2815280f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_user_preferences
    ADD CONSTRAINT fk_2e37b4f066 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY notes
    ADD CONSTRAINT fk_2e82291620 FOREIGN KEY (review_id) REFERENCES reviews(id) ON DELETE SET NULL;

ALTER TABLE ONLY lfs_objects_projects
    ADD CONSTRAINT fk_2eb33f7a78 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY vulnerability_merge_request_links
    ADD CONSTRAINT fk_2ef3954596 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_tracker_data
    ADD CONSTRAINT fk_2ef8e4e35b FOREIGN KEY (instance_integration_id) REFERENCES instance_integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_composer_packages
    ADD CONSTRAINT fk_2f085bfc2a FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY required_code_owners_sections
    ADD CONSTRAINT fk_2f43f5cbbb FOREIGN KEY (protected_branch_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_workflows
    ADD CONSTRAINT fk_2f6398d8ee FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY members
    ADD CONSTRAINT fk_2f85abf8f1 FOREIGN KEY (member_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_group_links
    ADD CONSTRAINT fk_2fbc7071a3 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY zoekt_replicas
    ADD CONSTRAINT fk_3035f4b498 FOREIGN KEY (zoekt_enabled_namespace_id) REFERENCES zoekt_enabled_namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_group_stages
    ADD CONSTRAINT fk_3078345d6d FOREIGN KEY (stage_event_hash_id) REFERENCES analytics_cycle_analytics_stage_event_hashes(id) ON DELETE CASCADE;

ALTER TABLE ONLY oauth_device_grants
    ADD CONSTRAINT fk_308d5b76fe FOREIGN KEY (application_id) REFERENCES oauth_applications(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_group_links
    ADD CONSTRAINT fk_30ec712bec FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_30f2a831f4 FOREIGN KEY (iteration_id) REFERENCES sprints(id) ON DELETE CASCADE;

ALTER TABLE ONLY approvals
    ADD CONSTRAINT fk_310d714958 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_file_metadata
    ADD CONSTRAINT fk_31440cf2d5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespaces
    ADD CONSTRAINT fk_319256d87a FOREIGN KEY (file_template_project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY organization_user_aliases
    ADD CONSTRAINT fk_31b4eb5ec5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repository_storage_moves
    ADD CONSTRAINT fk_321e6c6235 FOREIGN KEY (snippet_organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_approval_metrics
    ADD CONSTRAINT fk_324639fb86 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_unprotect_access_levels
    ADD CONSTRAINT fk_325cad614b FOREIGN KEY (protected_branch_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_entities
    ADD CONSTRAINT fk_32782a175e FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_framework_security_policies
    ADD CONSTRAINT fk_32fbe15af3 FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY design_management_repositories
    ADD CONSTRAINT fk_335d4698e2 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_tracker_data
    ADD CONSTRAINT fk_33921c0ee1 FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_project_callouts
    ADD CONSTRAINT fk_33b4814f6b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects_branch_rules_squash_options
    ADD CONSTRAINT fk_33b614a558 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespaces
    ADD CONSTRAINT fk_3448c97865 FOREIGN KEY (push_rule_id) REFERENCES push_rules(id) ON DELETE SET NULL;

ALTER TABLE ONLY project_topics
    ADD CONSTRAINT fk_34af9ab07a FOREIGN KEY (topic_id) REFERENCES topics(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespaces
    ADD CONSTRAINT fk_34fceca87c FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY saml_providers
    ADD CONSTRAINT fk_351dde3a84 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_3654b61b03 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY sprints
    ADD CONSTRAINT fk_365d1db505 FOREIGN KEY (iterations_cadence_id) REFERENCES iterations_cadences(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_feature_flags_issues
    ADD CONSTRAINT fk_3685a990ae FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_statuses
    ADD CONSTRAINT fk_3694bacabe FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY push_event_payloads
    ADD CONSTRAINT fk_36c74129da FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_cluster_agent_mappings
    ADD CONSTRAINT fk_3727f3f4ec FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_merge_access_levels
    ADD CONSTRAINT fk_37ab3dd3ba FOREIGN KEY (protected_branch_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_tag_create_access_levels
    ADD CONSTRAINT fk_386a642e13 FOREIGN KEY (deploy_key_id) REFERENCES keys(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_events
    ADD CONSTRAINT fk_38a74279df FOREIGN KEY (updated_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY import_export_uploads
    ADD CONSTRAINT fk_38e11735aa FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY approval_group_rules_users
    ADD CONSTRAINT fk_3995d73930 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_exports
    ADD CONSTRAINT fk_39c726d3b5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_versions
    ADD CONSTRAINT fk_39f8aa0b8a FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;

ALTER TABLE p_ci_builds
    ADD CONSTRAINT fk_3a9eaa254d_p FOREIGN KEY (partition_id, stage_id) REFERENCES p_ci_stages(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY draft_notes
    ADD CONSTRAINT fk_3ac2bcb746 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_checkpoint_writes
    ADD CONSTRAINT fk_3ad0964729 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT fk_3af186389b FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE SET NULL;

ALTER TABLE ONLY protected_environment_approval_rules
    ADD CONSTRAINT fk_3b3f2f0470 FOREIGN KEY (protected_environment_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_3b8c72ea56 FOREIGN KEY (sprint_id) REFERENCES sprints(id) ON DELETE SET NULL;

ALTER TABLE ONLY merge_request_reviewers
    ADD CONSTRAINT fk_3b8e02a846 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_3c1fd1cccc FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;

ALTER TABLE ONLY release_links
    ADD CONSTRAINT fk_3cb34866ac FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_uploads
    ADD CONSTRAINT fk_3cbf0b9a2e FOREIGN KEY (batch_id) REFERENCES bulk_import_export_batches(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_framework_security_policies
    ADD CONSTRAINT fk_3ce58167f1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE p_ci_pipelines
    ADD CONSTRAINT fk_3d34ab2e06 FOREIGN KEY (pipeline_schedule_id) REFERENCES ci_pipeline_schedules(id) ON DELETE SET NULL;

ALTER TABLE ONLY scan_result_policy_violations
    ADD CONSTRAINT fk_3d58aa6aee FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_slugs
    ADD CONSTRAINT fk_3d71295ac9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_rule_schedules
    ADD CONSTRAINT fk_3e78b9a150 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_reports
    ADD CONSTRAINT fk_3fe6467b93 FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY merge_requests_approval_rules_approver_users
    ADD CONSTRAINT fk_4025feea5b FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_approval_rules
    ADD CONSTRAINT fk_405568b491 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_pipeline_execution_policy_config_links
    ADD CONSTRAINT fk_40c1d0c74a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_add_on_purchases
    ADD CONSTRAINT fk_410004d68b FOREIGN KEY (subscription_add_on_id) REFERENCES subscription_add_ons(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_assignees
    ADD CONSTRAINT fk_419f7a11fa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_pipeline_schedule_variables
    ADD CONSTRAINT fk_41c35fda51 FOREIGN KEY (pipeline_schedule_id) REFERENCES ci_pipeline_schedules(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_bans
    ADD CONSTRAINT fk_4275fbb1d7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY geo_event_log
    ADD CONSTRAINT fk_42c3b54bed FOREIGN KEY (cache_invalidation_event_id) REFERENCES geo_cache_invalidation_events(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_predictions
    ADD CONSTRAINT fk_42d3b3824f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY remote_mirrors
    ADD CONSTRAINT fk_43a9aa4ca8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_notes
    ADD CONSTRAINT fk_44166fe70f FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_events
    ADD CONSTRAINT fk_4432fc4d78 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY todos
    ADD CONSTRAINT fk_45054f9c45 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_projects
    ADD CONSTRAINT fk_451a9dfe93 FOREIGN KEY (approval_rule_id) REFERENCES merge_requests_approval_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_user_details
    ADD CONSTRAINT fk_4533918f8e FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_settings
    ADD CONSTRAINT fk_4571bb0ccc FOREIGN KEY (duo_workflow_oauth_application_id) REFERENCES oauth_applications(id) ON DELETE SET NULL;

ALTER TABLE ONLY security_policy_requirements
    ADD CONSTRAINT fk_458f7f5ad5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_google_cloud_logging_configurations
    ADD CONSTRAINT fk_4601829756 FOREIGN KEY (stream_destination_id) REFERENCES audit_events_group_external_streaming_destinations(id) ON DELETE SET NULL;

ALTER TABLE ONLY releases
    ADD CONSTRAINT fk_47fe2a0596 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_scopes
    ADD CONSTRAINT fk_4913f5d6a2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_compliance_violations
    ADD CONSTRAINT fk_492a40969e FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY workspace_variables
    ADD CONSTRAINT fk_494e093520 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_url_configurations
    ADD CONSTRAINT fk_49b126e246 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_issuable_escalation_statuses
    ADD CONSTRAINT fk_4a05518b10 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_organization_authorizations
    ADD CONSTRAINT fk_4a86e6225d FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_component_last_usages
    ADD CONSTRAINT fk_4adc9539c0 FOREIGN KEY (catalog_resource_id) REFERENCES catalog_resources(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_namespace_callouts
    ADD CONSTRAINT fk_4b1257f385 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspace_agentk_states
    ADD CONSTRAINT fk_4b1428e43a FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_occurrences
    ADD CONSTRAINT fk_4b88e5b255 FOREIGN KEY (component_version_id) REFERENCES sbom_component_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_assignees
    ADD CONSTRAINT fk_4b97267a3e FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_recipe_revisions
    ADD CONSTRAINT fk_4d18bd6f82 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_commit_emails
    ADD CONSTRAINT fk_4d6ba63ba5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_external_audit_event_destinations
    ADD CONSTRAINT fk_4df855d797 FOREIGN KEY (stream_destination_id) REFERENCES audit_events_group_external_streaming_destinations(id) ON DELETE SET NULL;

ALTER TABLE ONLY vulnerabilities
    ADD CONSTRAINT fk_4e64972902 FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_versions
    ADD CONSTRAINT fk_4e8b59e7a8 FOREIGN KEY (model_id) REFERENCES ml_models(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_achievements
    ADD CONSTRAINT fk_4efde02858 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_protected_branches
    ADD CONSTRAINT fk_4f85f13b20 FOREIGN KEY (approval_group_rule_id) REFERENCES approval_group_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_standards_adherence
    ADD CONSTRAINT fk_4fd1d9d9b0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY board_assignees
    ADD CONSTRAINT fk_50159bc755 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_groups
    ADD CONSTRAINT fk_50edc8134e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_protected_branches
    ADD CONSTRAINT fk_514003db08 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY deploy_tokens
    ADD CONSTRAINT fk_51bf7bfb69 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_models
    ADD CONSTRAINT fk_51e87f7c50_new FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY path_locks
    ADD CONSTRAINT fk_5265c98f24 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_user_access_group_authorizations
    ADD CONSTRAINT fk_53fd98ccbf FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_crm_settings
    ADD CONSTRAINT fk_54592e5f57 FOREIGN KEY (source_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY epic_issues
    ADD CONSTRAINT fk_54dd5d38a7 FOREIGN KEY (work_item_parent_link_id) REFERENCES work_item_parent_links(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_violations_issues
    ADD CONSTRAINT fk_5580918168 FOREIGN KEY (project_compliance_violation_id) REFERENCES project_compliance_violations(id) ON DELETE CASCADE;

ALTER TABLE ONLY terraform_states
    ADD CONSTRAINT fk_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY import_failures
    ADD CONSTRAINT fk_55a1708b56 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY status_check_responses
    ADD CONSTRAINT fk_55bd2abc83 FOREIGN KEY (external_status_check_id) REFERENCES external_status_checks(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_metrics
    ADD CONSTRAINT fk_56067dcb44 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_preferences
    ADD CONSTRAINT fk_561e98d37c FOREIGN KEY (default_duo_add_on_assignment_id) REFERENCES subscription_user_add_on_assignments(id) ON DELETE SET NULL;

ALTER TABLE ONLY protected_branch_unprotect_access_levels
    ADD CONSTRAINT fk_5632201009 FOREIGN KEY (protected_branch_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diffs
    ADD CONSTRAINT fk_56ac6fc9c0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidates
    ADD CONSTRAINT fk_56d6ed4d3d FOREIGN KEY (experiment_id) REFERENCES ml_experiments(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspace_tokens
    ADD CONSTRAINT fk_5724f2499d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects_branch_rules_squash_options
    ADD CONSTRAINT fk_574b8d531f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_notes
    ADD CONSTRAINT fk_57fb3e3bf2 FOREIGN KEY (resolved_by_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules
    ADD CONSTRAINT fk_5822f009ea FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_approver_users
    ADD CONSTRAINT fk_582e5f36e8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_participants
    ADD CONSTRAINT fk_587217e733 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY deploy_keys_projects
    ADD CONSTRAINT fk_58a901ca7e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_groups
    ADD CONSTRAINT fk_59068f09e5 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_statuses
    ADD CONSTRAINT fk_590e87b7c7 FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY oauth_access_grants
    ADD CONSTRAINT fk_59cdb2323c FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_tags
    ADD CONSTRAINT fk_5a230894f6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_policy_project_links
    ADD CONSTRAINT fk_5a5eba6f88 FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY zentao_tracker_data
    ADD CONSTRAINT fk_5a5f50a792 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY project_export_jobs
    ADD CONSTRAINT fk_5ab0242530 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY security_policy_requirements
    ADD CONSTRAINT fk_5b4fae9635 FOREIGN KEY (compliance_requirement_id) REFERENCES compliance_requirements(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_file_metadata
    ADD CONSTRAINT fk_5bb7e23d6d FOREIGN KEY (package_revision_id) REFERENCES packages_conan_package_revisions(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_broadcast_message_dismissals
    ADD CONSTRAINT fk_5c0cfb74ce FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_email_participants
    ADD CONSTRAINT fk_5cb5a5b4f0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_lists
    ADD CONSTRAINT fk_5cbb450986 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_scanner_profiles_builds
    ADD CONSTRAINT fk_5d46286ad3 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_deploy_access_levels
    ADD CONSTRAINT fk_5d9b05a7e9 FOREIGN KEY (protected_environment_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_merge_requests
    ADD CONSTRAINT fk_5ddc4a2f7b FOREIGN KEY (approval_rule_id) REFERENCES merge_requests_approval_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_assignees
    ADD CONSTRAINT fk_5e0c8d9154 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY csv_issue_imports
    ADD CONSTRAINT fk_5e1572387c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY milestone_releases
    ADD CONSTRAINT fk_5e73b8cad2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repository_states
    ADD CONSTRAINT fk_5f750f3182 FOREIGN KEY (snippet_repository_id) REFERENCES snippet_repositories(snippet_id) ON DELETE CASCADE;

ALTER TABLE ONLY import_placeholder_user_details
    ADD CONSTRAINT fk_5f76b35426 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_conan_package_revisions
    ADD CONSTRAINT fk_5f7c6a9244 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_access_tokens
    ADD CONSTRAINT fk_5f7e8450e1 FOREIGN KEY (personal_access_token_id) REFERENCES personal_access_tokens(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_metrics
    ADD CONSTRAINT fk_5fc5653bb3 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_achievements
    ADD CONSTRAINT fk_60b12fcda3 FOREIGN KEY (awarded_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_6149611a04 FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT fk_614a3cdb95 FOREIGN KEY (created_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY member_approvals
    ADD CONSTRAINT fk_619f381144 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY deployment_approvals
    ADD CONSTRAINT fk_61cdbdc5b9 FOREIGN KEY (approval_rule_id) REFERENCES protected_environment_approval_rules(id) ON DELETE SET NULL;

ALTER TABLE ONLY dast_profile_schedules
    ADD CONSTRAINT fk_61d52aa0e7 FOREIGN KEY (dast_profile_id) REFERENCES dast_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY events
    ADD CONSTRAINT fk_61fbf6ca48 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_reads
    ADD CONSTRAINT fk_62736f638f FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_catalog_item_consumers
    ADD CONSTRAINT fk_6282f97083 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_admin_roles
    ADD CONSTRAINT fk_62ce6c86fd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diff_details
    ADD CONSTRAINT fk_63097c0adc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY saml_group_links
    ADD CONSTRAINT fk_6336b1d1d0 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY deployment_approvals
    ADD CONSTRAINT fk_63920ba071 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_641731faff FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY approval_group_rules
    ADD CONSTRAINT fk_64450bea52 FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_pipeline_chat_data
    ADD CONSTRAINT fk_64ebfab6b3_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_tokens
    ADD CONSTRAINT fk_64f741f626 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_user_details
    ADD CONSTRAINT fk_657140ae14 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_repository_states
    ADD CONSTRAINT fk_6591698505 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_placeholder_memberships
    ADD CONSTRAINT fk_66286fb5e6 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE p_ci_builds
    ADD CONSTRAINT fk_6661f4f0e8 FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE SET NULL;

ALTER TABLE ONLY duo_workflows_events
    ADD CONSTRAINT fk_674e493798 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY routes
    ADD CONSTRAINT fk_679ff8213d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_67f2498cc9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_approver_groups
    ADD CONSTRAINT fk_67fa93ad4b FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_conversation_messages
    ADD CONSTRAINT fk_68774ec148 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_6a5165a692 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;

ALTER TABLE ONLY ai_agent_versions
    ADD CONSTRAINT fk_6c2f682587 FOREIGN KEY (agent_id) REFERENCES ai_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_models
    ADD CONSTRAINT fk_6c95e61a6e FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY projects
    ADD CONSTRAINT fk_6ca23af0a3 FOREIGN KEY (project_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_framework_security_policies
    ADD CONSTRAINT fk_6d3bd0c9f1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_cluster_agent_mappings
    ADD CONSTRAINT fk_6d8bfa275e FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_instance_namespace_filters
    ADD CONSTRAINT fk_6e0be28087 FOREIGN KEY (external_streaming_destination_id) REFERENCES audit_events_instance_external_streaming_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY terraform_state_versions
    ADD CONSTRAINT fk_6e81384d7f FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT fk_6e8df43239 FOREIGN KEY (default_duplicate_status_id) REFERENCES work_item_custom_statuses(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_approval_rules
    ADD CONSTRAINT fk_6ee8249821 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY deploy_tokens
    ADD CONSTRAINT fk_7082f8a288 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY oauth_openid_requests
    ADD CONSTRAINT fk_7092424b77 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT fk_70dc11e706 FOREIGN KEY (protected_branch_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_failures
    ADD CONSTRAINT fk_70f30b02fd FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT fk_7111b68cdb FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_source_users
    ADD CONSTRAINT fk_719b74231d FOREIGN KEY (reassigned_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY integrations
    ADD CONSTRAINT fk_71cce407f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_package_references
    ADD CONSTRAINT fk_7210467bfc FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_user_add_on_assignments
    ADD CONSTRAINT fk_724c2df9a8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_approver_users
    ADD CONSTRAINT fk_725cca295c FOREIGN KEY (approval_rule_id) REFERENCES merge_requests_approval_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_user_mentions
    ADD CONSTRAINT fk_7280faac49 FOREIGN KEY (snippet_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY zentao_tracker_data
    ADD CONSTRAINT fk_72a0e59cd8 FOREIGN KEY (instance_integration_id) REFERENCES instance_integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_number_field_values
    ADD CONSTRAINT fk_72d475d3cd FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_metadata
    ADD CONSTRAINT fk_7302a29cd9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_violations_issues
    ADD CONSTRAINT fk_735afdd8a7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_statistics
    ADD CONSTRAINT fk_73a34da7d8 FOREIGN KEY (snippet_organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY index_statuses
    ADD CONSTRAINT fk_74b2492545 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_notes
    ADD CONSTRAINT fk_74e1990397 FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_merge_requests
    ADD CONSTRAINT fk_74e3466397 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY software_license_policies
    ADD CONSTRAINT fk_74f6d8328a FOREIGN KEY (custom_software_license_id) REFERENCES custom_software_licenses(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_tokens
    ADD CONSTRAINT fk_75008f3553 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY protected_tag_create_access_levels
    ADD CONSTRAINT fk_7537413f9d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY integrations
    ADD CONSTRAINT fk_755d734f25 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY resource_link_events
    ADD CONSTRAINT fk_75961aea6b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY environments
    ADD CONSTRAINT fk_75c2098045 FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE SET NULL;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_765e132668 FOREIGN KEY (work_item_parent_link_id) REFERENCES work_item_parent_links(id) ON DELETE SET NULL;

ALTER TABLE ONLY user_member_roles
    ADD CONSTRAINT fk_76b9a6bfac FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY notes
    ADD CONSTRAINT fk_76db6d50c6 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY oauth_openid_requests
    ADD CONSTRAINT fk_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES oauth_access_grants(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policy_violations
    ADD CONSTRAINT fk_77251168f1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules
    ADD CONSTRAINT fk_773289d10b FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_checkpoints
    ADD CONSTRAINT fk_779e1a4594 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_user_access_project_authorizations
    ADD CONSTRAINT fk_78034b05d8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_devops_adoption_snapshots
    ADD CONSTRAINT fk_78c9eac821 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_customer_relations_contacts
    ADD CONSTRAINT fk_79296ff8c6 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_repository_states
    ADD CONSTRAINT fk_794c47b7ba FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_meta_user_mentions
    ADD CONSTRAINT fk_7954f34107 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY topics
    ADD CONSTRAINT fk_79ae18bd4b FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_text_field_values
    ADD CONSTRAINT fk_79c719630f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_maven_metadata
    ADD CONSTRAINT fk_7a170ee0a3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_relation_exports
    ADD CONSTRAINT fk_7a4d3d5c0f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_7a5553d60f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branches
    ADD CONSTRAINT fk_7a9c6d93e7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policies
    ADD CONSTRAINT fk_7aa24439f1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_versions
    ADD CONSTRAINT fk_7ad8849db4 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules
    ADD CONSTRAINT fk_7af76dbd21 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_cluster_agent_mappings
    ADD CONSTRAINT fk_7b441007e5 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY issue_customer_relations_contacts
    ADD CONSTRAINT fk_7b92f835bb FOREIGN KEY (contact_id) REFERENCES customer_relations_contacts(id) ON DELETE CASCADE;

ALTER TABLE ONLY ssh_signatures
    ADD CONSTRAINT fk_7d2f93996c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_lifecycles
    ADD CONSTRAINT fk_7d5eb33a21 FOREIGN KEY (default_closed_status_id) REFERENCES work_item_custom_statuses(id) ON DELETE CASCADE;

ALTER TABLE ONLY sent_notifications
    ADD CONSTRAINT fk_7d7663e36a FOREIGN KEY (issue_email_participant_id) REFERENCES issue_email_participants(id) ON DELETE SET NULL NOT VALID;

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT fk_7d9260dbfb FOREIGN KEY (triggered_by_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY labels
    ADD CONSTRAINT fk_7de4989a69 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_uploads
    ADD CONSTRAINT fk_7e03e410b4 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_7e85395a64 FOREIGN KEY (sprint_id) REFERENCES sprints(id) ON DELETE SET NULL;

ALTER TABLE ONLY merge_request_metrics
    ADD CONSTRAINT fk_7f28d925f3 FOREIGN KEY (merged_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY namespaces
    ADD CONSTRAINT fk_7f813d8c90 FOREIGN KEY (parent_id) REFERENCES namespaces(id) ON DELETE RESTRICT NOT VALID;

ALTER TABLE ONLY pages_domain_acme_orders
    ADD CONSTRAINT fk_7fa123c002 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_workflows
    ADD CONSTRAINT fk_7fcf81369f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_import_states
    ADD CONSTRAINT fk_8053b3ebd6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_components
    ADD CONSTRAINT fk_8053c57c65 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY sprints
    ADD CONSTRAINT fk_80aa8a1f95 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_metric_images
    ADD CONSTRAINT fk_80b75a6094 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_weights_sources
    ADD CONSTRAINT fk_815ba3b395 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_user_mentions
    ADD CONSTRAINT fk_8175238264 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY related_epic_links
    ADD CONSTRAINT fk_8257080565 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_export_uploads
    ADD CONSTRAINT fk_83319d9721 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_npm_metadata
    ADD CONSTRAINT fk_83625a27c0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_approver_users
    ADD CONSTRAINT fk_836efc3006 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY push_rules
    ADD CONSTRAINT fk_83b29894de FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_imports
    ADD CONSTRAINT fk_843a1a583d FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_users
    ADD CONSTRAINT fk_8471abad75 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE RESTRICT NOT VALID;

ALTER TABLE ONLY merge_request_diffs
    ADD CONSTRAINT fk_8483f3258f FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policies
    ADD CONSTRAINT fk_84d4bc9abe FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY requirements
    ADD CONSTRAINT fk_85044baef0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_components
    ADD CONSTRAINT fk_85bb1d1e79 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY pages_deployment_states
    ADD CONSTRAINT fk_8610d3d1cc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_build_pending_states
    ADD CONSTRAINT fk_861cd17da3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY observability_logs_issues_connections
    ADD CONSTRAINT fk_86c5fb94cc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_package_files
    ADD CONSTRAINT fk_86f0f182f8 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diff_commit_users
    ADD CONSTRAINT fk_87f203759e FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_pypi_metadata
    ADD CONSTRAINT fk_884056a10f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_users
    ADD CONSTRAINT fk_888a0df3b7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_entities
    ADD CONSTRAINT fk_88c725229f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY requirements_management_test_reports
    ADD CONSTRAINT fk_88f30752fc FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidate_params
    ADD CONSTRAINT fk_8972b35c25 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_899c8f3231 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_build_trace_chunks
    ADD CONSTRAINT fk_89e29fa5ee_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_components
    ADD CONSTRAINT fk_89fd1a3e33 FOREIGN KEY (version_id) REFERENCES catalog_resource_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY epic_issues
    ADD CONSTRAINT fk_8a0fdc0d65 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_merge_access_levels
    ADD CONSTRAINT fk_8a3072ccb3 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT fk_8a4948b668 FOREIGN KEY (start_date_sourcing_work_item_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY work_item_custom_lifecycle_statuses
    ADD CONSTRAINT fk_8a6dadaf44 FOREIGN KEY (status_id) REFERENCES work_item_custom_statuses(id) ON DELETE CASCADE;

ALTER TABLE ONLY targeted_message_namespaces
    ADD CONSTRAINT fk_8ba73cd32a FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_failures
    ADD CONSTRAINT fk_8c0911e763 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_exports
    ADD CONSTRAINT fk_8c6f33cebe FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_settings
    ADD CONSTRAINT fk_8c711443b0 FOREIGN KEY (duo_workflow_service_account_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY subscription_seat_assignments
    ADD CONSTRAINT fk_8d214f4142 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_users
    ADD CONSTRAINT fk_8d9b20725d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY approval_merge_request_rules_approved_approvers
    ADD CONSTRAINT fk_8dfb93b836 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY raw_usage_data
    ADD CONSTRAINT fk_8e21125854 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY releases
    ADD CONSTRAINT fk_8e4456f90f FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY protected_tags
    ADD CONSTRAINT fk_8e4af87648 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY observability_metrics_issues_connections
    ADD CONSTRAINT fk_8e765678ba FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_group_namespace_filters
    ADD CONSTRAINT fk_8ed182d7da FOREIGN KEY (external_streaming_destination_id) REFERENCES audit_events_group_external_streaming_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_requirements
    ADD CONSTRAINT fk_8f5fb77fc7 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_shifts
    ADD CONSTRAINT fk_8f8f23decb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_component_last_usages
    ADD CONSTRAINT fk_909d62907f FOREIGN KEY (component_id) REFERENCES catalog_resource_components(id) ON DELETE CASCADE;

ALTER TABLE ONLY todos
    ADD CONSTRAINT fk_91d1f47b13 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_architectures
    ADD CONSTRAINT fk_92714bcab1 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY secret_detection_token_statuses
    ADD CONSTRAINT fk_928017ddbc FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspaces_agent_configs
    ADD CONSTRAINT fk_94660551c8 FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY oauth_access_tokens
    ADD CONSTRAINT fk_94884daa35 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_site_profiles_builds
    ADD CONSTRAINT fk_94e80df60e FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY milestones
    ADD CONSTRAINT fk_95650a40d4 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_list_user_preferences
    ADD CONSTRAINT fk_95eac55851 FOREIGN KEY (epic_list_id) REFERENCES boards_epic_lists(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_blob_states
    ADD CONSTRAINT fk_95ee495fd6 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_96b1dd429c FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;

ALTER TABLE ONLY resource_weight_events
    ADD CONSTRAINT fk_97c7849ca4 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_user_access_group_authorizations
    ADD CONSTRAINT fk_97ce8e8284 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_occurrences
    ADD CONSTRAINT fk_97ffe77653 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE SET NULL;

ALTER TABLE ONLY project_control_compliance_statuses
    ADD CONSTRAINT fk_9826fbb4a6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY required_code_owners_sections
    ADD CONSTRAINT fk_98c3f48741 FOREIGN KEY (protected_branch_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_runner_projects
    ADD CONSTRAINT fk_98f08fcaf7 FOREIGN KEY (runner_id) REFERENCES project_type_ci_runners(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_merge_access_levels
    ADD CONSTRAINT fk_98f3d044fe FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY notes
    ADD CONSTRAINT fk_99e097b079 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_users
    ADD CONSTRAINT fk_9a4b673183 FOREIGN KEY (approval_group_rule_id) REFERENCES approval_group_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_component_files
    ADD CONSTRAINT fk_9a816f378c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_failures
    ADD CONSTRAINT fk_9a9b9ba21c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects
    ADD CONSTRAINT fk_9aee26923d FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY deploy_tokens
    ADD CONSTRAINT fk_9b0d2e92a6 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_migrations
    ADD CONSTRAINT fk_9b274efd3a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY project_compliance_violations
    ADD CONSTRAINT fk_9bbcb08120 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_checkpoint_writes
    ADD CONSTRAINT fk_9bcf756a7e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY milestones
    ADD CONSTRAINT fk_9bd0a0c791 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_parent_links
    ADD CONSTRAINT fk_9be5ef5f80 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT fk_9c07afa098 FOREIGN KEY (agent_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_9c4516d665 FOREIGN KEY (duplicated_to_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY clusters_managed_resources
    ADD CONSTRAINT fk_9c7b561962 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_recipe_revisions
    ADD CONSTRAINT fk_9cdec8a86b FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_9d480c64b2 FOREIGN KEY (start_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;

ALTER TABLE ONLY bulk_import_trackers
    ADD CONSTRAINT fk_9dc0581779 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_group_callouts
    ADD CONSTRAINT fk_9dc8b9d4b2 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_unit_test_failures
    ADD CONSTRAINT fk_9e0fc58930_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY protected_environments
    ADD CONSTRAINT fk_9e112565b7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_catalog_item_consumers
    ADD CONSTRAINT fk_9e3abe6238 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alerts
    ADD CONSTRAINT fk_9e49e5c2b7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_cost_settings
    ADD CONSTRAINT fk_9e5e051839 FOREIGN KEY (runner_id) REFERENCES instance_type_ci_runners(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_tracker_data
    ADD CONSTRAINT fk_9e6e0e7d23 FOREIGN KEY (instance_integration_id) REFERENCES instance_integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_policy_rule_project_links
    ADD CONSTRAINT fk_9ed5cf0600 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_rpm_metadata
    ADD CONSTRAINT fk_9f1814eb36 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT fk_9ffc86a3d9 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployment_merge_requests
    ADD CONSTRAINT fk_a064ff4453 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_violations
    ADD CONSTRAINT fk_a066372b6c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_a194299be1 FOREIGN KEY (moved_to_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY audit_events_streaming_group_namespace_filters
    ADD CONSTRAINT fk_a1a4486a96 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidates
    ADD CONSTRAINT fk_a1d5f1bc45 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;

ALTER TABLE ONLY subscription_add_on_purchases
    ADD CONSTRAINT fk_a1db288990 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_approval_rules
    ADD CONSTRAINT fk_a3cc825836 FOREIGN KEY (protected_environment_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_assignment_events
    ADD CONSTRAINT fk_a437da318b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_entities
    ADD CONSTRAINT fk_a44ff95be5 FOREIGN KEY (parent_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_import_users
    ADD CONSTRAINT fk_a49233ca5d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_user_mentions
    ADD CONSTRAINT fk_a4bd02b7df FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_configurations
    ADD CONSTRAINT fk_a50430b375 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_violations
    ADD CONSTRAINT fk_a504c811d1 FOREIGN KEY (compliance_requirements_control_id) REFERENCES compliance_requirements_controls(id) ON DELETE CASCADE;

ALTER TABLE ONLY issuable_metric_images
    ADD CONSTRAINT fk_a53e03ca65 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_strategies
    ADD CONSTRAINT fk_a542e10c31 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_lifecycle_statuses
    ADD CONSTRAINT fk_a546eef539 FOREIGN KEY (lifecycle_id) REFERENCES work_item_custom_lifecycles(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_tracker_data
    ADD CONSTRAINT fk_a54bddafd2 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY lfs_objects_projects
    ADD CONSTRAINT fk_a56e02279c FOREIGN KEY (lfs_object_id) REFERENCES lfs_objects(id) ON DELETE RESTRICT NOT VALID;

ALTER TABLE ONLY merge_request_merge_schedules
    ADD CONSTRAINT fk_a5ff9339a9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_a6963e8447 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_pipeline_execution_project_schedules
    ADD CONSTRAINT fk_a766128d99 FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_policy_settings
    ADD CONSTRAINT fk_a79f0f4501 FOREIGN KEY (csp_namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY snippet_statistics
    ADD CONSTRAINT fk_a8031c4c3e FOREIGN KEY (snippet_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_closing_issues
    ADD CONSTRAINT fk_a8703820ae FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_catalog_item_versions
    ADD CONSTRAINT fk_a98456de32 FOREIGN KEY (ai_catalog_item_id) REFERENCES ai_catalog_items(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_assignment_events
    ADD CONSTRAINT fk_a989e2acd0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY status_page_published_incidents
    ADD CONSTRAINT fk_a9fb727793 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_group_member_roles
    ADD CONSTRAINT fk_aa0ed88ba1 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ssh_signatures
    ADD CONSTRAINT fk_aa1efbe865 FOREIGN KEY (key_id) REFERENCES keys(id) ON DELETE SET NULL;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_aa5798e761 FOREIGN KEY (closed_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY alert_management_alerts
    ADD CONSTRAINT fk_aad61aedca FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE SET NULL;

ALTER TABLE ONLY identities
    ADD CONSTRAINT fk_aade90f0fc FOREIGN KEY (saml_provider_id) REFERENCES saml_providers(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards
    ADD CONSTRAINT fk_ab0a250ff6 FOREIGN KEY (iteration_cadence_id) REFERENCES iterations_cadences(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_failures
    ADD CONSTRAINT fk_ab7859bdc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY audit_events_streaming_http_instance_namespace_filters
    ADD CONSTRAINT fk_abe44125bc FOREIGN KEY (audit_events_instance_external_audit_event_destination_id) REFERENCES audit_events_instance_external_audit_event_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_instance_namespace_filters
    ADD CONSTRAINT fk_ac20a85a68 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_progresses
    ADD CONSTRAINT fk_acdc04a1e3 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_ad525e1f87 FOREIGN KEY (merge_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ml_experiments
    ADD CONSTRAINT fk_ad89c59858 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_metrics
    ADD CONSTRAINT fk_ae440388cc FOREIGN KEY (latest_closed_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_nuget_dependency_link_metadata
    ADD CONSTRAINT fk_ae9b989220 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules_projects
    ADD CONSTRAINT fk_af4078336f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_group_stages
    ADD CONSTRAINT fk_analytics_cycle_analytics_group_stages_group_value_stream_id FOREIGN KEY (group_value_stream_id) REFERENCES analytics_cycle_analytics_group_value_streams(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules
    ADD CONSTRAINT fk_approval_merge_request_rules_on_scan_result_policy_id FOREIGN KEY (scan_result_policy_id) REFERENCES scan_result_policies(id) ON DELETE SET NULL;

ALTER TABLE ONLY fork_network_members
    ADD CONSTRAINT fk_b01280dae4 FOREIGN KEY (forked_from_project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY ml_candidate_metadata
    ADD CONSTRAINT fk_b044692715 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_designs_versions
    ADD CONSTRAINT fk_b054e8aa82 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY custom_field_select_options
    ADD CONSTRAINT fk_b16c0bad2c FOREIGN KEY (custom_field_id) REFERENCES custom_fields(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_occurrences
    ADD CONSTRAINT fk_b1b65d8d17 FOREIGN KEY (source_package_id) REFERENCES sbom_source_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_text_field_values
    ADD CONSTRAINT fk_b22fe079a2 FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_access_tokens
    ADD CONSTRAINT fk_b27801bfbf FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_reads
    ADD CONSTRAINT fk_b28c28abf1 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;

ALTER TABLE ONLY member_approvals
    ADD CONSTRAINT fk_b2e4a4b68a FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE;

ALTER TABLE ONLY related_epic_links
    ADD CONSTRAINT fk_b30520b698 FOREIGN KEY (issue_link_id) REFERENCES issue_links(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects_branch_rules_merge_request_approval_settings
    ADD CONSTRAINT fk_b322a941f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_tracker_data
    ADD CONSTRAINT fk_b33e816ada FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_b37be69be6 FOREIGN KEY (work_item_type_id) REFERENCES work_item_types(id);

ALTER TABLE ONLY duo_workflows_checkpoints
    ADD CONSTRAINT fk_b3d9cea509 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_package_revisions
    ADD CONSTRAINT fk_b482b1a2f8 FOREIGN KEY (package_reference_id) REFERENCES packages_conan_package_references(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_seat_assignments
    ADD CONSTRAINT fk_b4bdbc61ee FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_tag_create_access_levels
    ADD CONSTRAINT fk_b4eb82fe3c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY status_check_responses
    ADD CONSTRAINT fk_b53bf31a72 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_dependency_links
    ADD CONSTRAINT fk_b5c56b6ede FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_conversation_messages
    ADD CONSTRAINT fk_b5d715b1e4 FOREIGN KEY (agent_version_id) REFERENCES ai_agent_versions(id) ON DELETE SET NULL;

ALTER TABLE ONLY compliance_framework_security_policies
    ADD CONSTRAINT fk_b5df066d8f FOREIGN KEY (framework_id) REFERENCES compliance_management_frameworks(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_file_metadata
    ADD CONSTRAINT fk_b656d41048 FOREIGN KEY (package_reference_id) REFERENCES packages_conan_package_references(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_versions
    ADD CONSTRAINT fk_b670eae96b FOREIGN KEY (catalog_resource_id) REFERENCES catalog_resources(id) ON DELETE CASCADE;

ALTER TABLE ONLY description_versions
    ADD CONSTRAINT fk_b688e93ee1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_entities
    ADD CONSTRAINT fk_b69fa2b2df FOREIGN KEY (bulk_import_id) REFERENCES bulk_imports(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_policy_requirements
    ADD CONSTRAINT fk_b6e48e3428 FOREIGN KEY (compliance_framework_security_policy_id) REFERENCES compliance_framework_security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_rubygems_metadata
    ADD CONSTRAINT fk_b73c052149 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_management_frameworks
    ADD CONSTRAINT fk_b74c45b71f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_experiment_metadata
    ADD CONSTRAINT fk_b764e76c6c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_package_references
    ADD CONSTRAINT fk_b7c05e1b1c FOREIGN KEY (recipe_revision_id) REFERENCES packages_conan_recipe_revisions(id) ON DELETE CASCADE;

ALTER TABLE ONLY external_status_checks_protected_branches
    ADD CONSTRAINT fk_b7d788e813 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_assignees
    ADD CONSTRAINT fk_b7d881734a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_project_authorizations
    ADD CONSTRAINT fk_b7fe9b4777 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_import_users
    ADD CONSTRAINT fk_b82be3e1f3 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_commit_emails
    ADD CONSTRAINT fk_b8d89d555e FOREIGN KEY (email_id) REFERENCES emails(id) ON DELETE CASCADE;

ALTER TABLE ONLY customer_relations_contacts
    ADD CONSTRAINT fk_b91ddd9345 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY uploads
    ADD CONSTRAINT fk_b94f059d73 FOREIGN KEY (uploaded_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY system_access_group_microsoft_graph_access_tokens
    ADD CONSTRAINT fk_b961a3df76 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployments
    ADD CONSTRAINT fk_b9a3851b82 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_select_field_values
    ADD CONSTRAINT fk_b9a434f5b2 FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_meta_user_mentions
    ADD CONSTRAINT fk_ba8a9d7f95 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_standards_adherence
    ADD CONSTRAINT fk_baf6f6f878 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE p_ci_runner_machine_builds
    ADD CONSTRAINT fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY ai_catalog_item_consumers
    ADD CONSTRAINT fk_bba1649fa5 FOREIGN KEY (ai_catalog_item_id) REFERENCES ai_catalog_items(id) ON DELETE RESTRICT;

ALTER TABLE ONLY wiki_page_meta_user_mentions
    ADD CONSTRAINT fk_bc155eba89 FOREIGN KEY (wiki_page_meta_id) REFERENCES wiki_page_meta(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_rule_schedules
    ADD CONSTRAINT fk_bcbb90477f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_bans
    ADD CONSTRAINT fk_bcc024eef2 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY gitlab_subscriptions
    ADD CONSTRAINT fk_bd0c4019c3 FOREIGN KEY (hosted_plan_id) REFERENCES plans(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_versions
    ADD CONSTRAINT fk_bd1b87591a FOREIGN KEY (published_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY resource_link_events
    ADD CONSTRAINT fk_bd4ae15ce4 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY workspaces
    ADD CONSTRAINT fk_bdb0b31131 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_framework_settings
    ADD CONSTRAINT fk_be413374a9 FOREIGN KEY (framework_id) REFERENCES compliance_management_frameworks(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippets
    ADD CONSTRAINT fk_be41fd4bb7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_sources_pipelines
    ADD CONSTRAINT fk_be5624bf37_p FOREIGN KEY (source_partition_id, source_job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY packages_maven_metadata
    ADD CONSTRAINT fk_be88aed360 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_cluster_agent_mappings
    ADD CONSTRAINT fk_be8e9c740f FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY oauth_device_grants
    ADD CONSTRAINT fk_bee7254887 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoekt_indices
    ADD CONSTRAINT fk_bf205d4773 FOREIGN KEY (zoekt_enabled_namespace_id) REFERENCES zoekt_enabled_namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_build_infos
    ADD CONSTRAINT fk_c0bc6b19ff FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_versions
    ADD CONSTRAINT fk_c1440b4896 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_packages
    ADD CONSTRAINT fk_c188f0dba4 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY sbom_occurrences
    ADD CONSTRAINT fk_c2a5562923 FOREIGN KEY (source_id) REFERENCES sbom_sources(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_group_callouts
    ADD CONSTRAINT fk_c366e12ec3 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY targeted_message_dismissals
    ADD CONSTRAINT fk_c3ccbe51e2 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY timelogs
    ADD CONSTRAINT fk_c49c83dd77 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_graph_paths
    ADD CONSTRAINT fk_c4c7d16f3e FOREIGN KEY (ancestor_id) REFERENCES sbom_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_repository_states
    ADD CONSTRAINT fk_c558ca51b8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_c63cbf6c25 FOREIGN KEY (closed_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY issue_tracker_data
    ADD CONSTRAINT fk_c65b54013d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY sbom_occurrences_vulnerabilities
    ADD CONSTRAINT fk_c677cb859e FOREIGN KEY (sbom_occurrence_id) REFERENCES sbom_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_c78fbacd64 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_list_user_preferences
    ADD CONSTRAINT fk_c7a4729d4e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_broadcast_message_dismissals
    ADD CONSTRAINT fk_c7cbf5566d FOREIGN KEY (broadcast_message_id) REFERENCES broadcast_messages(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_distribution_keys
    ADD CONSTRAINT fk_c802025a67 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT fk_c815368376 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT fk_c8b006d40f FOREIGN KEY (agent_token_id) REFERENCES cluster_agent_tokens(id) ON DELETE SET NULL;

ALTER TABLE ONLY design_user_mentions
    ADD CONSTRAINT fk_c8d8144d72 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_links
    ADD CONSTRAINT fk_c900194ff2 FOREIGN KEY (source_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_exports
    ADD CONSTRAINT fk_c9250a4d3f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY personal_access_tokens
    ADD CONSTRAINT fk_c951fbf57e FOREIGN KEY (previous_personal_access_token_id) REFERENCES personal_access_tokens(id) ON DELETE SET NULL;

ALTER TABLE ONLY jira_tracker_data
    ADD CONSTRAINT fk_c98abcd54c FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY evidences
    ADD CONSTRAINT fk_ca4bbc114d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_add_on_purchases
    ADD CONSTRAINT fk_caed789645 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_workflows
    ADD CONSTRAINT fk_cb28eb3e34 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_member_roles
    ADD CONSTRAINT fk_cb5a805cd4 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_labels
    ADD CONSTRAINT fk_cb8ded70e2 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approvals
    ADD CONSTRAINT fk_cbce403122 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY slack_integrations
    ADD CONSTRAINT fk_cbe270434e FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY external_status_checks_protected_branches
    ADD CONSTRAINT fk_cc0dcc36d1 FOREIGN KEY (external_status_check_id) REFERENCES external_status_checks(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_profiles_pipelines
    ADD CONSTRAINT fk_cc206a8c13 FOREIGN KEY (dast_profile_id) REFERENCES dast_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_settings
    ADD CONSTRAINT fk_cce81e0b9a FOREIGN KEY (amazon_q_service_account_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY todos
    ADD CONSTRAINT fk_ccf0373936 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_architectures
    ADD CONSTRAINT fk_cd96fce0a1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_escalation_rules
    ADD CONSTRAINT fk_cdfc40b861 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_dependencies
    ADD CONSTRAINT fk_cea1124da7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_rotations
    ADD CONSTRAINT fk_cecf1b51f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_framework_security_policies
    ADD CONSTRAINT fk_cf3c0ac207 FOREIGN KEY (policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_custom_fields
    ADD CONSTRAINT fk_cf7da43538 FOREIGN KEY (custom_field_id) REFERENCES custom_fields(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_assignment_events
    ADD CONSTRAINT fk_cfd2073177 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY custom_emoji
    ADD CONSTRAINT fk_custom_emoji_creator_id FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_meta
    ADD CONSTRAINT fk_d054484f21 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_entities
    ADD CONSTRAINT fk_d06d023c30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_user_add_on_assignments
    ADD CONSTRAINT fk_d1074a6e16 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_mirror_data
    ADD CONSTRAINT fk_d1aad367d7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY environments
    ADD CONSTRAINT fk_d1c8c1da6a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_user_mentions
    ADD CONSTRAINT fk_d1f967521a FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_group_member_roles
    ADD CONSTRAINT fk_d222d57eec FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_tracker_data
    ADD CONSTRAINT fk_d24014171d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY boards_epic_user_preferences
    ADD CONSTRAINT fk_d32c3d693c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_admin_roles
    ADD CONSTRAINT fk_d3e201cb93 FOREIGN KEY (admin_role_id) REFERENCES admin_roles(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT fk_d405f1c11a FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY ci_sources_pipelines
    ADD CONSTRAINT fk_d4e29af7d7_p FOREIGN KEY (source_partition_id, source_pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY operations_strategies_user_lists
    ADD CONSTRAINT fk_d4f7076369 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_events
    ADD CONSTRAINT fk_d606a2a890 FOREIGN KEY (promoted_from_note_id) REFERENCES notes(id) ON DELETE SET NULL;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_d6cf4279f7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_activity_events
    ADD CONSTRAINT fk_d6f785c9fc FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY vulnerability_partial_scans
    ADD CONSTRAINT fk_d7311920a8 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_achievements
    ADD CONSTRAINT fk_d7653ef780 FOREIGN KEY (revoked_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY dependency_proxy_manifest_states
    ADD CONSTRAINT fk_d79f184865 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY users
    ADD CONSTRAINT fk_d7b9ff90af FOREIGN KEY (organization_id) REFERENCES organizations(id) NOT VALID;

ALTER TABLE p_ci_pipelines
    ADD CONSTRAINT fk_d80e161c54 FOREIGN KEY (ci_ref_id) REFERENCES ci_refs(id) ON DELETE SET NULL;

ALTER TABLE ONLY upcoming_reconciliations
    ADD CONSTRAINT fk_d81de6b493 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY system_note_metadata
    ADD CONSTRAINT fk_d83a918cb1 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_occurrences
    ADD CONSTRAINT fk_d857c6edc1 FOREIGN KEY (component_id) REFERENCES sbom_components(id) ON DELETE CASCADE;

ALTER TABLE ONLY zentao_tracker_data
    ADD CONSTRAINT fk_d8eda829f4 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY todos
    ADD CONSTRAINT fk_d94154aa95 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_conversation_threads
    ADD CONSTRAINT fk_d97014a270 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY label_links
    ADD CONSTRAINT fk_d97dd08678 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY personal_access_tokens
    ADD CONSTRAINT fk_da676c7ca5 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_group_links
    ADD CONSTRAINT fk_daa8cee94c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_helm_file_metadata
    ADD CONSTRAINT fk_dac49661f4 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_failures
    ADD CONSTRAINT fk_dad28985ee FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_topics
    ADD CONSTRAINT fk_db13576296 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY web_hooks
    ADD CONSTRAINT fk_db1ea5699b FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_context_commit_diff_files
    ADD CONSTRAINT fk_db51fb6abe FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT fk_dbbe8917ee FOREIGN KEY (due_date_sourcing_work_item_id) REFERENCES issues(id) ON DELETE SET NULL;

ALTER TABLE ONLY ai_catalog_item_versions
    ADD CONSTRAINT fk_dc274ddac4 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_positions
    ADD CONSTRAINT fk_dc62428d81 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspaces
    ADD CONSTRAINT fk_dc7c316be1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY software_license_policies
    ADD CONSTRAINT fk_dca6a58d53 FOREIGN KEY (approval_policy_rule_id) REFERENCES approval_policy_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_dccd3f98fc FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY project_control_compliance_statuses
    ADD CONSTRAINT fk_de8f1f0f22 FOREIGN KEY (compliance_requirement_id) REFERENCES compliance_requirements(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branches
    ADD CONSTRAINT fk_de9216e774 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_composer_packages
    ADD CONSTRAINT fk_de97b49a7b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_user_mentions
    ADD CONSTRAINT fk_def441dfc3 FOREIGN KEY (snippet_organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_number_field_values
    ADD CONSTRAINT fk_df27ad8c35 FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_df75a7c8b8 FOREIGN KEY (promoted_to_epic_id) REFERENCES epics(id) ON DELETE SET NULL;

ALTER TABLE ONLY approval_project_rules
    ADD CONSTRAINT fk_e1372c912e FOREIGN KEY (scan_result_policy_id) REFERENCES scan_result_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_resources
    ADD CONSTRAINT fk_e169a8e3d5_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE SET NULL;

ALTER TABLE ONLY ci_sources_pipelines
    ADD CONSTRAINT fk_e1bad85861_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE p_ci_builds_metadata
    ADD CONSTRAINT fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT fk_e23067f9e1 FOREIGN KEY (protected_branch_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY gitlab_subscriptions
    ADD CONSTRAINT fk_e2595d00a1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidate_metrics
    ADD CONSTRAINT fk_e2684c8ffc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules
    ADD CONSTRAINT fk_e33a9aaf67 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_component_files
    ADD CONSTRAINT fk_e4ff7d8a8b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_events
    ADD CONSTRAINT fk_e5ce49c215 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY user_preferences
    ADD CONSTRAINT fk_e5e029c10b FOREIGN KEY (home_organization_id) REFERENCES organizations(id) ON DELETE SET NULL;

ALTER TABLE ONLY duo_workflows_workloads
    ADD CONSTRAINT fk_e62ee9a85e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_components
    ADD CONSTRAINT fk_e63e8ee3b1 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_composer_metadata
    ADD CONSTRAINT fk_e65180da68 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_protected_branches
    ADD CONSTRAINT fk_e6ee913fc2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_value_stream_settings
    ADD CONSTRAINT fk_e6fcfdeb81 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_e719a85f8a FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY issue_links
    ADD CONSTRAINT fk_e71bb44f1f FOREIGN KEY (target_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY csv_issue_imports
    ADD CONSTRAINT fk_e71c0ae362 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespaces
    ADD CONSTRAINT fk_e7a0b20a6b FOREIGN KEY (custom_project_templates_group_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY fork_networks
    ADD CONSTRAINT fk_e7b436b2b5 FOREIGN KEY (root_project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_conan_package_references
    ADD CONSTRAINT fk_e7b5f3afc7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_graph_paths
    ADD CONSTRAINT fk_e83002e9da FOREIGN KEY (descendant_id) REFERENCES sbom_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY error_tracking_error_events
    ADD CONSTRAINT fk_e84882273e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidates
    ADD CONSTRAINT fk_e86e0bfa5a FOREIGN KEY (model_version_id) REFERENCES ml_model_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_requirement_compliance_statuses
    ADD CONSTRAINT fk_e8e4ff037d FOREIGN KEY (compliance_requirement_id) REFERENCES compliance_requirements(id) ON DELETE CASCADE;

ALTER TABLE ONLY integrations
    ADD CONSTRAINT fk_e8fe908a34 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY pages_domains
    ADD CONSTRAINT fk_ea2f6dfc6f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_representation_information
    ADD CONSTRAINT fk_ea478b7da6 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_labels
    ADD CONSTRAINT fk_eae737023c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_distribution_keys
    ADD CONSTRAINT fk_eb2224a3c0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_requirements
    ADD CONSTRAINT fk_ebf5c3365b FOREIGN KEY (framework_id) REFERENCES compliance_management_frameworks(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resource_components
    ADD CONSTRAINT fk_ec417536da FOREIGN KEY (catalog_resource_id) REFERENCES catalog_resources(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspaces
    ADD CONSTRAINT fk_ec70695b2c FOREIGN KEY (personal_access_token_id) REFERENCES personal_access_tokens(id) ON DELETE RESTRICT;

ALTER TABLE ONLY issuable_resource_links
    ADD CONSTRAINT fk_ec74801551 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_compliance_violations
    ADD CONSTRAINT fk_ec881c1c6f FOREIGN KEY (violating_user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_emails
    ADD CONSTRAINT fk_ed0f4c4b51 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_migrations
    ADD CONSTRAINT fk_ed8ffda028 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY events
    ADD CONSTRAINT fk_eea90e3209 FOREIGN KEY (personal_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspace_agentk_states
    ADD CONSTRAINT fk_eeddb6a618 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY coverage_fuzzing_corpuses
    ADD CONSTRAINT fk_ef5ebf339f FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_context_commits
    ADD CONSTRAINT fk_ef6766ed57 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules
    ADD CONSTRAINT fk_efa5a1e3fb FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repositories
    ADD CONSTRAINT fk_efaf4ac269 FOREIGN KEY (snippet_organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY dora_daily_metrics
    ADD CONSTRAINT fk_efc32a39fa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules_groups
    ADD CONSTRAINT fk_efff219a48 FOREIGN KEY (approval_group_rule_id) REFERENCES approval_group_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY emails
    ADD CONSTRAINT fk_emails_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_epics_issue_id_with_on_delete_cascade FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_epics_on_parent_id_with_on_delete_nullify FOREIGN KEY (parent_id) REFERENCES epics(id) ON DELETE SET NULL;

ALTER TABLE ONLY clusters
    ADD CONSTRAINT fk_f05c5e5a42 FOREIGN KEY (management_project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY vulnerability_external_issue_links
    ADD CONSTRAINT fk_f07bb8233d FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_slugs
    ADD CONSTRAINT fk_f07dd9db19 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY epics
    ADD CONSTRAINT fk_f081aa4489 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_batches
    ADD CONSTRAINT fk_f0e254a867 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_reports
    ADD CONSTRAINT fk_f10de8b524 FOREIGN KEY (resolved_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY timelogs
    ADD CONSTRAINT fk_f12ef8db70 FOREIGN KEY (timelog_category_id) REFERENCES timelog_categories(id) ON DELETE SET NULL;

ALTER TABLE ONLY snippet_repositories
    ADD CONSTRAINT fk_f1319bee9d FOREIGN KEY (snippet_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards
    ADD CONSTRAINT fk_f15266b5f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY epic_user_mentions
    ADD CONSTRAINT fk_f1ab52883e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_user_preferences
    ADD CONSTRAINT fk_f1c3e9b710 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY observability_metrics_issues_connections
    ADD CONSTRAINT fk_f218d84a14 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspaces_agent_configs
    ADD CONSTRAINT fk_f25d0fbfae FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_batches
    ADD CONSTRAINT fk_f2ab0c5303 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_select_field_values
    ADD CONSTRAINT fk_f2d308e706 FOREIGN KEY (custom_field_select_option_id) REFERENCES custom_field_select_options(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoekt_indices
    ADD CONSTRAINT fk_f34800a202 FOREIGN KEY (zoekt_node_id) REFERENCES zoekt_nodes(id) ON DELETE CASCADE;

ALTER TABLE ONLY status_check_responses
    ADD CONSTRAINT fk_f3953d86c6 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_group_member_roles
    ADD CONSTRAINT fk_f3b8fc5e4e FOREIGN KEY (shared_with_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_designs_versions
    ADD CONSTRAINT fk_f4d25ba00c FOREIGN KEY (version_id) REFERENCES design_management_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policy_violations
    ADD CONSTRAINT fk_f53706dbdd FOREIGN KEY (scan_result_policy_id) REFERENCES scan_result_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_devops_adoption_segments
    ADD CONSTRAINT fk_f5aa768998 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_merge_access_levels
    ADD CONSTRAINT fk_f5acff2bb8 FOREIGN KEY (protected_branch_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_list_user_preferences
    ADD CONSTRAINT fk_f5f2fe5c1f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_project_callouts
    ADD CONSTRAINT fk_f62dd11a33 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_metadata
    ADD CONSTRAINT fk_f68c7e109c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_user_aliases
    ADD CONSTRAINT fk_f709137eb7 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspaces
    ADD CONSTRAINT fk_f78aeddc77 FOREIGN KEY (cluster_agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_file_metadata
    ADD CONSTRAINT fk_f7aacd483c FOREIGN KEY (recipe_revision_id) REFERENCES packages_conan_recipe_revisions(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agents
    ADD CONSTRAINT fk_f7d43dee13 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY protected_tag_create_access_levels
    ADD CONSTRAINT fk_f7dfda8c51 FOREIGN KEY (protected_tag_id) REFERENCES protected_tags(id) ON DELETE CASCADE;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_f8b2e8680c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_requirement_compliance_statuses
    ADD CONSTRAINT fk_f9109a4712 FOREIGN KEY (compliance_framework_id) REFERENCES compliance_management_frameworks(id) ON DELETE CASCADE;

ALTER TABLE ONLY application_settings
    ADD CONSTRAINT fk_f9867b3540 FOREIGN KEY (web_ide_oauth_application_id) REFERENCES oauth_applications(id) ON DELETE SET NULL;

ALTER TABLE ONLY issuable_severities
    ADD CONSTRAINT fk_f9df19ecb6 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_approval_rules
    ADD CONSTRAINT fk_fa5b38e373 FOREIGN KEY (source_rule_id) REFERENCES merge_requests_approval_rules(id) ON DELETE SET NULL;

ALTER TABLE ONLY clusters_managed_resources
    ADD CONSTRAINT fk_fad3c3b2e2 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_custom_statuses
    ADD CONSTRAINT fk_fb28a15e7b FOREIGN KEY (created_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY agent_group_authorizations
    ADD CONSTRAINT fk_fb70782616 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_requirements_controls
    ADD CONSTRAINT fk_fbad5ced4f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY system_note_metadata
    ADD CONSTRAINT fk_fbd87415c9 FOREIGN KEY (description_version_id) REFERENCES description_versions(id) ON DELETE SET NULL;

ALTER TABLE ONLY project_compliance_violations_issues
    ADD CONSTRAINT fk_fc4630d30b FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT fk_fc7bc5e687 FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_debian_publications
    ADD CONSTRAINT fk_fd1ad5dd37 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_events
    ADD CONSTRAINT fk_fdd4d610e0 FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rule_sources
    ADD CONSTRAINT fk_fea41830d0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_control_compliance_statuses
    ADD CONSTRAINT fk_ff66375d64 FOREIGN KEY (requirement_status_id) REFERENCES project_requirement_compliance_statuses(id) ON DELETE SET NULL;

ALTER TABLE ONLY import_placeholder_memberships
    ADD CONSTRAINT fk_ffae4107ac FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_import_data
    ADD CONSTRAINT fk_ffb9ee3a10 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_package_revisions
    ADD CONSTRAINT fk_ffc5836122 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY issues
    ADD CONSTRAINT fk_ffed080f01 FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY geo_event_log
    ADD CONSTRAINT fk_geo_event_log_on_geo_event_id FOREIGN KEY (geo_event_id) REFERENCES geo_events(id) ON DELETE CASCADE;

ALTER TABLE ONLY members
    ADD CONSTRAINT fk_member_role_on_members FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE SET NULL;

ALTER TABLE ONLY ml_candidate_metrics
    ADD CONSTRAINT fk_ml_candidate_metrics_on_candidate_id FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidate_params
    ADD CONSTRAINT fk_ml_candidate_params_on_candidate_id FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidates
    ADD CONSTRAINT fk_ml_candidates_on_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ml_experiments
    ADD CONSTRAINT fk_ml_experiments_on_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY path_locks
    ADD CONSTRAINT fk_path_locks_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY personal_access_tokens
    ADD CONSTRAINT fk_personal_access_tokens_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_settings
    ADD CONSTRAINT fk_project_settings_push_rule_id FOREIGN KEY (push_rule_id) REFERENCES push_rules(id) ON DELETE SET NULL;

ALTER TABLE ONLY projects
    ADD CONSTRAINT fk_projects_namespace_id FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE RESTRICT;

ALTER TABLE ONLY protected_branch_merge_access_levels
    ADD CONSTRAINT fk_protected_branch_merge_access_levels_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_push_access_levels
    ADD CONSTRAINT fk_protected_branch_push_access_levels_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_tag_create_access_levels
    ADD CONSTRAINT fk_protected_tag_create_access_levels_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_execution_policy_rules
    ADD CONSTRAINT fk_rails_003cb62f9b FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules
    ADD CONSTRAINT fk_rails_004ce82224 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_statistics
    ADD CONSTRAINT fk_rails_0062050394 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_number_field_values
    ADD CONSTRAINT fk_rails_01b9886bb2 FOREIGN KEY (custom_field_id) REFERENCES custom_fields(id) ON DELETE CASCADE;

ALTER TABLE p_ci_build_sources
    ADD CONSTRAINT fk_rails_023578ae70 FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY automation_rules
    ADD CONSTRAINT fk_rails_025b519b8d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE p_duo_workflows_checkpoints
    ADD CONSTRAINT fk_rails_0320b7accd FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_participants
    ADD CONSTRAINT fk_rails_032b12996a FOREIGN KEY (oncall_rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE;

ALTER TABLE ONLY events
    ADD CONSTRAINT fk_rails_0434b48643 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE incident_management_pending_issue_escalations
    ADD CONSTRAINT fk_rails_0470889ee5 FOREIGN KEY (rule_id) REFERENCES incident_management_escalation_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY ip_restrictions
    ADD CONSTRAINT fk_rails_04a93778d5 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY terraform_state_versions
    ADD CONSTRAINT fk_rails_04f176e239 FOREIGN KEY (terraform_state_id) REFERENCES terraform_states(id) ON DELETE CASCADE;

ALTER TABLE p_duo_workflows_checkpoints
    ADD CONSTRAINT fk_rails_0679151c27 FOREIGN KEY (workflow_id) REFERENCES duo_workflows_workflows(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_assignment_events
    ADD CONSTRAINT fk_rails_07683f8e80 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY security_policies
    ADD CONSTRAINT fk_rails_08722e8ac7 FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscription_user_add_on_assignment_versions
    ADD CONSTRAINT fk_rails_091e013a61 FOREIGN KEY (organization_id) REFERENCES organizations(id);

ALTER TABLE sent_notifications_7abbf02cb6
    ADD CONSTRAINT fk_rails_091ff9020c FOREIGN KEY (issue_email_participant_id) REFERENCES issue_email_participants(id) ON DELETE CASCADE;

ALTER TABLE ONLY trending_projects
    ADD CONSTRAINT fk_rails_09feecd872 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_configurations
    ADD CONSTRAINT fk_rails_0a22dcd52d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_deploy_tokens
    ADD CONSTRAINT fk_rails_0aca134388 FOREIGN KEY (deploy_token_id) REFERENCES deploy_tokens(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_saved_replies
    ADD CONSTRAINT fk_rails_0ace76afbb FOREIGN KEY (project_id) REFERENCES projects(id);

ALTER TABLE ONLY packages_debian_group_distributions
    ADD CONSTRAINT fk_rails_0adf75c347 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE RESTRICT;

ALTER TABLE ONLY packages_conan_file_metadata
    ADD CONSTRAINT fk_rails_0afabd9328 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE;

ALTER TABLE ONLY related_epic_links
    ADD CONSTRAINT fk_rails_0b72027748 FOREIGN KEY (target_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ai_code_suggestion_events
    ADD CONSTRAINT fk_rails_0ba241cf56 FOREIGN KEY (organization_id) REFERENCES organizations(id);

ALTER TABLE ONLY audit_events_external_audit_event_destinations
    ADD CONSTRAINT fk_rails_0bc80a4edc FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_requirement_compliance_statuses
    ADD CONSTRAINT fk_rails_0beca284a6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE RESTRICT;

ALTER TABLE ONLY operations_user_lists
    ADD CONSTRAINT fk_rails_0c716e079b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_link_events
    ADD CONSTRAINT fk_rails_0cea73eba5 FOREIGN KEY (child_work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_google_cloud_logging_configurations
    ADD CONSTRAINT fk_rails_0eb52fc617 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY geo_node_statuses
    ADD CONSTRAINT fk_rails_0ecc699c2a FOREIGN KEY (geo_node_id) REFERENCES geo_nodes(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_synced_attributes_metadata
    ADD CONSTRAINT fk_rails_0f4aa0981f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_authorizations
    ADD CONSTRAINT fk_rails_0f84bb11f3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_lists
    ADD CONSTRAINT fk_rails_0f9c7f646f FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_email_participants
    ADD CONSTRAINT fk_rails_0fdfd8b811 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_context_commits
    ADD CONSTRAINT fk_rails_0fe0039f60 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_headers
    ADD CONSTRAINT fk_rails_109fcf96e2 FOREIGN KEY (external_audit_event_destination_id) REFERENCES audit_events_external_audit_event_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_sources_projects
    ADD CONSTRAINT fk_rails_10a1eb379a_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY system_access_group_microsoft_applications
    ADD CONSTRAINT fk_rails_1171049488 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoom_meetings
    ADD CONSTRAINT fk_rails_1190f0e0fa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY gpg_signatures
    ADD CONSTRAINT fk_rails_11ae8cb9a7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY pm_affected_packages
    ADD CONSTRAINT fk_rails_1279c1b9a1 FOREIGN KEY (pm_advisory_id) REFERENCES pm_advisories(id) ON DELETE CASCADE;

ALTER TABLE ONLY description_versions
    ADD CONSTRAINT fk_rails_12b144011c FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_statistics
    ADD CONSTRAINT fk_rails_12c471002f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_details
    ADD CONSTRAINT fk_rails_12e0b3043d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_imports
    ADD CONSTRAINT fk_rails_130a09357d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY diff_note_positions
    ADD CONSTRAINT fk_rails_13c7212859 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_aggregations
    ADD CONSTRAINT fk_rails_13c8374c7a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_push_rules
    ADD CONSTRAINT fk_rails_14972ce31e FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY service_desk_custom_email_verifications
    ADD CONSTRAINT fk_rails_14dcaf4c92 FOREIGN KEY (triggerer_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY namespaces_storage_limit_exclusions
    ADD CONSTRAINT fk_rails_14e8f7b0e0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY users_security_dashboard_projects
    ADD CONSTRAINT fk_rails_150cd5682c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_source_user_placeholder_references
    ADD CONSTRAINT fk_rails_158995b934 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_source_users
    ADD CONSTRAINT fk_rails_167f82fd95 FOREIGN KEY (reassign_to_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ci_build_report_results
    ADD CONSTRAINT fk_rails_16cb1ff064_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY catalog_resources
    ADD CONSTRAINT fk_rails_16f09e5c44 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_deploy_tokens
    ADD CONSTRAINT fk_rails_170e03cbaf FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_rule_schedules
    ADD CONSTRAINT fk_rails_17ade83f17 FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_policy_rules
    ADD CONSTRAINT fk_rails_17c6dfe138 FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_escalation_rules
    ADD CONSTRAINT fk_rails_17dbea07a6 FOREIGN KEY (policy_id) REFERENCES incident_management_escalation_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters
    ADD CONSTRAINT fk_rails_17f19c81df FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_providers_aws
    ADD CONSTRAINT fk_rails_18983d9ea4 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE ONLY grafana_integrations
    ADD CONSTRAINT fk_rails_18d0e2b564 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY queries_service_pings
    ADD CONSTRAINT fk_rails_18dedc7d8e FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_failures
    ADD CONSTRAINT fk_rails_1964240b8c FOREIGN KEY (bulk_import_entity_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_wiki_repositories
    ADD CONSTRAINT fk_rails_19755e374b FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT;

ALTER TABLE ONLY gpg_signatures
    ADD CONSTRAINT fk_rails_19d4f1c6f9 FOREIGN KEY (gpg_key_subkey_id) REFERENCES gpg_key_subkeys(id) ON DELETE SET NULL;

ALTER TABLE ONLY incident_management_oncall_schedules
    ADD CONSTRAINT fk_rails_19e83fdd65 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_user_mentions
    ADD CONSTRAINT fk_rails_1a41c485cd FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ai_usage_events
    ADD CONSTRAINT fk_rails_1a85bb845c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_debian_file_metadata
    ADD CONSTRAINT fk_rails_1ae85be112 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE;

ALTER TABLE ONLY catalog_verified_namespaces
    ADD CONSTRAINT fk_rails_1b6bb852c0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issuable_slas
    ADD CONSTRAINT fk_rails_1b8768cd63 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_assignees
    ADD CONSTRAINT fk_rails_1c0ff59e82 FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY epic_user_mentions
    ADD CONSTRAINT fk_rails_1c65976a49 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY approver_groups
    ADD CONSTRAINT fk_rails_1cdcbd7723 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_ci_feature_usages
    ADD CONSTRAINT fk_rails_1deedbf64b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_tags
    ADD CONSTRAINT fk_rails_1dfc868911 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_positions
    ADD CONSTRAINT fk_rails_1ecfd9f2de FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY external_status_checks
    ADD CONSTRAINT fk_rails_1f5a8aa809 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ai_troubleshoot_job_events
    ADD CONSTRAINT fk_rails_1fb7e812da FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dora_daily_metrics
    ADD CONSTRAINT fk_rails_1fd07aff6f FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_lists
    ADD CONSTRAINT fk_rails_1fe6b54909 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules_groups
    ADD CONSTRAINT fk_rails_2020a7124a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_statuses
    ADD CONSTRAINT fk_rails_2178592333 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_agent_versions
    ADD CONSTRAINT fk_rails_2205f8ca20 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY users_ops_dashboard_projects
    ADD CONSTRAINT fk_rails_220a0562db FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

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 work_item_parent_links
    ADD CONSTRAINT fk_rails_231dba8959 FOREIGN KEY (work_item_parent_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_profiles
    ADD CONSTRAINT fk_rails_23cae5abe1 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(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;

ALTER TABLE ONLY group_push_rules
    ADD CONSTRAINT fk_rails_2515e57aa7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_rotations
    ADD CONSTRAINT fk_rails_256e0bc604 FOREIGN KEY (oncall_schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_unit_test_failures
    ADD CONSTRAINT fk_rails_259da3e79c FOREIGN KEY (unit_test_id) REFERENCES ci_unit_tests(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agents
    ADD CONSTRAINT fk_rails_25e9fc2d5d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_user_preferences
    ADD CONSTRAINT fk_rails_268c57d62d FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_pipeline_schedule_inputs
    ADD CONSTRAINT fk_rails_2709bc4c28 FOREIGN KEY (pipeline_schedule_id) REFERENCES ci_pipeline_schedules(id) ON DELETE CASCADE;

ALTER TABLE ONLY lfs_file_locks
    ADD CONSTRAINT fk_rails_27a1d98fa8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_alerting_settings
    ADD CONSTRAINT fk_rails_27a84b407d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY compliance_requirements_controls
    ADD CONSTRAINT fk_rails_27dc3d2491 FOREIGN KEY (compliance_requirement_id) REFERENCES compliance_requirements(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_credit_card_validations
    ADD CONSTRAINT fk_rails_27ebc03cbf FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_site_validations
    ADD CONSTRAINT fk_rails_285c617324 FOREIGN KEY (dast_site_token_id) REFERENCES dast_site_tokens(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_findings_remediations
    ADD CONSTRAINT fk_rails_28a8d0cf93 FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_repositories
    ADD CONSTRAINT fk_rails_2938d8dd8d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_issuable_escalation_statuses
    ADD CONSTRAINT fk_rails_29abffe3b9 FOREIGN KEY (policy_id) REFERENCES incident_management_escalation_policies(id) ON DELETE SET NULL;

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT fk_rails_29af06892a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY reviews
    ADD CONSTRAINT fk_rails_29e6f859c4 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY draft_notes
    ADD CONSTRAINT fk_rails_2a8dac9901 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY xray_reports
    ADD CONSTRAINT fk_rails_2b13fbecf9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_image_ttl_group_policies
    ADD CONSTRAINT fk_rails_2b1896d021 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_group_links
    ADD CONSTRAINT fk_rails_2b2353ca49 FOREIGN KEY (shared_with_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_component_files
    ADD CONSTRAINT fk_rails_2b8992dd83 FOREIGN KEY (architecture_id) REFERENCES packages_debian_group_architectures(id) ON DELETE RESTRICT;

ALTER TABLE incident_management_pending_alert_escalations
    ADD CONSTRAINT fk_rails_2bbafb00ef FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_labels
    ADD CONSTRAINT fk_rails_2bedeb8799 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY error_tracking_error_events
    ADD CONSTRAINT fk_rails_2c096c0076 FOREIGN KEY (error_id) REFERENCES error_tracking_errors(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_colors
    ADD CONSTRAINT fk_rails_2c2032206e FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY onboarding_progresses
    ADD CONSTRAINT fk_rails_2ccfd420cc FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_unprotect_access_levels
    ADD CONSTRAINT fk_rails_2d2aba21ef FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY issuable_severities
    ADD CONSTRAINT fk_rails_2fbb74ad6d FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY saml_providers
    ADD CONSTRAINT fk_rails_306d459be7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_batch_trackers
    ADD CONSTRAINT fk_rails_307efb9f32 FOREIGN KEY (tracker_id) REFERENCES bulk_import_trackers(id) ON DELETE CASCADE;

ALTER TABLE p_ci_job_inputs
    ADD CONSTRAINT fk_rails_30a46abefe_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY pm_package_version_licenses
    ADD CONSTRAINT fk_rails_30ddb7f837 FOREIGN KEY (pm_package_version_id) REFERENCES pm_package_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT fk_rails_3112bba7dc FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diff_commits
    ADD CONSTRAINT fk_rails_316aaceda3 FOREIGN KEY (merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_import_states
    ADD CONSTRAINT fk_rails_31c3e0503a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY zoom_meetings
    ADD CONSTRAINT fk_rails_3263f29616 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_repositories
    ADD CONSTRAINT fk_rails_32f7bf5aad FOREIGN KEY (project_id) REFERENCES projects(id);

ALTER TABLE ONLY ai_agents
    ADD CONSTRAINT fk_rails_3328b05449 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_metric_images
    ADD CONSTRAINT fk_rails_338e55b408 FOREIGN KEY (alert_id) REFERENCES alert_management_alerts(id) ON DELETE CASCADE;

ALTER TABLE ONLY suggestions
    ADD CONSTRAINT fk_rails_33b03a535c FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_terraform_module_metadata
    ADD CONSTRAINT fk_rails_33c045442a FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_registry_protection_tag_rules
    ADD CONSTRAINT fk_rails_343879fca2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_features
    ADD CONSTRAINT fk_rails_356514082b FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_slugs
    ADD CONSTRAINT fk_rails_358b46be14 FOREIGN KEY (wiki_page_meta_id) REFERENCES wiki_page_meta(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_labels
    ADD CONSTRAINT fk_rails_362b0600a3 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY virtual_registries_packages_maven_upstreams
    ADD CONSTRAINT fk_rails_3649ef6e9a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_blocks
    ADD CONSTRAINT fk_rails_364d4bea8b FOREIGN KEY (blocked_merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_reviewers
    ADD CONSTRAINT fk_rails_3704a66140 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_merge_request_approval_settings
    ADD CONSTRAINT fk_rails_37b6b4cdba FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_distribution_keys
    ADD CONSTRAINT fk_rails_3834a11264 FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_user_mentions
    ADD CONSTRAINT fk_rails_3861d9fefa FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_settings
    ADD CONSTRAINT fk_rails_3896d4fae5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_namespace_feature_settings
    ADD CONSTRAINT fk_rails_3910c64ae1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_cleanup_policies
    ADD CONSTRAINT fk_rails_393ba98591 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_groups
    ADD CONSTRAINT fk_rails_396841e79e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY custom_fields
    ADD CONSTRAINT fk_rails_39d50cbb4e FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY chat_teams
    ADD CONSTRAINT fk_rails_3b543909cb FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_scim_auth_access_tokens
    ADD CONSTRAINT fk_rails_3caca5d6d0 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_build_needs
    ADD CONSTRAINT fk_rails_3cf221d4ed_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY cluster_groups
    ADD CONSTRAINT fk_rails_3d28377556 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY note_diff_files
    ADD CONSTRAINT fk_rails_3d66047aeb FOREIGN KEY (diff_note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY virtual_registries_packages_maven_registry_upstreams
    ADD CONSTRAINT fk_rails_3dc6bd8333 FOREIGN KEY (upstream_id) REFERENCES virtual_registries_packages_maven_upstreams(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_user_mentions
    ADD CONSTRAINT fk_rails_3e00189191 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_scim_identities
    ADD CONSTRAINT fk_rails_3e0678e2d9 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY early_access_program_tracking_events
    ADD CONSTRAINT fk_rails_3e8c32b3dd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY epic_user_mentions
    ADD CONSTRAINT fk_rails_3eaf4d88cc FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_checkpoint_writes
    ADD CONSTRAINT fk_rails_3ee4893623 FOREIGN KEY (workflow_id) REFERENCES duo_workflows_workflows(id) ON DELETE CASCADE;

ALTER TABLE ONLY issuable_resource_links
    ADD CONSTRAINT fk_rails_3f0ec6b1cf FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE p_knowledge_graph_replicas
    ADD CONSTRAINT fk_rails_3f20642c2f FOREIGN KEY (zoekt_node_id) REFERENCES zoekt_nodes(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_stage_aggregations
    ADD CONSTRAINT fk_rails_3f409802fc FOREIGN KEY (stage_id) REFERENCES analytics_cycle_analytics_group_stages(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_assignees
    ADD CONSTRAINT fk_rails_3f6f926bd5 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY instance_type_ci_runner_machines
    ADD CONSTRAINT fk_rails_3f92913d27 FOREIGN KEY (runner_id, runner_type) REFERENCES instance_type_ci_runners(id, runner_type) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY group_type_ci_runner_machines
    ADD CONSTRAINT fk_rails_3f92913d27 FOREIGN KEY (runner_id, runner_type) REFERENCES group_type_ci_runners(id, runner_type) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY project_type_ci_runner_machines
    ADD CONSTRAINT fk_rails_3f92913d27 FOREIGN KEY (runner_id, runner_type) REFERENCES project_type_ci_runners(id, runner_type) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY description_versions
    ADD CONSTRAINT fk_rails_3ff658220b FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY clusters_kubernetes_namespaces
    ADD CONSTRAINT fk_rails_40cc7ccbc3 FOREIGN KEY (cluster_project_id) REFERENCES cluster_projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY epic_issues
    ADD CONSTRAINT fk_rails_4209981af6 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE p_ai_active_context_code_enabled_namespaces
    ADD CONSTRAINT fk_rails_42b1b86224 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_stage_aggregations
    ADD CONSTRAINT fk_rails_42e6fe37d7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_resources
    ADD CONSTRAINT fk_rails_430336af2d FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE CASCADE;

ALTER TABLE ONLY batched_background_migration_jobs
    ADD CONSTRAINT fk_rails_432153b86d FOREIGN KEY (batched_background_migration_id) REFERENCES batched_background_migrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_strategies_user_lists
    ADD CONSTRAINT fk_rails_43241e8d29 FOREIGN KEY (strategy_id) REFERENCES operations_strategies(id) ON DELETE CASCADE;

ALTER TABLE ONLY activity_pub_releases_subscriptions
    ADD CONSTRAINT fk_rails_4337598314 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_value_stream_settings
    ADD CONSTRAINT fk_rails_4360d37256 FOREIGN KEY (value_stream_id) REFERENCES analytics_cycle_analytics_group_value_streams(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_assignment_events
    ADD CONSTRAINT fk_rails_4378a2e8d7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY lfs_file_locks
    ADD CONSTRAINT fk_rails_43df7a0412 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_site_profile_secret_variables
    ADD CONSTRAINT fk_rails_43e2897950 FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_assignees
    ADD CONSTRAINT fk_rails_443443ce6f FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_dependency_links
    ADD CONSTRAINT fk_rails_4437bf4070 FOREIGN KEY (dependency_id) REFERENCES packages_dependencies(id) ON DELETE CASCADE;

ALTER TABLE p_ci_builds
    ADD CONSTRAINT fk_rails_4540ead625_p FOREIGN KEY (upstream_pipeline_partition_id, upstream_pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY project_auto_devops
    ADD CONSTRAINT fk_rails_45436b12b2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dora_performance_scores
    ADD CONSTRAINT fk_rails_455f9acc65 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests_closing_issues
    ADD CONSTRAINT fk_rails_458eda8667 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_deploy_access_levels
    ADD CONSTRAINT fk_rails_45cc02a931 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY smartcard_identities
    ADD CONSTRAINT fk_rails_4689f889a9 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_custom_attributes
    ADD CONSTRAINT fk_rails_47b91868a8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE p_ci_builds
    ADD CONSTRAINT fk_rails_494e57ee78_p FOREIGN KEY (auto_canceled_by_partition_id, auto_canceled_by_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE SET NULL;

ALTER TABLE ONLY upcoming_reconciliations
    ADD CONSTRAINT fk_rails_497b4938ac FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY custom_fields
    ADD CONSTRAINT fk_rails_4a74c8558e FOREIGN KEY (created_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY group_deletion_schedules
    ADD CONSTRAINT fk_rails_4b8c694a6c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repository_storage_moves
    ADD CONSTRAINT fk_rails_4b950f5b94 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_designs
    ADD CONSTRAINT fk_rails_4bb1073360 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_metrics
    ADD CONSTRAINT fk_rails_4bb543d85d FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_metrics_settings
    ADD CONSTRAINT fk_rails_4c6037ee4f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_blob_states
    ADD CONSTRAINT fk_rails_4cdbb92cbd FOREIGN KEY (dependency_proxy_blob_id) REFERENCES dependency_proxy_blobs(id) ON DELETE CASCADE;

ALTER TABLE ONLY scim_identities
    ADD CONSTRAINT fk_rails_4d2056ebd9 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_user_mentions
    ADD CONSTRAINT fk_rails_4d3f96b2cb FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_approval_rules
    ADD CONSTRAINT fk_rails_4e554f96f5 FOREIGN KEY (protected_environment_id) REFERENCES protected_environments(id) ON DELETE CASCADE;

ALTER TABLE ONLY aws_roles
    ADD CONSTRAINT fk_rails_4ed56f4720 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_publications
    ADD CONSTRAINT fk_rails_4fc8ebd03e FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diff_files
    ADD CONSTRAINT fk_rails_501aa0a391 FOREIGN KEY (merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT fk_rails_501fa15d69 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY status_page_settings
    ADD CONSTRAINT fk_rails_506e5ba391 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE p_ci_pipeline_variables
    ADD CONSTRAINT fk_rails_507416c33a_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY ci_pipeline_metadata
    ADD CONSTRAINT fk_rails_50c1e9ea10_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY project_repository_storage_moves
    ADD CONSTRAINT fk_rails_5106dbd44a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_candidate_metadata
    ADD CONSTRAINT fk_rails_5117dddf22 FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_merge_schedules
    ADD CONSTRAINT fk_rails_5294434bc3 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_active_context_migrations
    ADD CONSTRAINT fk_rails_52b6529477 FOREIGN KEY (connection_id) REFERENCES ai_active_context_connections(id) ON DELETE CASCADE;

ALTER TABLE ONLY elastic_group_index_statuses
    ADD CONSTRAINT fk_rails_52b9969b12 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY observability_metrics_issues_connections
    ADD CONSTRAINT fk_rails_533fe605e3 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_configurations
    ADD CONSTRAINT fk_rails_536b96bff1 FOREIGN KEY (bulk_import_id) REFERENCES bulk_imports(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspace_variables
    ADD CONSTRAINT fk_rails_539844891e FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY x509_commit_signatures
    ADD CONSTRAINT fk_rails_53fe41188f FOREIGN KEY (x509_certificate_id) REFERENCES x509_certificates(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams
    ADD CONSTRAINT fk_rails_540627381a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY geo_node_namespace_links
    ADD CONSTRAINT fk_rails_546bf08d3e FOREIGN KEY (geo_node_id) REFERENCES geo_nodes(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_events
    ADD CONSTRAINT fk_rails_55101e588c FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id);

ALTER TABLE ONLY virtual_registries_packages_maven_registries
    ADD CONSTRAINT fk_rails_555e85e52c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY issuable_metric_images
    ADD CONSTRAINT fk_rails_56417a5a7f FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_deploy_keys
    ADD CONSTRAINT fk_rails_5682fc07f8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE RESTRICT;

ALTER TABLE ONLY issue_user_mentions
    ADD CONSTRAINT fk_rails_57581fda73 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_assignees
    ADD CONSTRAINT fk_rails_579d375628 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_event_tag_links
    ADD CONSTRAINT fk_rails_57baccd7f9 FOREIGN KEY (timeline_event_id) REFERENCES incident_management_timeline_events(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_architectures
    ADD CONSTRAINT fk_rails_5808663adf FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_group_stages
    ADD CONSTRAINT fk_rails_5a22f40223 FOREIGN KEY (start_event_label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY badges
    ADD CONSTRAINT fk_rails_5a7c055bdc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_label_events
    ADD CONSTRAINT fk_rails_5ac1d2fc24 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_secure_file_states
    ADD CONSTRAINT fk_rails_5adba40c5f FOREIGN KEY (ci_secure_file_id) REFERENCES ci_secure_files(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules_groups
    ADD CONSTRAINT fk_rails_5b2ecf6139 FOREIGN KEY (approval_merge_request_rule_id) REFERENCES approval_merge_request_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY agent_organization_authorizations
    ADD CONSTRAINT fk_rails_5b380e3d6b FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_limits
    ADD CONSTRAINT fk_rails_5b3f2bc334 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_version_metadata
    ADD CONSTRAINT fk_rails_5b67cc9107 FOREIGN KEY (model_version_id) REFERENCES ml_model_versions(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_deploy_access_levels
    ADD CONSTRAINT fk_rails_5b9f6970fe FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_unprotect_access_levels
    ADD CONSTRAINT fk_rails_5be1abfc25 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_providers_gcp
    ADD CONSTRAINT fk_rails_5c2c3bc814 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE ONLY insights
    ADD CONSTRAINT fk_rails_5c4391f60a FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY reviews
    ADD CONSTRAINT fk_rails_5ca11d8c31 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_approval_metrics
    ADD CONSTRAINT fk_rails_5cb1ca73f8 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY ldap_admin_role_links
    ADD CONSTRAINT fk_rails_5d208a83e7 FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE CASCADE;

ALTER TABLE p_ci_stages
    ADD CONSTRAINT fk_rails_5d4d96d44b_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY targeted_message_namespaces
    ADD CONSTRAINT fk_rails_5d78dba870 FOREIGN KEY (targeted_message_id) REFERENCES targeted_messages(id) ON DELETE CASCADE;

ALTER TABLE ONLY epic_issues
    ADD CONSTRAINT fk_rails_5d942936b4 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_nuget_symbols
    ADD CONSTRAINT fk_rails_5df972da14 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;

ALTER TABLE ONLY vulnerability_management_policy_rules
    ADD CONSTRAINT fk_rails_5e6b6e1b2c FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_weight_events
    ADD CONSTRAINT fk_rails_5eb5cb92a1 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY observability_logs_issues_connections
    ADD CONSTRAINT fk_rails_5f0f58ca3a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules
    ADD CONSTRAINT fk_rails_5fb4dd100b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_participants
    ADD CONSTRAINT fk_rails_5fe86ea341 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_parent_links
    ADD CONSTRAINT fk_rails_601d5bec3a FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY system_access_microsoft_graph_access_tokens
    ADD CONSTRAINT fk_rails_604908851f FOREIGN KEY (system_access_microsoft_application_id) REFERENCES system_access_microsoft_applications(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspace_tokens
    ADD CONSTRAINT fk_rails_60666321a4 FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_state_transitions
    ADD CONSTRAINT fk_rails_60e4899648 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_highest_roles
    ADD CONSTRAINT fk_rails_60f6c325a6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_group_settings
    ADD CONSTRAINT fk_rails_616ddd680a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_deploy_tokens
    ADD CONSTRAINT fk_rails_61a572b41a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY sbom_component_versions
    ADD CONSTRAINT fk_rails_61a83aa892 FOREIGN KEY (component_id) REFERENCES sbom_components(id) ON DELETE CASCADE;

ALTER TABLE ONLY status_page_published_incidents
    ADD CONSTRAINT fk_rails_61e5493940 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_ssh_certificates
    ADD CONSTRAINT fk_rails_61f9eafcdf FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_repository_states
    ADD CONSTRAINT fk_rails_63436c99ce FOREIGN KEY (container_repository_id) REFERENCES container_repositories(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployment_clusters
    ADD CONSTRAINT fk_rails_6359a164df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;

ALTER TABLE incident_management_pending_issue_escalations
    ADD CONSTRAINT fk_rails_636678b3bd FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY evidences
    ADD CONSTRAINT fk_rails_6388b435a6 FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_imports
    ADD CONSTRAINT fk_rails_63cbe52ada FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_deploy_tokens
    ADD CONSTRAINT fk_rails_6477b01f6b FOREIGN KEY (deploy_token_id) REFERENCES deploy_tokens(id) ON DELETE CASCADE;

ALTER TABLE ONLY reviews
    ADD CONSTRAINT fk_rails_64798be025 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_feature_flags
    ADD CONSTRAINT fk_rails_648e241be7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_group_recent_visits
    ADD CONSTRAINT fk_rails_64bfc19bc5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rule_sources
    ADD CONSTRAINT fk_rails_64e8ed3c7e FOREIGN KEY (approval_project_rule_id) REFERENCES approval_project_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_protected_branches
    ADD CONSTRAINT fk_rails_65203aa786 FOREIGN KEY (approval_project_rule_id) REFERENCES approval_project_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_management_versions
    ADD CONSTRAINT fk_rails_6574200d99 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules_approved_approvers
    ADD CONSTRAINT fk_rails_6577725edb FOREIGN KEY (approval_merge_request_rule_id) REFERENCES approval_merge_request_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_relation_export_uploads
    ADD CONSTRAINT fk_rails_660ada90c9 FOREIGN KEY (project_relation_export_id) REFERENCES project_relation_exports(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_feature_flags_clients
    ADD CONSTRAINT fk_rails_6650ed902c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_admin_notes
    ADD CONSTRAINT fk_rails_666166ea7b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_group_rules
    ADD CONSTRAINT fk_rails_6727675176 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE uploads_9ba88c4165
    ADD CONSTRAINT fk_rails_67403e76d7 FOREIGN KEY (uploaded_by_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY jira_imports
    ADD CONSTRAINT fk_rails_675d38c03b FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE SET NULL;

ALTER TABLE ONLY non_sql_service_pings
    ADD CONSTRAINT fk_rails_67cc36015b FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_findings_remediations
    ADD CONSTRAINT fk_rails_681c85ae0f FOREIGN KEY (vulnerability_remediation_id) REFERENCES vulnerability_remediations(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT fk_rails_6830c13ac1 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY plan_limits
    ADD CONSTRAINT fk_rails_69f8b6184f FOREIGN KEY (plan_id) REFERENCES plans(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_feature_flags_issues
    ADD CONSTRAINT fk_rails_6a8856ca4f FOREIGN KEY (feature_flag_id) REFERENCES operations_feature_flags(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_weights_sources
    ADD CONSTRAINT fk_rails_6ac227847a FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_source_users
    ADD CONSTRAINT fk_rails_6aee6cd676 FOREIGN KEY (placeholder_user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ml_experiment_metadata
    ADD CONSTRAINT fk_rails_6b39844d44 FOREIGN KEY (experiment_id) REFERENCES ml_experiments(id) ON DELETE CASCADE;

ALTER TABLE ONLY error_tracking_errors
    ADD CONSTRAINT fk_rails_6b41f837ba FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_management_policy_rules
    ADD CONSTRAINT fk_rails_6b815ed813 FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_version_metadata
    ADD CONSTRAINT fk_rails_6b8fcb2af1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY term_agreements
    ADD CONSTRAINT fk_rails_6ea6520e4a FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_compliance_framework_settings
    ADD CONSTRAINT fk_rails_6f5294f16c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY users_security_dashboard_projects
    ADD CONSTRAINT fk_rails_6f6cf8e66e FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_dashboards_pointers
    ADD CONSTRAINT fk_rails_7027b7eaa9 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_builds_runner_session
    ADD CONSTRAINT fk_rails_70707857d3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY list_user_preferences
    ADD CONSTRAINT fk_rails_70b2ef5ce2 FOREIGN KEY (list_id) REFERENCES lists(id) ON DELETE CASCADE;

ALTER TABLE issue_search_data
    ADD CONSTRAINT fk_rails_7149dd9eee FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_custom_attributes
    ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_pending_builds
    ADD CONSTRAINT fk_rails_725a2644a3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE uploads_9ba88c4165
    ADD CONSTRAINT fk_rails_728a7c799d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE security_findings
    ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;

ALTER TABLE ONLY custom_emoji
    ADD CONSTRAINT fk_rails_745925b412 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_labels
    ADD CONSTRAINT fk_rails_7471128a8e FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_site_profiles
    ADD CONSTRAINT fk_rails_747dc64abc FOREIGN KEY (dast_site_id) REFERENCES dast_sites(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_context_commit_diff_files
    ADD CONSTRAINT fk_rails_74a00a1787 FOREIGN KEY (merge_request_context_commit_id) REFERENCES merge_request_context_commits(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_http_group_namespace_filters
    ADD CONSTRAINT fk_rails_74a28d2432 FOREIGN KEY (external_audit_event_destination_id) REFERENCES audit_events_external_audit_event_destinations(id) ON DELETE CASCADE;

ALTER TABLE ai_duo_chat_events
    ADD CONSTRAINT fk_rails_74ddd0b91f FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE p_ci_workloads
    ADD CONSTRAINT fk_rails_74f339da60 FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY group_crm_settings
    ADD CONSTRAINT fk_rails_74fdf2f13d FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY pm_package_version_licenses
    ADD CONSTRAINT fk_rails_7520ea026d FOREIGN KEY (pm_license_id) REFERENCES pm_licenses(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_timeline_event_tag_links
    ADD CONSTRAINT fk_rails_753b8b6ee3 FOREIGN KEY (timeline_event_tag_id) REFERENCES incident_management_timeline_event_tags(id) ON DELETE CASCADE;

ALTER TABLE ONLY release_links
    ADD CONSTRAINT fk_rails_753be7ae29 FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE;

ALTER TABLE ONLY milestone_releases
    ADD CONSTRAINT fk_rails_754f27dbfa FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_label_events
    ADD CONSTRAINT fk_rails_75efb0a653 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY x509_certificates
    ADD CONSTRAINT fk_rails_76479fb5b4 FOREIGN KEY (x509_issuer_id) REFERENCES x509_issuers(id) ON DELETE CASCADE;

ALTER TABLE ONLY pages_domain_acme_orders
    ADD CONSTRAINT fk_rails_76581b1c16 FOREIGN KEY (pages_domain_id) REFERENCES pages_domains(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_publications
    ADD CONSTRAINT fk_rails_7668c1d606 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_user_preferences
    ADD CONSTRAINT fk_rails_76c4e9732d FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY system_access_instance_microsoft_graph_access_tokens
    ADD CONSTRAINT fk_rails_76e46ea251 FOREIGN KEY (system_access_instance_microsoft_application_id) REFERENCES system_access_instance_microsoft_applications(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_distribution_keys
    ADD CONSTRAINT fk_rails_779438f163 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_scim_identities
    ADD CONSTRAINT fk_rails_77cb698c8d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY terraform_states
    ADD CONSTRAINT fk_rails_78f54ca485 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY software_license_policies
    ADD CONSTRAINT fk_rails_7a7a2a92de FOREIGN KEY (software_license_id) REFERENCES software_licenses(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_scopes
    ADD CONSTRAINT fk_rails_7a9358853b FOREIGN KEY (strategy_id) REFERENCES operations_strategies(id) ON DELETE CASCADE;

ALTER TABLE ONLY milestone_releases
    ADD CONSTRAINT fk_rails_7ae0756a2d FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_execution_policy_rules
    ADD CONSTRAINT fk_rails_7be2571ecf FOREIGN KEY (security_policy_id) REFERENCES security_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT fk_rails_7ddc5f7457 FOREIGN KEY (source_merge_request_id) REFERENCES merge_requests(id) ON DELETE SET NULL;

ALTER TABLE ONLY audit_events_group_external_streaming_destinations
    ADD CONSTRAINT fk_rails_7dffb88f29 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY personal_access_token_last_used_ips
    ADD CONSTRAINT fk_rails_7e650a7967 FOREIGN KEY (personal_access_token_id) REFERENCES personal_access_tokens(id) ON DELETE CASCADE;

ALTER TABLE ONLY clusters_kubernetes_namespaces
    ADD CONSTRAINT fk_rails_7e7688ecaf FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE p_knowledge_graph_enabled_namespaces
    ADD CONSTRAINT fk_rails_801c561c42 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_policies
    ADD CONSTRAINT fk_rails_802ceea0c8 FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE incident_management_pending_issue_escalations
    ADD CONSTRAINT fk_rails_8069e80242 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_manifest_states
    ADD CONSTRAINT fk_rails_806cf07a3c FOREIGN KEY (dependency_proxy_manifest_id) REFERENCES dependency_proxy_manifests(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_job_artifact_states
    ADD CONSTRAINT fk_rails_80a9cba3b2_p FOREIGN KEY (partition_id, job_artifact_id) REFERENCES p_ci_job_artifacts(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY custom_fields
    ADD CONSTRAINT fk_rails_80c4a47616 FOREIGN KEY (updated_by_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY approval_merge_request_rules_users
    ADD CONSTRAINT fk_rails_80e6801803 FOREIGN KEY (approval_merge_request_rule_id) REFERENCES approval_merge_request_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_instance_streaming_event_type_filters
    ADD CONSTRAINT fk_rails_80e948655b FOREIGN KEY (external_streaming_destination_id) REFERENCES audit_events_instance_external_streaming_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY required_code_owners_sections
    ADD CONSTRAINT fk_rails_817708cf2d FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE p_ci_build_tags
    ADD CONSTRAINT fk_rails_8284d35c66 FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_ldap_settings
    ADD CONSTRAINT fk_rails_82cd0ad4bb FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_wiki_repository_states
    ADD CONSTRAINT fk_rails_832511c9f1 FOREIGN KEY (group_wiki_repository_id) REFERENCES group_wiki_repositories(group_id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_enabled_grants
    ADD CONSTRAINT fk_rails_8336ce35af FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY virtual_registries_packages_maven_registry_upstreams
    ADD CONSTRAINT fk_rails_838d054752 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_list_export_parts
    ADD CONSTRAINT fk_rails_83f26c0e6f FOREIGN KEY (dependency_list_export_id) REFERENCES dependency_list_exports(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_trainings
    ADD CONSTRAINT fk_rails_84c7951d72 FOREIGN KEY (provider_id) REFERENCES security_training_providers(id) ON DELETE CASCADE;

ALTER TABLE ONLY zentao_tracker_data
    ADD CONSTRAINT fk_rails_84efda7be0 FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_runner_taggings_instance_type
    ADD CONSTRAINT fk_rails_84f15fe4c6 FOREIGN KEY (runner_id, runner_type) REFERENCES instance_type_ci_runners(id, runner_type) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY ci_runner_taggings_group_type
    ADD CONSTRAINT fk_rails_84f15fe4c6 FOREIGN KEY (runner_id, runner_type) REFERENCES group_type_ci_runners(id, runner_type) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY ci_runner_taggings_project_type
    ADD CONSTRAINT fk_rails_84f15fe4c6 FOREIGN KEY (runner_id, runner_type) REFERENCES project_type_ci_runners(id, runner_type) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_amazon_s3_configurations
    ADD CONSTRAINT fk_rails_84f4b10a16 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_user_preferences
    ADD CONSTRAINT fk_rails_851fe1510a FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ai_usage_events
    ADD CONSTRAINT fk_rails_852725a860 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY value_stream_dashboard_aggregations
    ADD CONSTRAINT fk_rails_859b4f86f3 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY workspaces_agent_config_versions
    ADD CONSTRAINT fk_rails_8698efd89e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployment_merge_requests
    ADD CONSTRAINT fk_rails_86a6d8bf12 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_language_trend_repository_languages
    ADD CONSTRAINT fk_rails_86cc9aef5f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_diff_details
    ADD CONSTRAINT fk_rails_86f4d24ecd FOREIGN KEY (merge_request_diff_id) REFERENCES merge_request_diffs(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_package_file_build_infos
    ADD CONSTRAINT fk_rails_871ca3ae21 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_boards
    ADD CONSTRAINT fk_rails_874c573878 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY service_desk_custom_email_credentials
    ADD CONSTRAINT fk_rails_878b562d12 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY software_license_policies
    ADD CONSTRAINT fk_rails_87b2247ce5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY arkose_sessions
    ADD CONSTRAINT fk_rails_87ceb2456f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY achievements
    ADD CONSTRAINT fk_rails_87e990f752 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_feature_settings
    ADD CONSTRAINT fk_rails_8907fb7bbb FOREIGN KEY (ai_self_hosted_model_id) REFERENCES ai_self_hosted_models(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environment_deploy_access_levels
    ADD CONSTRAINT fk_rails_898a13b650 FOREIGN KEY (protected_environment_id) REFERENCES protected_environments(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_versions
    ADD CONSTRAINT fk_rails_8a481bd22e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repositories
    ADD CONSTRAINT fk_rails_8afd7e2f71 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;

ALTER TABLE ONLY gpg_key_subkeys
    ADD CONSTRAINT fk_rails_8b2c90b046 FOREIGN KEY (gpg_key_id) REFERENCES gpg_keys(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_user_preferences
    ADD CONSTRAINT fk_rails_8b3b23ce82 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY allowed_email_domains
    ADD CONSTRAINT fk_rails_8b5da859f9 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_projects
    ADD CONSTRAINT fk_rails_8b8c5caf07 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_pages_metadata
    ADD CONSTRAINT fk_rails_8c28a61485 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_progresses
    ADD CONSTRAINT fk_rails_8c584bfb37 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_conan_metadata
    ADD CONSTRAINT fk_rails_8c68cfec8b FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY excluded_merge_requests
    ADD CONSTRAINT fk_rails_8c973feffa FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_placeholder_memberships
    ADD CONSTRAINT fk_rails_8cdeffd260 FOREIGN KEY (source_user_id) REFERENCES import_source_users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_pipeline_messages
    ADD CONSTRAINT fk_rails_8d3b04e3e1_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE incident_management_pending_alert_escalations
    ADD CONSTRAINT fk_rails_8d8de95da9 FOREIGN KEY (alert_id) REFERENCES alert_management_alerts(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules_approved_approvers
    ADD CONSTRAINT fk_rails_8dc94cff4d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT fk_rails_8dcefa21a5 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_user_mentions
    ADD CONSTRAINT fk_rails_8de8c6d632 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY clusters_kubernetes_namespaces
    ADD CONSTRAINT fk_rails_8df789f3ab FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE SET NULL;

ALTER TABLE ONLY alert_management_alert_user_mentions
    ADD CONSTRAINT fk_rails_8e48eca0fe FOREIGN KEY (alert_management_alert_id) REFERENCES alert_management_alerts(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_daily_statistics
    ADD CONSTRAINT fk_rails_8e549b272d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_secrets_managers
    ADD CONSTRAINT fk_rails_8f88850d11 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_details
    ADD CONSTRAINT fk_rails_8facb04bef FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY members_deletion_schedules
    ADD CONSTRAINT fk_rails_8fb4cda076 FOREIGN KEY (scheduled_by_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_groups
    ADD CONSTRAINT fk_rails_9071e863d1 FOREIGN KEY (approval_project_rule_id) REFERENCES approval_project_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_error_tracking_settings
    ADD CONSTRAINT fk_rails_910a2b8bd9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY list_user_preferences
    ADD CONSTRAINT fk_rails_916d72cafd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_cleanup_schedules
    ADD CONSTRAINT fk_rails_92dd0e705c FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_build_artifacts_size_refreshes
    ADD CONSTRAINT fk_rails_936db5fc44 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_labels
    ADD CONSTRAINT fk_rails_9374a16edd FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_assignees
    ADD CONSTRAINT fk_rails_93c0f6703b FOREIGN KEY (alert_id) REFERENCES alert_management_alerts(id) ON DELETE CASCADE;

ALTER TABLE ONLY scim_identities
    ADD CONSTRAINT fk_rails_9421a0bffb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_distributions
    ADD CONSTRAINT fk_rails_94b95e1f84 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY personal_access_token_last_used_ips
    ADD CONSTRAINT fk_rails_95388fbaeb FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_rubygems_metadata
    ADD CONSTRAINT fk_rails_95a3f5ce78 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_pypi_metadata
    ADD CONSTRAINT fk_rails_9698717cdd FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_recent_visits
    ADD CONSTRAINT fk_rails_96c2c18642 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_dependency_links
    ADD CONSTRAINT fk_rails_96ef1c00d3 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_experiments
    ADD CONSTRAINT fk_rails_97194a054e FOREIGN KEY (model_id) REFERENCES ml_models(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_repository_storage_moves
    ADD CONSTRAINT fk_rails_982bb5daf1 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_label_events
    ADD CONSTRAINT fk_rails_9851a00031 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_project_recent_visits
    ADD CONSTRAINT fk_rails_98f8843922 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY clusters_kubernetes_namespaces
    ADD CONSTRAINT fk_rails_98fe21e486 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY error_tracking_client_keys
    ADD CONSTRAINT fk_rails_99342d1d54 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY pages_deployments
    ADD CONSTRAINT fk_rails_993b88f59a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_pre_scan_verification_steps
    ADD CONSTRAINT fk_rails_9990fc2adf FOREIGN KEY (dast_pre_scan_verification_id) REFERENCES dast_pre_scan_verifications(id) ON DELETE CASCADE;

ALTER TABLE ONLY members_deletion_schedules
    ADD CONSTRAINT fk_rails_9af19961f8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY users_ops_dashboard_projects
    ADD CONSTRAINT fk_rails_9b4ebf005b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_incident_management_settings
    ADD CONSTRAINT fk_rails_9c2ea1b7dd FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_components
    ADD CONSTRAINT fk_rails_9d072b5073 FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY gpg_keys
    ADD CONSTRAINT fk_rails_9d1f5d8719 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_language_trend_repository_languages
    ADD CONSTRAINT fk_rails_9d851d566c FOREIGN KEY (programming_language_id) REFERENCES programming_languages(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespaces_sync_events
    ADD CONSTRAINT fk_rails_9da32a0431 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY badges
    ADD CONSTRAINT fk_rails_9df4a56538 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_finding_signatures
    ADD CONSTRAINT fk_rails_9e0baf9dcd FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY target_branch_rules
    ADD CONSTRAINT fk_rails_9e9cf81c8e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY timelog_categories
    ADD CONSTRAINT fk_rails_9f27b821a8 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_milestone_events
    ADD CONSTRAINT fk_rails_a006df5590 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_root_storage_statistics
    ADD CONSTRAINT fk_rails_a0702c430b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY dingtalk_tracker_data
    ADD CONSTRAINT fk_rails_a138e0d542 FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY elastic_reindexing_slices
    ADD CONSTRAINT fk_rails_a17d86aeb9 FOREIGN KEY (elastic_reindexing_subtask_id) REFERENCES elastic_reindexing_subtasks(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_aliases
    ADD CONSTRAINT fk_rails_a1804f74a7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_packages_settings
    ADD CONSTRAINT fk_rails_a248d0c26f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY todos
    ADD CONSTRAINT fk_rails_a27c483435 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_environments
    ADD CONSTRAINT fk_rails_a354313d11 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_connect_subscriptions
    ADD CONSTRAINT fk_rails_a3c10bcf7d FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY fork_network_members
    ADD CONSTRAINT fk_rails_a40860a1ca FOREIGN KEY (fork_network_id) REFERENCES fork_networks(id) ON DELETE CASCADE;

ALTER TABLE ONLY customer_relations_organizations
    ADD CONSTRAINT fk_rails_a48597902f FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_agent_version_attachments
    ADD CONSTRAINT fk_rails_a4ed49efb5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_events
    ADD CONSTRAINT fk_rails_a55845e9fa FOREIGN KEY (workflow_id) REFERENCES duo_workflows_workflows(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_helm_file_metadata
    ADD CONSTRAINT fk_rails_a559865345 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_projects
    ADD CONSTRAINT fk_rails_a5a958bca1 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE ONLY commit_user_mentions
    ADD CONSTRAINT fk_rails_a6760813e0 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_preferences
    ADD CONSTRAINT fk_rails_a69bfcfd81 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY sentry_issues
    ADD CONSTRAINT fk_rails_a6a9612965 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_permission_export_uploads
    ADD CONSTRAINT fk_rails_a7130085e3 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY repository_languages
    ADD CONSTRAINT fk_rails_a750ec87a8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dependency_proxy_manifests
    ADD CONSTRAINT fk_rails_a758021fb0 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_milestone_events
    ADD CONSTRAINT fk_rails_a788026e85 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY term_agreements
    ADD CONSTRAINT fk_rails_a88721bcdf FOREIGN KEY (term_id) REFERENCES application_setting_terms(id);

ALTER TABLE ONLY saved_replies
    ADD CONSTRAINT fk_rails_a8bf5bf111 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_pipeline_artifacts
    ADD CONSTRAINT fk_rails_a9e811a466_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_user_mentions
    ADD CONSTRAINT fk_rails_aa1b2961b1 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_repository_states
    ADD CONSTRAINT fk_rails_aa2f8a61ba FOREIGN KEY (project_wiki_repository_id) REFERENCES project_wiki_repositories(id) ON DELETE CASCADE;

ALTER TABLE ONLY x509_commit_signatures
    ADD CONSTRAINT fk_rails_ab07452314 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_profiles_tags
    ADD CONSTRAINT fk_rails_ab9e643cd8 FOREIGN KEY (dast_profile_id) REFERENCES dast_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT fk_rails_abf5d4affa FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_registry_protection_rules
    ADD CONSTRAINT fk_rails_ac331fcba9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY clusters
    ADD CONSTRAINT fk_rails_ac3a663d79 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY group_saved_replies
    ADD CONSTRAINT fk_rails_acd8e1889b FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_composer_metadata
    ADD CONSTRAINT fk_rails_ad48c2e5bb FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_phone_number_validations
    ADD CONSTRAINT fk_rails_ad6686f3d8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY duo_workflows_events
    ADD CONSTRAINT fk_rails_ae183590f0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_group_stages
    ADD CONSTRAINT fk_rails_ae5da3409b FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE p_ci_build_trace_metadata
    ADD CONSTRAINT fk_rails_aebc78111f_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_trackers
    ADD CONSTRAINT fk_rails_aed566d3f3 FOREIGN KEY (bulk_import_entity_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;

ALTER TABLE ONLY pipl_users
    ADD CONSTRAINT fk_rails_af0eb8b205 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY pool_repositories
    ADD CONSTRAINT fk_rails_af3f8c5d62 FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT;

ALTER TABLE ONLY resource_label_events
    ADD CONSTRAINT fk_rails_b126799f57 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE SET NULL;

ALTER TABLE ONLY webauthn_registrations
    ADD CONSTRAINT fk_rails_b15c016782 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY scim_group_memberships
    ADD CONSTRAINT fk_rails_b16ccc85e2 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_build_infos
    ADD CONSTRAINT fk_rails_b18868292d FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY authentication_events
    ADD CONSTRAINT fk_rails_b204656a54 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY merge_trains
    ADD CONSTRAINT fk_rails_b29261ce31 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_project_recent_visits
    ADD CONSTRAINT fk_rails_b315dd0c80 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_trains
    ADD CONSTRAINT fk_rails_b374b5225d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_predictions
    ADD CONSTRAINT fk_rails_b3b78cbcd0 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_escalation_rules
    ADD CONSTRAINT fk_rails_b3c9c17bd4 FOREIGN KEY (oncall_schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE;

ALTER TABLE p_ai_active_context_code_repositories
    ADD CONSTRAINT fk_rails_b3d72d06cf FOREIGN KEY (connection_id) REFERENCES ai_active_context_connections(id) ON DELETE SET NULL;

ALTER TABLE ONLY duo_workflows_checkpoints
    ADD CONSTRAINT fk_rails_b4c109b1a4 FOREIGN KEY (workflow_id) REFERENCES duo_workflows_workflows(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_component_files
    ADD CONSTRAINT fk_rails_b543a9622b FOREIGN KEY (architecture_id) REFERENCES packages_debian_project_architectures(id) ON DELETE RESTRICT;

ALTER TABLE ONLY namespace_aggregation_schedules
    ADD CONSTRAINT fk_rails_b565c8d16c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_registry_data_repair_details
    ADD CONSTRAINT fk_rails_b70d8111d9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE batched_background_migration_job_transition_logs
    ADD CONSTRAINT fk_rails_b7523a175b FOREIGN KEY (batched_background_migration_job_id) REFERENCES batched_background_migration_jobs(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_protected_branches
    ADD CONSTRAINT fk_rails_b7567b031b FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_trust_scores
    ADD CONSTRAINT fk_rails_b903079eb4 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_authorizations_for_migration
    ADD CONSTRAINT fk_rails_b91fc9995e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY virtual_registries_packages_maven_registry_upstreams
    ADD CONSTRAINT fk_rails_b991fff0be FOREIGN KEY (registry_id) REFERENCES virtual_registries_packages_maven_registries(id) ON DELETE CASCADE;

ALTER TABLE ONLY dora_configurations
    ADD CONSTRAINT fk_rails_b9b8d90ddb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_trains
    ADD CONSTRAINT fk_rails_b9d67af01d FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_users
    ADD CONSTRAINT fk_rails_b9e9394efb FOREIGN KEY (approval_project_rule_id) REFERENCES approval_project_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY lists
    ADD CONSTRAINT fk_rails_baed5f39b7 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE;

ALTER TABLE security_findings
    ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_component_files
    ADD CONSTRAINT fk_rails_bbe9ebfbd9 FOREIGN KEY (component_id) REFERENCES packages_debian_project_components(id) ON DELETE RESTRICT;

ALTER TABLE ONLY vulnerability_severity_overrides
    ADD CONSTRAINT fk_rails_bbeaab8fb3 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects_sync_events
    ADD CONSTRAINT fk_rails_bbf0eef59f FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE p_ci_build_names
    ADD CONSTRAINT fk_rails_bc221a297a FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rules_users
    ADD CONSTRAINT fk_rails_bc8972fa55 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE p_ci_builds_execution_configs
    ADD CONSTRAINT fk_rails_bc9ff5d0a9_p FOREIGN KEY (partition_id, pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY observability_traces_issues_connections
    ADD CONSTRAINT fk_rails_bcf18aa0d2 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY elasticsearch_indexed_projects
    ADD CONSTRAINT fk_rails_bd13bbdc3d FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY elasticsearch_indexed_namespaces
    ADD CONSTRAINT fk_rails_bdcf044f37 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_occurrence_identifiers
    ADD CONSTRAINT fk_rails_be2e49e1d0 FOREIGN KEY (identifier_id) REFERENCES vulnerability_identifiers(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_batches
    ADD CONSTRAINT fk_rails_be479792f6 FOREIGN KEY (export_id) REFERENCES bulk_import_exports(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_http_integrations
    ADD CONSTRAINT fk_rails_bec49f52cc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_ci_cd_settings
    ADD CONSTRAINT fk_rails_bf04185d54 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_occurrences
    ADD CONSTRAINT fk_rails_bf5b788ca7 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_weight_events
    ADD CONSTRAINT fk_rails_bfc406b47c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY design_management_designs
    ADD CONSTRAINT fk_rails_bfe283ec3c FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY atlassian_identities
    ADD CONSTRAINT fk_rails_c02928bc18 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY slack_integrations_scopes
    ADD CONSTRAINT fk_rails_c0e018a6fe FOREIGN KEY (slack_api_scope_id) REFERENCES slack_api_scopes(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_npm_metadata
    ADD CONSTRAINT fk_rails_c0e5fce6f3 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY labels
    ADD CONSTRAINT fk_rails_c1ac5161d8 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_feature_usages
    ADD CONSTRAINT fk_rails_c22a50024b FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_repositories
    ADD CONSTRAINT fk_rails_c3258dc63b FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT;

ALTER TABLE ONLY packages_nuget_dependency_link_metadata
    ADD CONSTRAINT fk_rails_c3313ee2e4 FOREIGN KEY (dependency_link_id) REFERENCES packages_dependency_links(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_deploy_keys_groups
    ADD CONSTRAINT fk_rails_c3854f19f5 FOREIGN KEY (group_deploy_key_id) REFERENCES group_deploy_keys(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_wiki_repositories
    ADD CONSTRAINT fk_rails_c3dd796199 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_user_mentions
    ADD CONSTRAINT fk_rails_c440b9ea31 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_achievements
    ADD CONSTRAINT fk_rails_c44f5b3b25 FOREIGN KEY (achievement_id) REFERENCES achievements(id) ON DELETE CASCADE;

ALTER TABLE ONLY related_epic_links
    ADD CONSTRAINT fk_rails_c464534def FOREIGN KEY (source_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_recent_visits
    ADD CONSTRAINT fk_rails_c4dcba4a3e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE p_ci_job_artifacts
    ADD CONSTRAINT fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY ci_hosted_runners
    ADD CONSTRAINT fk_rails_c550bc493e FOREIGN KEY (runner_id) REFERENCES instance_type_ci_runners(id) ON DELETE CASCADE;

ALTER TABLE ONLY organization_settings
    ADD CONSTRAINT fk_rails_c56e4690c0 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY system_access_microsoft_applications
    ADD CONSTRAINT fk_rails_c5b7765d04 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY custom_software_licenses
    ADD CONSTRAINT fk_rails_c68163fae6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_settings
    ADD CONSTRAINT fk_rails_c6df6e6328 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY container_expiration_policies
    ADD CONSTRAINT fk_rails_c7360f09ad FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY wiki_page_meta
    ADD CONSTRAINT fk_rails_c7a0c59cf1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY scim_oauth_access_tokens
    ADD CONSTRAINT fk_rails_c84404fb6c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_occurrences
    ADD CONSTRAINT fk_rails_c8661a61eb FOREIGN KEY (primary_identifier_id) REFERENCES vulnerability_identifiers(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_export_jobs
    ADD CONSTRAINT fk_rails_c88d8db2e1 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT fk_rails_c913c64977 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_milestone_events
    ADD CONSTRAINT fk_rails_c940fb9fc5 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE;

ALTER TABLE ONLY compromised_password_detections
    ADD CONSTRAINT fk_rails_c95dee3ea4 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY gpg_signatures
    ADD CONSTRAINT fk_rails_c97176f5f7 FOREIGN KEY (gpg_key_id) REFERENCES gpg_keys(id) ON DELETE SET NULL;

ALTER TABLE ONLY board_group_recent_visits
    ADD CONSTRAINT fk_rails_ca04c38720 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY relation_import_trackers
    ADD CONSTRAINT fk_rails_ca9bd1ef8a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_user_metrics
    ADD CONSTRAINT fk_rails_cafde02a0c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_positions
    ADD CONSTRAINT fk_rails_cb4563dd6e FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_finding_links
    ADD CONSTRAINT fk_rails_cbdfde27ce FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_details
    ADD CONSTRAINT fk_rails_cc11a451f8 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_strategies_user_lists
    ADD CONSTRAINT fk_rails_ccb7e4bc0b FOREIGN KEY (user_list_id) REFERENCES operations_user_lists(id) ON DELETE CASCADE;

ALTER TABLE ONLY observability_group_o11y_settings
    ADD CONSTRAINT fk_rails_cdcfbdd08d FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY members_deletion_schedules
    ADD CONSTRAINT fk_rails_ce06d97eb2 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_milestone_events
    ADD CONSTRAINT fk_rails_cedf8cce4d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY resource_iteration_events
    ADD CONSTRAINT fk_rails_cee126f66c FOREIGN KEY (iteration_id) REFERENCES sprints(id) ON DELETE CASCADE;

ALTER TABLE ONLY member_roles
    ADD CONSTRAINT fk_rails_cf0ee35814 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY pm_package_versions
    ADD CONSTRAINT fk_rails_cf94c3e601 FOREIGN KEY (pm_package_id) REFERENCES pm_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY upload_states
    ADD CONSTRAINT fk_rails_d00f153613 FOREIGN KEY (upload_id) REFERENCES uploads(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_source_user_placeholder_references
    ADD CONSTRAINT fk_rails_d0b75c434e FOREIGN KEY (source_user_id) REFERENCES import_source_users(id) ON DELETE CASCADE;

ALTER TABLE ONLY subscriptions
    ADD CONSTRAINT fk_rails_d0c8bda804 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_strategies
    ADD CONSTRAINT fk_rails_d183b6e6dd FOREIGN KEY (feature_flag_id) REFERENCES operations_feature_flags(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_agent_tokens
    ADD CONSTRAINT fk_rails_d1d26abc25 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;

ALTER TABLE ONLY requirements_management_test_reports
    ADD CONSTRAINT fk_rails_d1e8b498bf FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY design_management_repository_states
    ADD CONSTRAINT fk_rails_d2a258cc5a FOREIGN KEY (design_management_repository_id) REFERENCES design_management_repositories(id) ON DELETE CASCADE;

ALTER TABLE ONLY web_hooks
    ADD CONSTRAINT fk_rails_d35697648e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_current_statuses
    ADD CONSTRAINT fk_rails_d37e56a437 FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_group_links
    ADD CONSTRAINT fk_rails_d3a0488427 FOREIGN KEY (shared_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_issue_links
    ADD CONSTRAINT fk_rails_d459c19036 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_assignees
    ADD CONSTRAINT fk_rails_d47570ac62 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE p_ci_job_annotations
    ADD CONSTRAINT fk_rails_d4d0c0fa0f FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY packages_rpm_repository_files
    ADD CONSTRAINT fk_rails_d545cfaed2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE p_ci_builds
    ADD CONSTRAINT fk_rails_d739f46384_p FOREIGN KEY (partition_id, commit_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY packages_rpm_metadata
    ADD CONSTRAINT fk_rails_d79f02264b FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE p_ci_build_tags
    ADD CONSTRAINT fk_rails_d7bd025909 FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY note_metadata
    ADD CONSTRAINT fk_rails_d853224d37 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY ml_model_metadata
    ADD CONSTRAINT fk_rails_d907835e01 FOREIGN KEY (model_id) REFERENCES ml_models(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_ai_settings
    ADD CONSTRAINT fk_rails_d93015e2ed FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_reviewers
    ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_running_builds
    ADD CONSTRAINT fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY resource_link_events
    ADD CONSTRAINT fk_rails_da5dd8a56f FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_imports
    ADD CONSTRAINT fk_rails_da617096ce FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY dependency_proxy_blobs
    ADD CONSTRAINT fk_rails_db58bbc5d7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_user_preferences
    ADD CONSTRAINT fk_rails_dbebdaa8fe FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;

ALTER TABLE uploads_9ba88c4165
    ADD CONSTRAINT fk_rails_dc321bb575 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ai_duo_chat_events
    ADD CONSTRAINT fk_rails_dc42b37fb3 FOREIGN KEY (personal_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY instance_audit_events_streaming_headers
    ADD CONSTRAINT fk_rails_dc933c1f3c FOREIGN KEY (instance_external_audit_event_destination_id) REFERENCES audit_events_instance_external_audit_event_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY deployment_merge_requests
    ADD CONSTRAINT fk_rails_dcbce9f4df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_component_files
    ADD CONSTRAINT fk_rails_dd262386e9 FOREIGN KEY (component_id) REFERENCES packages_debian_group_components(id) ON DELETE RESTRICT;

ALTER TABLE ONLY incident_management_timeline_event_tags
    ADD CONSTRAINT fk_rails_dd5c91484e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY user_callouts
    ADD CONSTRAINT fk_rails_ddfdd80f3d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY scan_result_policies
    ADD CONSTRAINT fk_rails_de9e5d2ce6 FOREIGN KEY (security_orchestration_policy_configuration_id) REFERENCES security_orchestration_policy_configurations(id) ON DELETE CASCADE;

ALTER TABLE ONLY service_desk_custom_email_verifications
    ADD CONSTRAINT fk_rails_debe4c4acc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_project_distributions
    ADD CONSTRAINT fk_rails_df44271a30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE RESTRICT;

ALTER TABLE ONLY incident_management_oncall_shifts
    ADD CONSTRAINT fk_rails_df4feb286a FOREIGN KEY (rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_commit_emails
    ADD CONSTRAINT fk_rails_dfa4c104f5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_cycle_analytics_group_stages
    ADD CONSTRAINT fk_rails_dfb37c880d FOREIGN KEY (end_event_label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY bulk_import_export_uploads
    ADD CONSTRAINT fk_rails_dfbfb45eca FOREIGN KEY (export_id) REFERENCES bulk_import_exports(id) ON DELETE CASCADE;

ALTER TABLE ONLY vs_code_settings
    ADD CONSTRAINT fk_rails_e02b1ed535 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_group_streaming_event_type_filters
    ADD CONSTRAINT fk_rails_e07e457a27 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_label_links
    ADD CONSTRAINT fk_rails_e15ea8b6bc FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id) ON DELETE CASCADE;

ALTER TABLE ONLY label_priorities
    ADD CONSTRAINT fk_rails_e161058b0f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_label_links
    ADD CONSTRAINT fk_rails_e1a10f7c4e FOREIGN KEY (abuse_report_label_id) REFERENCES abuse_report_labels(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_packages
    ADD CONSTRAINT fk_rails_e1ac527425 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_platforms_kubernetes
    ADD CONSTRAINT fk_rails_e1e2cf841a FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE ONLY issue_emails
    ADD CONSTRAINT fk_rails_e2ee00a8f7 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_finding_evidences
    ADD CONSTRAINT fk_rails_e3205a0c65 FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_policy_rules
    ADD CONSTRAINT fk_rails_e344cb2d35 FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_select_field_values
    ADD CONSTRAINT fk_rails_e3ecc2c14e FOREIGN KEY (custom_field_id) REFERENCES custom_fields(id) ON DELETE CASCADE;

ALTER TABLE ONLY clusters_integration_prometheus
    ADD CONSTRAINT fk_rails_e44472034c FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE p_duo_workflows_checkpoints
    ADD CONSTRAINT fk_rails_e449184b59 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_occurrence_identifiers
    ADD CONSTRAINT fk_rails_e4ef6d027c FOREIGN KEY (occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_protection_rules
    ADD CONSTRAINT fk_rails_e52adb5267 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_flags
    ADD CONSTRAINT fk_rails_e59393b48b FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;

ALTER TABLE uploads_9ba88c4165
    ADD CONSTRAINT fk_rails_e5afc14eb7 FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_escalation_policies
    ADD CONSTRAINT fk_rails_e5b513daa7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY software_license_policies
    ADD CONSTRAINT fk_rails_e5b77d620e FOREIGN KEY (scan_result_policy_id) REFERENCES scan_result_policies(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_merge_request_rule_sources
    ADD CONSTRAINT fk_rails_e605a04f76 FOREIGN KEY (approval_merge_request_rule_id) REFERENCES approval_merge_request_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_metrics
    ADD CONSTRAINT fk_rails_e6d7c24d1b FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY draft_notes
    ADD CONSTRAINT fk_rails_e753681674 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY namespace_package_settings
    ADD CONSTRAINT fk_rails_e773444769 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY boards_epic_board_recent_visits
    ADD CONSTRAINT fk_rails_e77911cf03 FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_instance_event_type_filters
    ADD CONSTRAINT fk_rails_e7bb18c0e1 FOREIGN KEY (instance_external_audit_event_destination_id) REFERENCES audit_events_instance_external_audit_event_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_text_field_values
    ADD CONSTRAINT fk_rails_e846cf23c6 FOREIGN KEY (custom_field_id) REFERENCES custom_fields(id) ON DELETE CASCADE;

ALTER TABLE ONLY group_deploy_keys_groups
    ADD CONSTRAINT fk_rails_e87145115d FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_streaming_event_type_filters
    ADD CONSTRAINT fk_rails_e8bd011129 FOREIGN KEY (external_audit_event_destination_id) REFERENCES audit_events_external_audit_event_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY description_versions
    ADD CONSTRAINT fk_rails_e8f4caf9c7 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;

ALTER TABLE ONLY projects_with_pipeline_variables
    ADD CONSTRAINT fk_rails_e9080b2336 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_request_blocks
    ADD CONSTRAINT fk_rails_e9387863bc FOREIGN KEY (blocking_merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_custom_fields
    ADD CONSTRAINT fk_rails_e990d7ad38 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY protected_branch_unprotect_access_levels
    ADD CONSTRAINT fk_rails_e9eb8dc025 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;

ALTER TABLE ONLY ai_vectorizable_files
    ADD CONSTRAINT fk_rails_ea2e440084 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY alert_management_alert_user_mentions
    ADD CONSTRAINT fk_rails_eb2de0cdef FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_statistics
    ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;

ALTER TABLE ONLY slack_integrations_scopes
    ADD CONSTRAINT fk_rails_ece1eb6772 FOREIGN KEY (slack_integration_id) REFERENCES slack_integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY iterations_cadences
    ADD CONSTRAINT fk_rails_ece400c55a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_profiles
    ADD CONSTRAINT fk_rails_ed1e66fbbf FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_current_statuses
    ADD CONSTRAINT fk_rails_ed36c2df68 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_security_settings
    ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_distributions
    ADD CONSTRAINT fk_rails_ede0bb937f FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY ci_daily_build_group_report_results
    ADD CONSTRAINT fk_rails_ee072d13b3_p FOREIGN KEY (partition_id, last_pipeline_id) REFERENCES p_ci_pipelines(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY import_source_users
    ADD CONSTRAINT fk_rails_ee30e569be FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY audit_events_group_streaming_event_type_filters
    ADD CONSTRAINT fk_rails_ee6950967f FOREIGN KEY (external_streaming_destination_id) REFERENCES audit_events_group_external_streaming_destinations(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_debian_group_architectures
    ADD CONSTRAINT fk_rails_ef667d1b03 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_relation_exports
    ADD CONSTRAINT fk_rails_ef89b354fc FOREIGN KEY (project_export_job_id) REFERENCES project_export_jobs(id) ON DELETE CASCADE;

ALTER TABLE ONLY label_priorities
    ADD CONSTRAINT fk_rails_ef916d14fa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY fork_network_members
    ADD CONSTRAINT fk_rails_efccadc4ec FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_rule_schedules
    ADD CONSTRAINT fk_rails_efe1d9b133 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY dast_pre_scan_verifications
    ADD CONSTRAINT fk_rails_f08d9312a8 FOREIGN KEY (dast_profile_id) REFERENCES dast_profiles(id) ON DELETE CASCADE;

ALTER TABLE ONLY analytics_dashboards_pointers
    ADD CONSTRAINT fk_rails_f0e7c640c3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY import_export_uploads
    ADD CONSTRAINT fk_rails_f129140f9e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY jira_connect_subscriptions
    ADD CONSTRAINT fk_rails_f1d617343f FOREIGN KEY (jira_connect_installation_id) REFERENCES jira_connect_installations(id) ON DELETE CASCADE;

ALTER TABLE ONLY requirements
    ADD CONSTRAINT fk_rails_f212e67e63 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY snippet_repositories
    ADD CONSTRAINT fk_rails_f21f899728 FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT;

ALTER TABLE ONLY elastic_reindexing_subtasks
    ADD CONSTRAINT fk_rails_f2cc190164 FOREIGN KEY (elastic_reindexing_task_id) REFERENCES elastic_reindexing_tasks(id) ON DELETE CASCADE;

ALTER TABLE ONLY approval_project_rules_users
    ADD CONSTRAINT fk_rails_f365da8250 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY insights
    ADD CONSTRAINT fk_rails_f36fda3932 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE incident_management_pending_alert_escalations
    ADD CONSTRAINT fk_rails_f3d17bc8af FOREIGN KEY (rule_id) REFERENCES incident_management_escalation_rules(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_group_recent_visits
    ADD CONSTRAINT fk_rails_f410736518 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_issuable_escalation_statuses
    ADD CONSTRAINT fk_rails_f4c811fd28 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY vulnerability_export_parts
    ADD CONSTRAINT fk_rails_f50ca1aabf FOREIGN KEY (vulnerability_export_id) REFERENCES vulnerability_exports(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_state_events
    ADD CONSTRAINT fk_rails_f5827a7ccd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY packages_debian_group_components
    ADD CONSTRAINT fk_rails_f5f1ef54c6 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE;

ALTER TABLE ONLY incident_management_oncall_shifts
    ADD CONSTRAINT fk_rails_f6eef06841 FOREIGN KEY (participant_id) REFERENCES incident_management_oncall_participants(id) ON DELETE CASCADE;

ALTER TABLE ONLY design_user_mentions
    ADD CONSTRAINT fk_rails_f7075a53c1 FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE;

ALTER TABLE ONLY internal_ids
    ADD CONSTRAINT fk_rails_f7d46b66c6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_trainings
    ADD CONSTRAINT fk_rails_f80240fae0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;

ALTER TABLE ONLY merge_requests_closing_issues
    ADD CONSTRAINT fk_rails_f8540692be FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE p_ci_job_artifact_reports
    ADD CONSTRAINT fk_rails_f9b8550174 FOREIGN KEY (partition_id, job_artifact_id) REFERENCES p_ci_job_artifacts(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY banned_users
    ADD CONSTRAINT fk_rails_fa5bb598e5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY targeted_message_dismissals
    ADD CONSTRAINT fk_rails_fa9d2df3f9 FOREIGN KEY (targeted_message_id) REFERENCES targeted_messages(id) ON DELETE CASCADE;

ALTER TABLE ONLY operations_feature_flags_issues
    ADD CONSTRAINT fk_rails_fb4d2a7cb1 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY board_project_recent_visits
    ADD CONSTRAINT fk_rails_fb6fc419cb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

ALTER TABLE ONLY ci_job_variables
    ADD CONSTRAINT fk_rails_fbf3b34792_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY custom_field_select_options
    ADD CONSTRAINT fk_rails_fc0a0b8b00 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_nuget_metadata
    ADD CONSTRAINT fk_rails_fc0c19f5b4 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

ALTER TABLE ONLY customer_relations_contacts
    ADD CONSTRAINT fk_rails_fd3f2e7572 FOREIGN KEY (organization_id) REFERENCES customer_relations_organizations(id) ON DELETE CASCADE;

ALTER TABLE ONLY external_approval_rules
    ADD CONSTRAINT fk_rails_fd4f9ac573 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY abuse_report_assignees
    ADD CONSTRAINT fk_rails_fd5f22166b FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id) ON DELETE CASCADE;

ALTER TABLE ONLY cluster_groups
    ADD CONSTRAINT fk_rails_fdb8648a96 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;

ALTER TABLE ONLY project_control_compliance_statuses
    ADD CONSTRAINT fk_rails_fe05913910 FOREIGN KEY (compliance_requirements_control_id) REFERENCES compliance_requirements_controls(id) ON DELETE CASCADE;

ALTER TABLE ONLY resource_label_events
    ADD CONSTRAINT fk_rails_fe91ece594 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;

ALTER TABLE ONLY pages_deployment_states
    ADD CONSTRAINT fk_rails_ff6ca551a4 FOREIGN KEY (pages_deployment_id) REFERENCES pages_deployments(id) ON DELETE CASCADE;

ALTER TABLE ONLY packages_terraform_module_metadata
    ADD CONSTRAINT fk_rails_terraform_module_metadata_project_id FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY security_orchestration_policy_configurations
    ADD CONSTRAINT fk_security_policy_configurations_management_project_id FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE CASCADE;

ALTER TABLE ONLY integrations
    ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES integrations(id) ON DELETE CASCADE;

ALTER TABLE ONLY merge_requests
    ADD CONSTRAINT fk_source_project FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL;

ALTER TABLE ONLY timelogs
    ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE ONLY timelogs
    ADD CONSTRAINT fk_timelogs_merge_requests_merge_request_id FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;

ALTER TABLE ONLY timelogs
    ADD CONSTRAINT fk_timelogs_note_id FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE SET NULL;

ALTER TABLE ONLY work_item_colors
    ADD CONSTRAINT fk_work_item_colors_on_namespace_id FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_dates_sources
    ADD CONSTRAINT fk_work_item_dates_sources_on_namespace_id FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_hierarchy_restrictions
    ADD CONSTRAINT fk_work_item_hierarchy_restrictions_child_type_id FOREIGN KEY (child_type_id) REFERENCES work_item_types(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY work_item_hierarchy_restrictions
    ADD CONSTRAINT fk_work_item_hierarchy_restrictions_parent_type_id FOREIGN KEY (parent_type_id) REFERENCES work_item_types(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY work_item_related_link_restrictions
    ADD CONSTRAINT fk_work_item_related_link_restrictions_source_type_id FOREIGN KEY (source_type_id) REFERENCES work_item_types(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY work_item_related_link_restrictions
    ADD CONSTRAINT fk_work_item_related_link_restrictions_target_type_id FOREIGN KEY (target_type_id) REFERENCES work_item_types(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_custom_fields
    ADD CONSTRAINT fk_work_item_type_custom_fields_on_work_item_type_id FOREIGN KEY (work_item_type_id) REFERENCES work_item_types(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_type_user_preferences
    ADD CONSTRAINT fk_work_item_type_user_preferences_on_work_item_type_id FOREIGN KEY (work_item_type_id) REFERENCES work_item_types(id) ON DELETE CASCADE;

ALTER TABLE ONLY work_item_widget_definitions
    ADD CONSTRAINT fk_work_item_widget_definitions_work_item_type_id FOREIGN KEY (work_item_type_id) REFERENCES work_item_types(id) ON UPDATE CASCADE ON DELETE CASCADE;

ALTER TABLE ONLY zoekt_indices
    ADD CONSTRAINT fk_zoekt_indices_on_zoekt_replica_id FOREIGN KEY (zoekt_replica_id) REFERENCES zoekt_replicas(id) ON DELETE SET NULL;

ALTER TABLE ONLY zoekt_repositories
    ADD CONSTRAINT fk_zoekt_repositories_on_zoekt_index_id FOREIGN KEY (zoekt_index_id) REFERENCES zoekt_indices(id) ON DELETE RESTRICT;

ALTER TABLE issue_search_data
    ADD CONSTRAINT issue_search_data_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;

ALTER TABLE issue_search_data
    ADD CONSTRAINT issue_search_data_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;
