Commit 470e298a authored by Toon Claes's avatar Toon Claes

Merge branch 'feature-flag-strategy-scope-tables' into 'master'

Create Operations Strategies and Scopes Tables

See merge request gitlab-org/gitlab!24819
parents d8a00988 98436d99
---
title: Create operations strategies and scopes tables
merge_request: 24819
author:
type: added
# frozen_string_literal: true
class CreateOperationsStrategiesTable < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
create_table :operations_strategies do |t|
t.references :feature_flag, index: true, null: false, foreign_key: { to_table: :operations_feature_flags, on_delete: :cascade }
t.string :name, null: false, limit: 255
t.jsonb :parameters, null: false, default: {}
end
end
end
# frozen_string_literal: true
class CreateOperationsScopesTable < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
create_table :operations_scopes do |t|
t.references :strategy, null: false, index: false, foreign_key: { to_table: :operations_strategies, on_delete: :cascade }
t.string :environment_scope, null: false, limit: 255
end
add_index :operations_scopes, [:strategy_id, :environment_scope], unique: true
end
end
......@@ -2934,6 +2934,19 @@ ActiveRecord::Schema.define(version: 2020_02_12_052620) do
t.index ["project_id", "token_encrypted"], name: "index_feature_flags_clients_on_project_id_and_token_encrypted", unique: true
end
create_table "operations_scopes", force: :cascade do |t|
t.bigint "strategy_id", null: false
t.string "environment_scope", limit: 255, null: false
t.index ["strategy_id", "environment_scope"], name: "index_operations_scopes_on_strategy_id_and_environment_scope", unique: true
end
create_table "operations_strategies", force: :cascade do |t|
t.bigint "feature_flag_id", null: false
t.string "name", limit: 255, null: false
t.jsonb "parameters", default: {}, null: false
t.index ["feature_flag_id"], name: "index_operations_strategies_on_feature_flag_id"
end
create_table "packages_build_infos", force: :cascade do |t|
t.integer "package_id", null: false
t.integer "pipeline_id"
......@@ -4867,6 +4880,8 @@ ActiveRecord::Schema.define(version: 2020_02_12_052620) do
add_foreign_key "operations_feature_flag_scopes", "operations_feature_flags", column: "feature_flag_id", on_delete: :cascade
add_foreign_key "operations_feature_flags", "projects", on_delete: :cascade
add_foreign_key "operations_feature_flags_clients", "projects", on_delete: :cascade
add_foreign_key "operations_scopes", "operations_strategies", column: "strategy_id", on_delete: :cascade
add_foreign_key "operations_strategies", "operations_feature_flags", column: "feature_flag_id", on_delete: :cascade
add_foreign_key "packages_build_infos", "ci_pipelines", column: "pipeline_id", on_delete: :nullify
add_foreign_key "packages_build_infos", "packages_packages", column: "package_id", on_delete: :cascade
add_foreign_key "packages_conan_file_metadata", "packages_package_files", column: "package_file_id", on_delete: :cascade
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment