diff options
author | Gosia Ksionek <mksionek@gitlab.com> | 2019-04-05 21:49:46 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-04-05 21:49:46 +0300 |
commit | 64858317adc4f017fe589342155faba9df31f093 (patch) | |
tree | 79a7db7e36ca4c6cd5b2b9090030e4a397e94ab4 /db | |
parent | 8cdda8f79a1f747e2f8e393ca505d3142a958033 (diff) |
Add part of needed code
Add columns to store project creation settings
Add project creation level column in groups
and default project creation column in application settings
Remove obsolete line from schema
Update migration with project_creation_level column existence check
Rename migrations to avoid conflicts
Update migration methods
Update migration method
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190311132500_add_default_project_creation_application_setting.rb | 22 | ||||
-rw-r--r-- | db/migrate/20190311132527_add_project_creation_level_to_namespaces.rb | 22 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 46 insertions, 0 deletions
diff --git a/db/migrate/20190311132500_add_default_project_creation_application_setting.rb b/db/migrate/20190311132500_add_default_project_creation_application_setting.rb new file mode 100644 index 00000000000..87427ad2930 --- /dev/null +++ b/db/migrate/20190311132500_add_default_project_creation_application_setting.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddDefaultProjectCreationApplicationSetting < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + unless column_exists?(:application_settings, :default_project_creation) + add_column(:application_settings, :default_project_creation, :integer, default: 2, null: false) + end + end + + def down + if column_exists?(:application_settings, :default_project_creation) + remove_column(:application_settings, :default_project_creation) + end + end +end diff --git a/db/migrate/20190311132527_add_project_creation_level_to_namespaces.rb b/db/migrate/20190311132527_add_project_creation_level_to_namespaces.rb new file mode 100644 index 00000000000..159e0a95ace --- /dev/null +++ b/db/migrate/20190311132527_add_project_creation_level_to_namespaces.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddProjectCreationLevelToNamespaces < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + unless column_exists?(:namespaces, :project_creation_level) + add_column :namespaces, :project_creation_level, :integer + end + end + + def down + unless column_exists?(:namespaces, :project_creation_level) + remove_column :namespaces, :project_creation_level, :integer + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b20fe4b3d39..1a50c6efbc7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -177,6 +177,7 @@ ActiveRecord::Schema.define(version: 20190325165127) do t.string "runners_registration_token_encrypted" t.integer "local_markdown_version", default: 0, null: false t.integer "first_day_of_week", default: 0, null: false + t.integer "default_project_creation", default: 2, null: false t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree end @@ -1391,6 +1392,7 @@ ActiveRecord::Schema.define(version: 20190325165127) do t.integer "cached_markdown_version" t.string "runners_token" t.string "runners_token_encrypted" + t.integer "project_creation_level" t.boolean "auto_devops_enabled" t.index ["created_at"], name: "index_namespaces_on_created_at", using: :btree t.index ["name", "parent_id"], name: "index_namespaces_on_name_and_parent_id", unique: true, using: :btree |