diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170616133147_create_merge_request_diff_commits.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/db/migrate/20170616133147_create_merge_request_diff_commits.rb b/db/migrate/20170616133147_create_merge_request_diff_commits.rb new file mode 100644 index 00000000000..616464cb470 --- /dev/null +++ b/db/migrate/20170616133147_create_merge_request_diff_commits.rb @@ -0,0 +1,20 @@ +class CreateMergeRequestDiffCommits < ActiveRecord::Migration + DOWNTIME = false + + def change + create_table :merge_request_diff_commits, id: false do |t| + t.datetime_with_timezone :authored_date + t.datetime_with_timezone :committed_date + t.belongs_to :merge_request_diff, null: false, foreign_key: { on_delete: :cascade } + t.integer :relative_order, null: false + t.binary :sha, null: false, limit: 20 + t.text :author_name + t.text :author_email + t.text :committer_name + t.text :committer_email + t.text :message + + t.index [:merge_request_diff_id, :relative_order], name: 'index_merge_request_diff_commits_on_mr_diff_id_and_order', unique: true + end + end +end diff --git a/db/schema.rb b/db/schema.rb index f12fdf903c5..a47a6ae9a98 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -693,6 +693,21 @@ ActiveRecord::Schema.define(version: 20170703102400) do add_index "members", ["source_id", "source_type"], name: "index_members_on_source_id_and_source_type", using: :btree add_index "members", ["user_id"], name: "index_members_on_user_id", using: :btree + create_table "merge_request_diff_commits", id: false, force: :cascade do |t| + t.datetime "authored_date" + t.datetime "committed_date" + t.integer "merge_request_diff_id", null: false + t.integer "relative_order", null: false + t.binary "sha", null: false + t.text "author_name" + t.text "author_email" + t.text "committer_name" + t.text "committer_email" + t.text "message" + end + + add_index "merge_request_diff_commits", ["merge_request_diff_id", "relative_order"], name: "index_merge_request_diff_commits_on_mr_diff_id_and_order", unique: true, using: :btree + create_table "merge_request_diff_files", id: false, force: :cascade do |t| t.integer "merge_request_diff_id", null: false t.integer "relative_order", null: false @@ -1563,6 +1578,7 @@ ActiveRecord::Schema.define(version: 20170703102400) do add_foreign_key "labels", "projects", name: "fk_7de4989a69", on_delete: :cascade add_foreign_key "lists", "boards", name: "fk_0d3f677137", on_delete: :cascade add_foreign_key "lists", "labels", name: "fk_7a5553d60f", on_delete: :cascade + add_foreign_key "merge_request_diff_commits", "merge_request_diffs", on_delete: :cascade add_foreign_key "merge_request_diff_files", "merge_request_diffs", on_delete: :cascade add_foreign_key "merge_request_diffs", "merge_requests", name: "fk_8483f3258f", on_delete: :cascade add_foreign_key "merge_request_metrics", "ci_pipelines", column: "pipeline_id", on_delete: :cascade |