diff options
Diffstat (limited to 'db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb')
-rw-r--r-- | db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb b/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb new file mode 100644 index 00000000000..62bb3f46cae --- /dev/null +++ b/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb @@ -0,0 +1,30 @@ +# 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 RemoveStorageVersionColumnFromSnippets < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + return unless column_exists?(:snippets, :storage_version) + + remove_column :snippets, :storage_version + end + + def down + return if column_exists?(:snippets, :storage_version) + + add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault + :snippets, + :storage_version, + :integer, + default: 2, + allow_null: false + ) + end +end |