Commit 440836d2 authored by Patrick Derichs's avatar Patrick Derichs

Add migration to create resource milestone events table

parent 22cf6801
---
title: Add migration to create resource milestone events table
merge_request: 23965
author:
type: added
# frozen_string_literal: true
class AddResourceMilestoneEventsTable < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
create_table :resource_milestone_events, id: :bigserial do |t|
t.references :user, null: false, foreign_key: { on_delete: :nullify },
index: { name: 'index_resource_milestone_events_on_user_id' }
t.references :issue, null: true, foreign_key: { on_delete: :cascade },
index: { name: 'index_resource_milestone_events_on_issue_id' }
t.references :merge_request, null: true, foreign_key: { on_delete: :cascade },
index: { name: 'index_resource_milestone_events_on_merge_request_id' }
t.references :milestone, foreign_key: { on_delete: :cascade },
index: { name: 'index_resource_milestone_events_on_milestone_id' }
t.integer :action, limit: 2, null: false
t.integer :state, limit: 2, null: false
t.integer :cached_markdown_version
t.text :reference
t.text :reference_html
t.datetime_with_timezone :created_at, null: false
end
end
end
...@@ -3669,6 +3669,23 @@ ActiveRecord::Schema.define(version: 2020_01_30_161817) do ...@@ -3669,6 +3669,23 @@ ActiveRecord::Schema.define(version: 2020_01_30_161817) do
t.index ["user_id"], name: "index_resource_label_events_on_user_id" t.index ["user_id"], name: "index_resource_label_events_on_user_id"
end end
create_table "resource_milestone_events", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "issue_id"
t.bigint "merge_request_id"
t.bigint "milestone_id"
t.integer "action", limit: 2, null: false
t.integer "state", limit: 2, null: false
t.integer "cached_markdown_version"
t.text "reference"
t.text "reference_html"
t.datetime_with_timezone "created_at", null: false
t.index ["issue_id"], name: "index_resource_milestone_events_on_issue_id"
t.index ["merge_request_id"], name: "index_resource_milestone_events_on_merge_request_id"
t.index ["milestone_id"], name: "index_resource_milestone_events_on_milestone_id"
t.index ["user_id"], name: "index_resource_milestone_events_on_user_id"
end
create_table "resource_weight_events", force: :cascade do |t| create_table "resource_weight_events", force: :cascade do |t|
t.bigint "user_id", null: false t.bigint "user_id", null: false
t.bigint "issue_id", null: false t.bigint "issue_id", null: false
...@@ -4830,6 +4847,10 @@ ActiveRecord::Schema.define(version: 2020_01_30_161817) do ...@@ -4830,6 +4847,10 @@ ActiveRecord::Schema.define(version: 2020_01_30_161817) do
add_foreign_key "resource_label_events", "labels", on_delete: :nullify add_foreign_key "resource_label_events", "labels", on_delete: :nullify
add_foreign_key "resource_label_events", "merge_requests", on_delete: :cascade add_foreign_key "resource_label_events", "merge_requests", on_delete: :cascade
add_foreign_key "resource_label_events", "users", on_delete: :nullify add_foreign_key "resource_label_events", "users", on_delete: :nullify
add_foreign_key "resource_milestone_events", "issues", on_delete: :cascade
add_foreign_key "resource_milestone_events", "merge_requests", on_delete: :cascade
add_foreign_key "resource_milestone_events", "milestones", on_delete: :cascade
add_foreign_key "resource_milestone_events", "users", on_delete: :nullify
add_foreign_key "resource_weight_events", "issues", on_delete: :cascade add_foreign_key "resource_weight_events", "issues", on_delete: :cascade
add_foreign_key "resource_weight_events", "users", on_delete: :nullify add_foreign_key "resource_weight_events", "users", on_delete: :nullify
add_foreign_key "reviews", "merge_requests", on_delete: :cascade add_foreign_key "reviews", "merge_requests", 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