Create ci_artifacts table

This commit is contained in:
Zeger-Jan van de Weg 2017-09-18 15:33:24 +02:00 committed by Kamil Trzcinski
parent 636376dd4d
commit 8ac7f29726
2 changed files with 35 additions and 3 deletions

View file

@ -1,8 +1,24 @@
class CreateArtifacts < ActiveRecord::Migration
def change
create_table :artifacts do |t|
def up
create_table :ci_artifacts do |t|
t.belongs_to :project, null: false, foreign_key: { on_delete: :cascade }
t.belongs_to :ci_build, null: false, foreign_key: { on_delete: :cascade }
t.integer :size, limit: 8, default: 0
t.timestamps null: false
end
t.datetime_with_timezone :created_at, null: false
t.datetime_with_timezone :updated_at, null: false
t.datetime_with_timezone :expire_at
t.integer :erased_by_id, null: false
t.datetime_with_timezone :erased_at
t.text :file
end
add_index(:ci_artifacts, [:project_id, :ci_build_id], unique: true)
end
def down
drop_table(:ci_artifacts)
end
end

View file

@ -226,6 +226,20 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_index "chat_teams", ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true, using: :btree
create_table "ci_artifacts", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "ci_build_id", null: false
t.integer "size", limit: 8, default: 0
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "expire_at"
t.integer "erased_by_id", null: false
t.datetime "erased_at"
t.text "file"
end
add_index "ci_artifacts", ["project_id", "ci_build_id"], name: "index_ci_artifacts_on_project_id_and_ci_build_id", unique: true, using: :btree
create_table "ci_build_trace_section_names", force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
@ -1901,6 +1915,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_foreign_key "boards", "projects", name: "fk_f15266b5f9", on_delete: :cascade
add_foreign_key "chat_teams", "namespaces", on_delete: :cascade
add_foreign_key "ci_artifacts", "ci_builds", on_delete: :cascade
add_foreign_key "ci_artifacts", "projects", on_delete: :cascade
add_foreign_key "ci_build_trace_section_names", "projects", on_delete: :cascade
add_foreign_key "ci_build_trace_sections", "ci_build_trace_section_names", column: "section_name_id", name: "fk_264e112c66", on_delete: :cascade
add_foreign_key "ci_build_trace_sections", "ci_builds", column: "build_id", name: "fk_4ebe41f502", on_delete: :cascade