Commit 540f4c81 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '13426-rename-design-management-version-user_id-to-author_id' into 'master'

Rename user_id to author_id for Versions

See merge request gitlab-org/gitlab!18506
parents 0b0409d4 fda7496f
# frozen_string_literal: true
class RenameDesignManagementVersionUserToAuthor < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
rename_column_concurrently :design_management_versions, :user_id, :author_id
end
def down
undo_rename_column_concurrently :design_management_versions, :user_id, :author_id
end
end
# frozen_string_literal: true
class AddAuthorIndexToDesignManagementVersions < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :design_management_versions, :author_id, where: 'author_id IS NOT NULL'
end
def down
remove_concurrent_index :design_management_versions, :author_id
end
end
# frozen_string_literal: true
class CleanupDesignManagementVersionUserToAuthorRename < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
cleanup_concurrent_column_rename :design_management_versions, :user_id, :author_id
end
def down
undo_cleanup_concurrent_column_rename :design_management_versions, :user_id, :author_id
end
end
...@@ -1301,11 +1301,11 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do ...@@ -1301,11 +1301,11 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do
create_table "design_management_versions", force: :cascade do |t| create_table "design_management_versions", force: :cascade do |t|
t.binary "sha", null: false t.binary "sha", null: false
t.bigint "issue_id" t.bigint "issue_id"
t.integer "user_id"
t.datetime_with_timezone "created_at" t.datetime_with_timezone "created_at"
t.integer "author_id"
t.index ["author_id"], name: "index_design_management_versions_on_author_id", where: "(author_id IS NOT NULL)"
t.index ["issue_id"], name: "index_design_management_versions_on_issue_id" t.index ["issue_id"], name: "index_design_management_versions_on_issue_id"
t.index ["sha", "issue_id"], name: "index_design_management_versions_on_sha_and_issue_id", unique: true t.index ["sha", "issue_id"], name: "index_design_management_versions_on_sha_and_issue_id", unique: true
t.index ["user_id"], name: "index_design_management_versions_on_user_id", where: "(user_id IS NOT NULL)"
end end
create_table "draft_notes", force: :cascade do |t| create_table "draft_notes", force: :cascade do |t|
...@@ -4135,7 +4135,7 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do ...@@ -4135,7 +4135,7 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do
add_foreign_key "design_management_designs_versions", "design_management_designs", column: "design_id", name: "fk_03c671965c", on_delete: :cascade add_foreign_key "design_management_designs_versions", "design_management_designs", column: "design_id", name: "fk_03c671965c", on_delete: :cascade
add_foreign_key "design_management_designs_versions", "design_management_versions", column: "version_id", name: "fk_f4d25ba00c", on_delete: :cascade add_foreign_key "design_management_designs_versions", "design_management_versions", column: "version_id", name: "fk_f4d25ba00c", on_delete: :cascade
add_foreign_key "design_management_versions", "issues", on_delete: :cascade add_foreign_key "design_management_versions", "issues", on_delete: :cascade
add_foreign_key "design_management_versions", "users", name: "fk_ee16b939e5", on_delete: :nullify add_foreign_key "design_management_versions", "users", column: "author_id", name: "fk_c1440b4896", on_delete: :nullify
add_foreign_key "draft_notes", "merge_requests", on_delete: :cascade add_foreign_key "draft_notes", "merge_requests", on_delete: :cascade
add_foreign_key "draft_notes", "users", column: "author_id", on_delete: :cascade add_foreign_key "draft_notes", "users", column: "author_id", on_delete: :cascade
add_foreign_key "elasticsearch_indexed_namespaces", "namespaces", on_delete: :cascade add_foreign_key "elasticsearch_indexed_namespaces", "namespaces", on_delete: :cascade
......
---
title: Rename user_id to author_id in design_management_versions table
merge_request: 18506
author:
type: other
...@@ -752,4 +752,4 @@ DesignManagement::Version: ...@@ -752,4 +752,4 @@ DesignManagement::Version:
- created_at - created_at
- sha - sha
- issue_id - issue_id
- user_id - author_id
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