in db/migrate/20190402150158_backport_enterprise_schema.rb [870:1761]
def create_missing_tables
create_table_if_not_exists "approval_merge_request_rule_sources", id: :bigserial do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.bigint "approval_project_rule_id", null: false
t.index %w[approval_merge_request_rule_id], name: "index_approval_merge_request_rule_sources_1", unique: true, using: :btree
t.index %w[approval_project_rule_id], name: "index_approval_merge_request_rule_sources_2", using: :btree
end
create_table_if_not_exists "approval_merge_request_rules", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "merge_request_id", null: false
t.integer "approvals_required", limit: 2, default: 0, null: false
t.boolean "code_owner", default: false, null: false
t.string "name", null: false
t.index %w[merge_request_id code_owner name], name: "approval_rule_name_index_for_code_owners", unique: true, where: "(code_owner = true)", using: :btree
t.index %w[merge_request_id code_owner], name: "index_approval_merge_request_rules_1", using: :btree
end
create_table_if_not_exists "approval_merge_request_rules_approved_approvers", id: :bigserial do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.integer "user_id", null: false
t.index %w[approval_merge_request_rule_id user_id], name: "index_approval_merge_request_rules_approved_approvers_1", unique: true, using: :btree
t.index %w[user_id], name: "index_approval_merge_request_rules_approved_approvers_2", using: :btree
end
create_table_if_not_exists "approval_merge_request_rules_groups", id: :bigserial do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.integer "group_id", null: false
t.index %w[approval_merge_request_rule_id group_id], name: "index_approval_merge_request_rules_groups_1", unique: true, using: :btree
t.index %w[group_id], name: "index_approval_merge_request_rules_groups_2", using: :btree
end
create_table_if_not_exists "approval_merge_request_rules_users", id: :bigserial do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.integer "user_id", null: false
t.index %w[approval_merge_request_rule_id user_id], name: "index_approval_merge_request_rules_users_1", unique: true, using: :btree
t.index %w[user_id], name: "index_approval_merge_request_rules_users_2", using: :btree
end
create_table_if_not_exists "approval_project_rules", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
t.integer "approvals_required", limit: 2, default: 0, null: false
t.string "name", null: false
t.index %w[project_id], name: "index_approval_project_rules_on_project_id", using: :btree
end
create_table_if_not_exists "approval_project_rules_groups", id: :bigserial do |t|
t.bigint "approval_project_rule_id", null: false
t.integer "group_id", null: false
t.index %w[approval_project_rule_id group_id], name: "index_approval_project_rules_groups_1", unique: true, using: :btree
t.index %w[group_id], name: "index_approval_project_rules_groups_2", using: :btree
end
create_table_if_not_exists "approval_project_rules_users", id: :bigserial do |t|
t.bigint "approval_project_rule_id", null: false
t.integer "user_id", null: false
t.index %w[approval_project_rule_id user_id], name: "index_approval_project_rules_users_1", unique: true, using: :btree
t.index %w[user_id], name: "index_approval_project_rules_users_2", using: :btree
end
create_table_if_not_exists "approvals" do |t|
t.integer "merge_request_id", null: false
t.integer "user_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index %w[merge_request_id], name: "index_approvals_on_merge_request_id", using: :btree
end
create_table_if_not_exists "approver_groups" do |t|
t.integer "target_id", null: false
t.string "target_type", null: false
t.integer "group_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index %w[group_id], name: "index_approver_groups_on_group_id", using: :btree
t.index %w[target_id target_type], name: "index_approver_groups_on_target_id_and_target_type", using: :btree
end
create_table_if_not_exists "approvers" do |t|
t.integer "target_id", null: false
t.string "target_type"
t.integer "user_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index %w[target_id target_type], name: "index_approvers_on_target_id_and_target_type", using: :btree
t.index %w[user_id], name: "index_approvers_on_user_id", using: :btree
end
create_table_if_not_exists "board_assignees" do |t|
t.integer "board_id", null: false
t.integer "assignee_id", null: false
t.index %w[assignee_id], name: "index_board_assignees_on_assignee_id", using: :btree
t.index %w[board_id assignee_id], name: "index_board_assignees_on_board_id_and_assignee_id", unique: true, using: :btree
end
create_table_if_not_exists "board_labels" do |t|
t.integer "board_id", null: false
t.integer "label_id", null: false
t.index %w[board_id label_id], name: "index_board_labels_on_board_id_and_label_id", unique: true, using: :btree
t.index %w[label_id], name: "index_board_labels_on_label_id", using: :btree
end
create_table_if_not_exists "ci_sources_pipelines" do |t|
t.integer "project_id"
t.integer "pipeline_id"
t.integer "source_project_id"
t.integer "source_job_id"
t.integer "source_pipeline_id"
t.index ["pipeline_id"], name: "index_ci_sources_pipelines_on_pipeline_id", using: :btree
t.index ["project_id"], name: "index_ci_sources_pipelines_on_project_id", using: :btree
t.index ["source_job_id"], name: "index_ci_sources_pipelines_on_source_job_id", using: :btree
t.index ["source_pipeline_id"], name: "index_ci_sources_pipelines_on_source_pipeline_id", using: :btree
t.index ["source_project_id"], name: "index_ci_sources_pipelines_on_source_project_id", using: :btree
end
create_table_if_not_exists "design_management_designs", id: :bigserial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "issue_id", null: false
t.string "filename", null: false
t.index %w[issue_id filename], name: "index_design_management_designs_on_issue_id_and_filename", unique: true, using: :btree
t.index ["project_id"], name: "index_design_management_designs_on_project_id", using: :btree
end
create_table_if_not_exists "design_management_designs_versions", id: false, force: :cascade do |t|
t.bigint "design_id", null: false
t.bigint "version_id", null: false
t.index %w[design_id version_id], name: "design_management_designs_versions_uniqueness", unique: true, using: :btree
t.index ["design_id"], name: "index_design_management_designs_versions_on_design_id", using: :btree
t.index ["version_id"], name: "index_design_management_designs_versions_on_version_id", using: :btree
end
create_table_if_not_exists "design_management_versions", id: :bigserial, force: :cascade do |t|
t.binary "sha", null: false
t.index ["sha"], name: "index_design_management_versions_on_sha", unique: true, using: :btree
end
create_table_if_not_exists "draft_notes", id: :bigserial do |t|
t.integer "merge_request_id", null: false
t.integer "author_id", null: false
t.boolean "resolve_discussion", default: false, null: false
t.string "discussion_id"
t.text "note", null: false
t.text "position"
t.text "original_position"
t.text "change_position"
t.index ["author_id"], name: "index_draft_notes_on_author_id", using: :btree
t.index ["discussion_id"], name: "index_draft_notes_on_discussion_id", using: :btree
t.index ["merge_request_id"], name: "index_draft_notes_on_merge_request_id", using: :btree
end
create_table_if_not_exists "elasticsearch_indexed_namespaces", id: false do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "namespace_id"
t.index ["namespace_id"], name: "index_elasticsearch_indexed_namespaces_on_namespace_id", unique: true, using: :btree
end
create_table_if_not_exists "elasticsearch_indexed_projects", id: false do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id"
t.index ["project_id"], name: "index_elasticsearch_indexed_projects_on_project_id", unique: true, using: :btree
end
create_table_if_not_exists "epic_issues" do |t|
t.integer "epic_id", null: false
t.integer "issue_id", null: false
t.integer "relative_position", default: 1073741823, null: false
t.index ["epic_id"], name: "index_epic_issues_on_epic_id", using: :btree
t.index ["issue_id"], name: "index_epic_issues_on_issue_id", unique: true, using: :btree
end
create_table_if_not_exists "epic_metrics" do |t|
t.integer "epic_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["epic_id"], name: "index_epic_metrics", using: :btree
end
create_table_if_not_exists "epics" do |t|
t.integer "milestone_id"
t.integer "group_id", null: false
t.integer "author_id", null: false
t.integer "assignee_id"
t.integer "iid", null: false
t.integer "cached_markdown_version"
t.integer "updated_by_id"
t.integer "last_edited_by_id"
t.integer "lock_version"
t.date "start_date"
t.date "end_date"
t.datetime "last_edited_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title", null: false
t.string "title_html", null: false
t.text "description"
t.text "description_html"
t.integer "start_date_sourcing_milestone_id"
t.integer "due_date_sourcing_milestone_id"
t.date "start_date_fixed"
t.date "due_date_fixed"
t.boolean "start_date_is_fixed"
t.boolean "due_date_is_fixed"
t.integer "state", limit: 2, default: 1, null: false
t.integer "closed_by_id"
t.datetime "closed_at"
t.integer "parent_id"
t.integer "relative_position"
t.index ["assignee_id"], name: "index_epics_on_assignee_id", using: :btree
t.index ["author_id"], name: "index_epics_on_author_id", using: :btree
t.index ["closed_by_id"], name: "index_epics_on_closed_by_id", using: :btree
t.index ["end_date"], name: "index_epics_on_end_date", using: :btree
t.index ["group_id"], name: "index_epics_on_group_id", using: :btree
t.index ["iid"], name: "index_epics_on_iid", using: :btree
t.index ["milestone_id"], name: "index_milestone", using: :btree
t.index ["parent_id"], name: "index_epics_on_parent_id", using: :btree
t.index ["start_date"], name: "index_epics_on_start_date", using: :btree
end
create_table_if_not_exists "geo_cache_invalidation_events", id: :bigserial do |t|
t.string "key", null: false
end
create_table_if_not_exists "geo_event_log", id: :bigserial do |t|
t.datetime "created_at", null: false
t.bigint "repository_updated_event_id"
t.bigint "repository_deleted_event_id"
t.bigint "repository_renamed_event_id"
t.bigint "repositories_changed_event_id"
t.bigint "repository_created_event_id"
t.bigint "hashed_storage_migrated_event_id"
t.bigint "lfs_object_deleted_event_id"
t.bigint "hashed_storage_attachments_event_id"
t.bigint "upload_deleted_event_id"
t.bigint "job_artifact_deleted_event_id"
t.bigint "reset_checksum_event_id"
t.bigint "cache_invalidation_event_id"
t.index ["cache_invalidation_event_id"], name: "index_geo_event_log_on_cache_invalidation_event_id", where: "(cache_invalidation_event_id IS NOT NULL)", using: :btree
t.index ["hashed_storage_attachments_event_id"], name: "index_geo_event_log_on_hashed_storage_attachments_event_id", where: "(hashed_storage_attachments_event_id IS NOT NULL)", using: :btree
t.index ["hashed_storage_migrated_event_id"], name: "index_geo_event_log_on_hashed_storage_migrated_event_id", where: "(hashed_storage_migrated_event_id IS NOT NULL)", using: :btree
t.index ["job_artifact_deleted_event_id"], name: "index_geo_event_log_on_job_artifact_deleted_event_id", where: "(job_artifact_deleted_event_id IS NOT NULL)", using: :btree
t.index ["lfs_object_deleted_event_id"], name: "index_geo_event_log_on_lfs_object_deleted_event_id", where: "(lfs_object_deleted_event_id IS NOT NULL)", using: :btree
t.index ["repositories_changed_event_id"], name: "index_geo_event_log_on_repositories_changed_event_id", where: "(repositories_changed_event_id IS NOT NULL)", using: :btree
t.index ["repository_created_event_id"], name: "index_geo_event_log_on_repository_created_event_id", where: "(repository_created_event_id IS NOT NULL)", using: :btree
t.index ["repository_deleted_event_id"], name: "index_geo_event_log_on_repository_deleted_event_id", where: "(repository_deleted_event_id IS NOT NULL)", using: :btree
t.index ["repository_renamed_event_id"], name: "index_geo_event_log_on_repository_renamed_event_id", where: "(repository_renamed_event_id IS NOT NULL)", using: :btree
t.index ["repository_updated_event_id"], name: "index_geo_event_log_on_repository_updated_event_id", where: "(repository_updated_event_id IS NOT NULL)", using: :btree
t.index ["reset_checksum_event_id"], name: "index_geo_event_log_on_reset_checksum_event_id", where: "(reset_checksum_event_id IS NOT NULL)", using: :btree
t.index ["upload_deleted_event_id"], name: "index_geo_event_log_on_upload_deleted_event_id", where: "(upload_deleted_event_id IS NOT NULL)", using: :btree
end
create_table_if_not_exists "geo_hashed_storage_attachments_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.text "old_attachments_path", null: false
t.text "new_attachments_path", null: false
t.index ["project_id"], name: "index_geo_hashed_storage_attachments_events_on_project_id", using: :btree
end
create_table_if_not_exists "geo_hashed_storage_migrated_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "old_disk_path", null: false
t.text "new_disk_path", null: false
t.text "old_wiki_disk_path", null: false
t.text "new_wiki_disk_path", null: false
t.integer "old_storage_version", limit: 2
t.integer "new_storage_version", limit: 2, null: false
t.index ["project_id"], name: "index_geo_hashed_storage_migrated_events_on_project_id", using: :btree
end
create_table_if_not_exists "geo_job_artifact_deleted_events", id: :bigserial do |t|
t.integer "job_artifact_id", null: false
t.string "file_path", null: false
t.index ["job_artifact_id"], name: "index_geo_job_artifact_deleted_events_on_job_artifact_id", using: :btree
end
create_table_if_not_exists "geo_lfs_object_deleted_events", id: :bigserial do |t|
t.integer "lfs_object_id", null: false
t.string "oid", null: false
t.string "file_path", null: false
t.index ["lfs_object_id"], name: "index_geo_lfs_object_deleted_events_on_lfs_object_id", using: :btree
end
create_table_if_not_exists "geo_node_namespace_links" do |t|
t.integer "geo_node_id", null: false
t.integer "namespace_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index %w[geo_node_id namespace_id], name: "index_geo_node_namespace_links_on_geo_node_id_and_namespace_id", unique: true, using: :btree
t.index ["geo_node_id"], name: "index_geo_node_namespace_links_on_geo_node_id", using: :btree
t.index ["namespace_id"], name: "index_geo_node_namespace_links_on_namespace_id", using: :btree
end
create_table_if_not_exists "geo_node_statuses" do |t|
t.integer "geo_node_id", null: false
t.integer "db_replication_lag_seconds"
t.integer "repositories_synced_count"
t.integer "repositories_failed_count"
t.integer "lfs_objects_count"
t.integer "lfs_objects_synced_count"
t.integer "lfs_objects_failed_count"
t.integer "attachments_count"
t.integer "attachments_synced_count"
t.integer "attachments_failed_count"
t.integer "last_event_id"
t.datetime "last_event_date"
t.integer "cursor_last_event_id"
t.datetime "cursor_last_event_date"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "last_successful_status_check_at"
t.string "status_message"
t.integer "replication_slots_count"
t.integer "replication_slots_used_count"
t.bigint "replication_slots_max_retained_wal_bytes"
t.integer "wikis_synced_count"
t.integer "wikis_failed_count"
t.integer "job_artifacts_count"
t.integer "job_artifacts_synced_count"
t.integer "job_artifacts_failed_count"
t.string "version"
t.string "revision"
t.integer "repositories_verified_count"
t.integer "repositories_verification_failed_count"
t.integer "wikis_verified_count"
t.integer "wikis_verification_failed_count"
t.integer "lfs_objects_synced_missing_on_primary_count"
t.integer "job_artifacts_synced_missing_on_primary_count"
t.integer "attachments_synced_missing_on_primary_count"
t.integer "repositories_checksummed_count"
t.integer "repositories_checksum_failed_count"
t.integer "repositories_checksum_mismatch_count"
t.integer "wikis_checksummed_count"
t.integer "wikis_checksum_failed_count"
t.integer "wikis_checksum_mismatch_count"
t.binary "storage_configuration_digest"
t.integer "repositories_retrying_verification_count"
t.integer "wikis_retrying_verification_count"
t.integer "projects_count"
t.index ["geo_node_id"], name: "index_geo_node_statuses_on_geo_node_id", unique: true, using: :btree
end
create_table_if_not_exists "geo_nodes" do |t|
t.boolean "primary"
t.integer "oauth_application_id"
t.boolean "enabled", default: true, null: false
t.string "access_key"
t.string "encrypted_secret_access_key"
t.string "encrypted_secret_access_key_iv"
t.string "clone_url_prefix"
t.integer "files_max_capacity", default: 10, null: false
t.integer "repos_max_capacity", default: 25, null: false
t.string "url", null: false
t.string "selective_sync_type"
t.text "selective_sync_shards"
t.integer "verification_max_capacity", default: 100, null: false
t.integer "minimum_reverification_interval", default: 7, null: false
t.string "alternate_url"
t.index ["access_key"], name: "index_geo_nodes_on_access_key", using: :btree
t.index ["primary"], name: "index_geo_nodes_on_primary", using: :btree
t.index ["url"], name: "index_geo_nodes_on_url", unique: true, using: :btree
end
create_table_if_not_exists "geo_repositories_changed_events", id: :bigserial do |t|
t.integer "geo_node_id", null: false
t.index ["geo_node_id"], name: "index_geo_repositories_changed_events_on_geo_node_id", using: :btree
end
create_table_if_not_exists "geo_repository_created_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "repo_path", null: false
t.text "wiki_path"
t.text "project_name", null: false
t.index ["project_id"], name: "index_geo_repository_created_events_on_project_id", using: :btree
end
create_table_if_not_exists "geo_repository_deleted_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "deleted_path", null: false
t.text "deleted_wiki_path"
t.text "deleted_project_name", null: false
t.index ["project_id"], name: "index_geo_repository_deleted_events_on_project_id", using: :btree
end
create_table_if_not_exists "geo_repository_renamed_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "old_path_with_namespace", null: false
t.text "new_path_with_namespace", null: false
t.text "old_wiki_path_with_namespace", null: false
t.text "new_wiki_path_with_namespace", null: false
t.text "old_path", null: false
t.text "new_path", null: false
t.index ["project_id"], name: "index_geo_repository_renamed_events_on_project_id", using: :btree
end
create_table_if_not_exists "geo_repository_updated_events", id: :bigserial do |t|
t.integer "branches_affected", null: false
t.integer "tags_affected", null: false
t.integer "project_id", null: false
t.integer "source", limit: 2, null: false
t.boolean "new_branch", default: false, null: false
t.boolean "remove_branch", default: false, null: false
t.text "ref"
t.index ["project_id"], name: "index_geo_repository_updated_events_on_project_id", using: :btree
t.index ["source"], name: "index_geo_repository_updated_events_on_source", using: :btree
end
create_table_if_not_exists "geo_reset_checksum_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.index ["project_id"], name: "index_geo_reset_checksum_events_on_project_id", using: :btree
end
create_table_if_not_exists "geo_upload_deleted_events", id: :bigserial do |t|
t.integer "upload_id", null: false
t.string "file_path", null: false
t.integer "model_id", null: false
t.string "model_type", null: false
t.string "uploader", null: false
t.index ["upload_id"], name: "index_geo_upload_deleted_events_on_upload_id", using: :btree
end
create_table_if_not_exists "gitlab_subscriptions", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.date "start_date"
t.date "end_date"
t.date "trial_ends_on"
t.integer "namespace_id"
t.integer "hosted_plan_id"
t.integer "max_seats_used", default: 0
t.integer "seats", default: 0
t.boolean "trial", default: false
t.index ["hosted_plan_id"], name: "index_gitlab_subscriptions_on_hosted_plan_id", using: :btree
t.index ["namespace_id"], name: "index_gitlab_subscriptions_on_namespace_id", unique: true, using: :btree
end
create_table_if_not_exists "historical_data" do |t|
t.date "date", null: false
t.integer "active_user_count"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table_if_not_exists "index_statuses" do |t|
t.integer "project_id", null: false
t.datetime "indexed_at"
t.text "note"
t.string "last_commit"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_index_statuses_on_project_id", unique: true, using: :btree
end
create_table_if_not_exists "insights" do |t|
t.integer "namespace_id", null: false
t.integer "project_id", null: false
t.index ["namespace_id"], name: "index_insights_on_namespace_id", using: :btree
t.index ["project_id"], name: "index_insights_on_project_id", using: :btree
end
create_table_if_not_exists "issue_links" do |t|
t.integer "source_id", null: false
t.integer "target_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index %w[source_id target_id], name: "index_issue_links_on_source_id_and_target_id", unique: true, using: :btree
t.index ["source_id"], name: "index_issue_links_on_source_id", using: :btree
t.index ["target_id"], name: "index_issue_links_on_target_id", using: :btree
end
create_table_if_not_exists "jira_connect_installations", id: :bigserial do |t|
t.string "client_key"
t.string "encrypted_shared_secret"
t.string "encrypted_shared_secret_iv"
t.string "base_url"
t.index ["client_key"], name: "index_jira_connect_installations_on_client_key", unique: true, using: :btree
end
create_table_if_not_exists "jira_connect_subscriptions", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.bigint "jira_connect_installation_id", null: false
t.integer "namespace_id", null: false
t.datetime_with_timezone "updated_at", null: false
t.index %w[jira_connect_installation_id namespace_id], name: "idx_jira_connect_subscriptions_on_installation_id_namespace_id", unique: true, using: :btree
t.index ["jira_connect_installation_id"], name: "idx_jira_connect_subscriptions_on_installation_id", using: :btree
t.index ["namespace_id"], name: "index_jira_connect_subscriptions_on_namespace_id", using: :btree
end
create_table_if_not_exists "ldap_group_links" do |t|
t.string "cn"
t.integer "group_access", null: false
t.integer "group_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "provider"
t.string "filter"
end
create_table_if_not_exists "licenses" do |t|
t.text "data", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table_if_not_exists "namespace_statistics" do |t|
t.integer "namespace_id", null: false
t.integer "shared_runners_seconds", default: 0, null: false
t.datetime "shared_runners_seconds_last_reset"
t.index ["namespace_id"], name: "index_namespace_statistics_on_namespace_id", unique: true, using: :btree
end
create_table_if_not_exists "operations_feature_flag_scopes", id: :bigserial do |t|
t.bigint "feature_flag_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.boolean "active", null: false
t.string "environment_scope", default: "*", null: false
t.index %w[feature_flag_id environment_scope], name: "index_feature_flag_scopes_on_flag_id_and_environment_scope", unique: true, using: :btree
end
create_table_if_not_exists "operations_feature_flags", id: :bigserial do |t|
t.integer "project_id", null: false
t.boolean "active", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.string "name", null: false
t.text "description"
t.index %w[project_id name], name: "index_operations_feature_flags_on_project_id_and_name", unique: true, using: :btree
end
create_table_if_not_exists "operations_feature_flags_clients", id: :bigserial do |t|
t.integer "project_id", null: false
t.string "token", null: false
t.index %w[project_id token], name: "index_operations_feature_flags_clients_on_project_id_and_token", unique: true, using: :btree
end
create_table_if_not_exists "packages_maven_metadata", id: :bigserial do |t|
t.bigint "package_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.string "app_group", null: false
t.string "app_name", null: false
t.string "app_version"
t.string "path", limit: 512, null: false
t.index %w[package_id path], name: "index_packages_maven_metadata_on_package_id_and_path", using: :btree
end
create_table_if_not_exists "packages_package_files", id: :bigserial do |t|
t.bigint "package_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.bigint "size"
t.integer "file_type"
t.integer "file_store"
t.binary "file_md5"
t.binary "file_sha1"
t.string "file_name", null: false
t.text "file", null: false
t.index %w[package_id file_name], name: "index_packages_package_files_on_package_id_and_file_name", using: :btree
end
create_table_if_not_exists "packages_packages", id: :bigserial do |t|
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.string "name", null: false
t.string "version"
t.integer "package_type", limit: 2, null: false
t.index ["project_id"], name: "index_packages_packages_on_project_id", using: :btree
end
create_table_if_not_exists "path_locks" do |t|
t.string "path", null: false
t.integer "project_id"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["path"], name: "index_path_locks_on_path", using: :btree
t.index ["project_id"], name: "index_path_locks_on_project_id", using: :btree
t.index ["user_id"], name: "index_path_locks_on_user_id", using: :btree
end
create_table_if_not_exists "plans" do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
t.string "title"
t.integer "active_pipelines_limit"
t.integer "pipeline_size_limit"
t.index ["name"], name: "index_plans_on_name", using: :btree
end
create_table_if_not_exists "project_alerting_settings", primary_key: "project_id", id: :integer do |t|
t.string "encrypted_token", null: false
t.string "encrypted_token_iv", null: false
end
create_table_if_not_exists "project_feature_usages", primary_key: "project_id", id: :integer do |t|
t.datetime "jira_dvcs_cloud_last_sync_at"
t.datetime "jira_dvcs_server_last_sync_at"
t.index %w[jira_dvcs_cloud_last_sync_at project_id], name: "idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id", where: "(jira_dvcs_cloud_last_sync_at IS NOT NULL)", using: :btree
t.index %w[jira_dvcs_server_last_sync_at project_id], name: "idx_proj_feat_usg_on_jira_dvcs_server_last_sync_at_and_proj_id", where: "(jira_dvcs_server_last_sync_at IS NOT NULL)", using: :btree
t.index ["project_id"], name: "index_project_feature_usages_on_project_id", using: :btree
end
create_table_if_not_exists "project_incident_management_settings", primary_key: "project_id", id: :integer do |t|
t.boolean "create_issue", default: false, null: false
t.boolean "send_email", default: true, null: false
t.text "issue_template_key"
end
create_table_if_not_exists "project_repository_states" do |t|
t.integer "project_id", null: false
t.binary "repository_verification_checksum"
t.binary "wiki_verification_checksum"
t.string "last_repository_verification_failure"
t.string "last_wiki_verification_failure"
t.datetime_with_timezone "repository_retry_at"
t.datetime_with_timezone "wiki_retry_at"
t.integer "repository_retry_count"
t.integer "wiki_retry_count"
t.datetime_with_timezone "last_repository_verification_ran_at"
t.datetime_with_timezone "last_wiki_verification_ran_at"
t.index ["last_repository_verification_failure"], name: "idx_repository_states_on_repository_failure_partial", where: "(last_repository_verification_failure IS NOT NULL)", using: :btree
t.index ["last_wiki_verification_failure"], name: "idx_repository_states_on_wiki_failure_partial", where: "(last_wiki_verification_failure IS NOT NULL)", using: :btree
t.index %w[project_id last_repository_verification_ran_at], name: "idx_repository_states_on_last_repository_verification_ran_at", where: "((repository_verification_checksum IS NOT NULL) AND (last_repository_verification_failure IS NULL))", using: :btree
t.index %w[project_id last_wiki_verification_ran_at], name: "idx_repository_states_on_last_wiki_verification_ran_at", where: "((wiki_verification_checksum IS NOT NULL) AND (last_wiki_verification_failure IS NULL))", using: :btree
t.index ["project_id"], name: "idx_repository_states_outdated_checksums", where: "(((repository_verification_checksum IS NULL) AND (last_repository_verification_failure IS NULL)) OR ((wiki_verification_checksum IS NULL) AND (last_wiki_verification_failure IS NULL)))", using: :btree
t.index ["project_id"], name: "index_project_repository_states_on_project_id", unique: true, using: :btree
end
create_table_if_not_exists "project_tracing_settings", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
t.string "external_url", null: false
t.index ["project_id"], name: "index_project_tracing_settings_on_project_id", unique: true, using: :btree
end
create_table_if_not_exists "prometheus_alert_events", id: :bigserial do |t|
t.integer "project_id", null: false
t.integer "prometheus_alert_id", null: false
t.datetime_with_timezone "started_at", null: false
t.datetime_with_timezone "ended_at"
t.integer "status", limit: 2
t.string "payload_key"
t.index %w[project_id status], name: "index_prometheus_alert_events_on_project_id_and_status", using: :btree
t.index %w[prometheus_alert_id payload_key], name: "index_prometheus_alert_event_scoped_payload_key", unique: true, using: :btree
end
create_table_if_not_exists "prometheus_alerts" do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.float "threshold", null: false
t.integer "operator", null: false
t.integer "environment_id", null: false
t.integer "project_id", null: false
t.integer "prometheus_metric_id", null: false
t.index ["environment_id"], name: "index_prometheus_alerts_on_environment_id", using: :btree
t.index %w[project_id prometheus_metric_id environment_id], name: "index_prometheus_alerts_metric_environment", unique: true, using: :btree
t.index ["prometheus_metric_id"], name: "index_prometheus_alerts_on_prometheus_metric_id", using: :btree
end
create_table_if_not_exists "protected_branch_unprotect_access_levels" do |t|
t.integer "protected_branch_id", null: false
t.integer "access_level", default: 40
t.integer "user_id"
t.integer "group_id"
t.index ["group_id"], name: "index_protected_branch_unprotect_access_levels_on_group_id", using: :btree
t.index ["protected_branch_id"], name: "index_protected_branch_unprotect_access", using: :btree
t.index ["user_id"], name: "index_protected_branch_unprotect_access_levels_on_user_id", using: :btree
end
create_table_if_not_exists "protected_environment_deploy_access_levels" do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "access_level", default: 40
t.integer "protected_environment_id", null: false
t.integer "user_id"
t.integer "group_id"
t.index ["group_id"], name: "index_protected_environment_deploy_access_levels_on_group_id", using: :btree
t.index ["protected_environment_id"], name: "index_protected_environment_deploy_access", using: :btree
t.index ["user_id"], name: "index_protected_environment_deploy_access_levels_on_user_id", using: :btree
end
create_table_if_not_exists "protected_environments" do |t|
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.string "name", null: false
t.index %w[project_id name], name: "index_protected_environments_on_project_id_and_name", unique: true, using: :btree
t.index ["project_id"], name: "index_protected_environments_on_project_id", using: :btree
end
create_table_if_not_exists "push_rules" do |t|
t.string "force_push_regex"
t.string "delete_branch_regex"
t.string "commit_message_regex"
t.boolean "deny_delete_tag"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "author_email_regex"
t.boolean "member_check", default: false, null: false
t.string "file_name_regex"
t.boolean "is_sample", default: false
t.integer "max_file_size", default: 0, null: false
t.boolean "prevent_secrets", default: false, null: false
t.string "branch_name_regex"
t.boolean "reject_unsigned_commits"
t.boolean "commit_committer_check"
t.boolean "regexp_uses_re2", default: true
t.string "commit_message_negative_regex"
t.index ["is_sample"], name: "index_push_rules_on_is_sample", where: "is_sample", using: :btree
t.index ["project_id"], name: "index_push_rules_on_project_id", using: :btree
end
create_table_if_not_exists "reviews", id: :bigserial do |t|
t.integer "author_id"
t.integer "merge_request_id", null: false
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.index ["author_id"], name: "index_reviews_on_author_id", using: :btree
t.index ["merge_request_id"], name: "index_reviews_on_merge_request_id", using: :btree
t.index ["project_id"], name: "index_reviews_on_project_id", using: :btree
end
create_table_if_not_exists "saml_providers" do |t|
t.integer "group_id", null: false
t.boolean "enabled", null: false
t.string "certificate_fingerprint", null: false
t.string "sso_url", null: false
t.boolean "enforced_sso", default: false, null: false
t.boolean "enforced_group_managed_accounts", default: false, null: false
t.index ["group_id"], name: "index_saml_providers_on_group_id", using: :btree
end
create_table_if_not_exists "scim_oauth_access_tokens" do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "group_id", null: false
t.string "token_encrypted", null: false
t.index %w[group_id token_encrypted], name: "index_scim_oauth_access_tokens_on_group_id_and_token_encrypted", unique: true, using: :btree
end
create_table_if_not_exists "slack_integrations" do |t|
t.integer "service_id", null: false
t.string "team_id", null: false
t.string "team_name", null: false
t.string "alias", null: false
t.string "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["service_id"], name: "index_slack_integrations_on_service_id", using: :btree
t.index %w[team_id alias], name: "index_slack_integrations_on_team_id_and_alias", unique: true, using: :btree
end
create_table_if_not_exists "smartcard_identities", id: :bigserial do |t|
t.integer "user_id", null: false
t.string "subject", null: false
t.string "issuer", null: false
t.index %w[subject issuer], name: "index_smartcard_identities_on_subject_and_issuer", unique: true, using: :btree
t.index ["user_id"], name: "index_smartcard_identities_on_user_id", using: :btree
end
create_table_if_not_exists "software_license_policies" do |t|
t.integer "project_id", null: false
t.integer "software_license_id", null: false
t.integer "approval_status", default: 0, null: false
t.index %w[project_id software_license_id], name: "index_software_license_policies_unique_per_project", unique: true, using: :btree
t.index ["software_license_id"], name: "index_software_license_policies_on_software_license_id", using: :btree
end
create_table_if_not_exists "software_licenses" do |t|
t.string "name", null: false
t.index ["name"], name: "index_software_licenses_on_name", using: :btree
end
create_table_if_not_exists "users_ops_dashboard_projects", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "user_id", null: false
t.integer "project_id", null: false
t.index ["project_id"], name: "index_users_ops_dashboard_projects_on_project_id", using: :btree
t.index %w[user_id project_id], name: "index_users_ops_dashboard_projects_on_user_id_and_project_id", unique: true, using: :btree
end
create_table_if_not_exists "vulnerability_feedback" do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "feedback_type", limit: 2, null: false
t.integer "category", limit: 2, null: false
t.integer "project_id", null: false
t.integer "author_id", null: false
t.integer "pipeline_id"
t.integer "issue_id"
t.string "project_fingerprint", limit: 40, null: false
t.integer "merge_request_id"
t.index ["author_id"], name: "index_vulnerability_feedback_on_author_id", using: :btree
t.index ["issue_id"], name: "index_vulnerability_feedback_on_issue_id", using: :btree
t.index ["merge_request_id"], name: "index_vulnerability_feedback_on_merge_request_id", using: :btree
t.index ["pipeline_id"], name: "index_vulnerability_feedback_on_pipeline_id", using: :btree
t.index %w[project_id category feedback_type project_fingerprint], name: "vulnerability_feedback_unique_idx", unique: true, using: :btree
end
create_table_if_not_exists "vulnerability_identifiers", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
t.binary "fingerprint", null: false
t.string "external_type", null: false
t.string "external_id", null: false
t.string "name", null: false
t.text "url"
t.index %w[project_id fingerprint], name: "index_vulnerability_identifiers_on_project_id_and_fingerprint", unique: true, using: :btree
end
create_table_if_not_exists "vulnerability_occurrence_identifiers", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.bigint "occurrence_id", null: false
t.bigint "identifier_id", null: false
t.index ["identifier_id"], name: "index_vulnerability_occurrence_identifiers_on_identifier_id", using: :btree
t.index %w[occurrence_id identifier_id], name: "index_vulnerability_occurrence_identifiers_on_unique_keys", unique: true, using: :btree
end
create_table_if_not_exists "vulnerability_occurrence_pipelines", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.bigint "occurrence_id", null: false
t.integer "pipeline_id", null: false
t.index %w[occurrence_id pipeline_id], name: "vulnerability_occurrence_pipelines_on_unique_keys", unique: true, using: :btree
t.index ["pipeline_id"], name: "index_vulnerability_occurrence_pipelines_on_pipeline_id", using: :btree
end
create_table_if_not_exists "vulnerability_occurrences", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "severity", limit: 2, null: false
t.integer "confidence", limit: 2, null: false
t.integer "report_type", limit: 2, null: false
t.integer "project_id", null: false
t.bigint "scanner_id", null: false
t.bigint "primary_identifier_id", null: false
t.binary "project_fingerprint", null: false
t.binary "location_fingerprint", null: false
t.string "uuid", limit: 36, null: false
t.string "name", null: false
t.string "metadata_version", null: false
t.text "raw_metadata", null: false
t.index ["primary_identifier_id"], name: "index_vulnerability_occurrences_on_primary_identifier_id", using: :btree
t.index %w[project_id primary_identifier_id location_fingerprint scanner_id], name: "index_vulnerability_occurrences_on_unique_keys", unique: true, using: :btree
t.index ["scanner_id"], name: "index_vulnerability_occurrences_on_scanner_id", using: :btree
t.index ["uuid"], name: "index_vulnerability_occurrences_on_uuid", unique: true, using: :btree
end
create_table_if_not_exists "vulnerability_scanners", id: :bigserial do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
t.string "external_id", null: false
t.string "name", null: false
t.index %w[project_id external_id], name: "index_vulnerability_scanners_on_project_id_and_external_id", unique: true, using: :btree
end
create_table_if_not_exists "dependency_proxy_blobs", id: :serial do |t|
t.datetime_with_timezone "created_at", null: false
t.text "file", null: false
t.string "file_name", null: false
t.integer "file_store"
t.integer "group_id", null: false
t.bigint "size"
t.datetime_with_timezone "updated_at", null: false
t.index %w[group_id file_name], name: "index_dependency_proxy_blobs_on_group_id_and_file_name", using: :btree
end
create_table_if_not_exists "dependency_proxy_group_settings", id: :serial do |t|
t.datetime_with_timezone "created_at", null: false
t.boolean "enabled", default: false, null: false
t.integer "group_id", null: false
t.datetime_with_timezone "updated_at", null: false
t.index ["group_id"], name: "index_dependency_proxy_group_settings_on_group_id", using: :btree
end
end