Commit 3a23d865 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch '13426-add-user-and-timestamps-to-design-management-version' into 'master'

Add user_id and created_at to DesignManagement::Version

See merge request gitlab-org/gitlab!17316
parents 845274e1 ae8c400f
---
title: Add user_id and created_at columns to design_management_versions table
merge_request: 17316
author:
type: added
# frozen_string_literal: true
class AddUserAndTimestampsToDesignManagementVersions < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
add_column :design_management_versions, :user_id, :integer
add_column :design_management_versions, :created_at, :datetime_with_timezone
end
def down
remove_columns :design_management_versions, :user_id, :created_at
end
end
# frozen_string_literal: true
class AddUserIndexesToDesignManagementVersions < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_foreign_key :design_management_versions, :users, column: :user_id, on_delete: :nullify
add_concurrent_index :design_management_versions, :user_id, where: 'user_id IS NOT NULL'
end
def down
remove_concurrent_index :design_management_versions, :user_id
remove_foreign_key :design_management_versions, column: :user_id
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_09_19_162036) do
ActiveRecord::Schema.define(version: 2019_09_26_041216) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -1232,8 +1232,11 @@ ActiveRecord::Schema.define(version: 2019_09_19_162036) do
create_table "design_management_versions", force: :cascade do |t|
t.binary "sha", null: false
t.bigint "issue_id"
t.integer "user_id"
t.datetime_with_timezone "created_at"
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 ["user_id"], name: "index_design_management_versions_on_user_id", where: "(user_id IS NOT NULL)"
end
create_table "draft_notes", force: :cascade do |t|
......@@ -3930,6 +3933,7 @@ ActiveRecord::Schema.define(version: 2019_09_19_162036) 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_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", "users", name: "fk_ee16b939e5", on_delete: :nullify
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 "elasticsearch_indexed_namespaces", "namespaces", 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