summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2017-09-21 10:34:12 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-12-03 12:04:48 +0100
commit61864a5a5bb523953589c9398a431c4369fbfc76 (patch)
tree5eac32ef8155e9066d7d1488d7856e83605aa6a5 /db
parent25df666156279e5b392b429519b4f4ba01eefaac (diff)
downloadgitlab-ce-61864a5a5bb523953589c9398a431c4369fbfc76.tar.gz
Rename Artifact to JobArtifact, split metadata out
Two things at ones, as there was no clean way to seperate the commit and give me feedback from the tests. But the model Artifact is now JobArtifact, and the table does not have a type anymore, but the metadata is now its own model: Ci::JobArtifactMetadata.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170918072948_create_artifacts.rb21
-rw-r--r--db/migrate/20170918072948_create_job_artifacts.rb19
-rw-r--r--db/schema.rb31
3 files changed, 35 insertions, 36 deletions
diff --git a/db/migrate/20170918072948_create_artifacts.rb b/db/migrate/20170918072948_create_artifacts.rb
deleted file mode 100644
index 1dd5edc3f15..00000000000
--- a/db/migrate/20170918072948_create_artifacts.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class CreateArtifacts < ActiveRecord::Migration
- 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 :type, default: 0, null: false
- t.integer :size, limit: 8, default: 0
-
- t.datetime_with_timezone :created_at, null: false
- t.datetime_with_timezone :updated_at, null: false
-
- t.text :file
- end
-
- add_index(:ci_artifacts, [:project_id, :ci_build_id], unique: true)
- end
-
- def down
- drop_table(:ci_artifacts)
- end
-end
diff --git a/db/migrate/20170918072948_create_job_artifacts.rb b/db/migrate/20170918072948_create_job_artifacts.rb
new file mode 100644
index 00000000000..6d1756f368c
--- /dev/null
+++ b/db/migrate/20170918072948_create_job_artifacts.rb
@@ -0,0 +1,19 @@
+class CreateJobArtifacts < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :ci_job_artifacts do |t|
+ t.belongs_to :project, null: false, index: true, foreign_key: { on_delete: :cascade }
+ t.integer :ci_job_id, null: false, index: true
+ t.integer :size, limit: 8
+ t.integer :file_type, null: false, index: true
+
+ t.datetime_with_timezone :created_at, null: false
+ t.datetime_with_timezone :updated_at, null: false
+
+ t.string :file
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b4048371676..46a3b147198 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -226,18 +226,6 @@ 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 "type", default: 0, null: false
- t.integer "size", limit: 8, default: 0
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- 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
@@ -331,6 +319,20 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_index "ci_group_variables", ["group_id", "key"], name: "index_ci_group_variables_on_group_id_and_key", unique: true, using: :btree
+ create_table "ci_job_artifacts", force: :cascade do |t|
+ t.integer "project_id", null: false
+ t.integer "ci_job_id", null: false
+ t.integer "size", limit: 8
+ t.integer "file_type", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "file"
+ end
+
+ add_index "ci_job_artifacts", ["ci_job_id"], name: "index_ci_job_artifacts_on_ci_job_id", using: :btree
+ add_index "ci_job_artifacts", ["file_type"], name: "index_ci_job_artifacts_on_file_type", using: :btree
+ add_index "ci_job_artifacts", ["project_id"], name: "index_ci_job_artifacts_on_project_id", using: :btree
+
create_table "ci_pipeline_schedule_variables", force: :cascade do |t|
t.string "key", null: false
t.text "value"
@@ -391,9 +393,9 @@ ActiveRecord::Schema.define(version: 20171124150326) do
t.integer "auto_canceled_by_id"
t.integer "pipeline_schedule_id"
t.integer "source"
- t.integer "config_source"
t.boolean "protected"
t.integer "failure_reason"
+ t.integer "config_source"
end
add_index "ci_pipelines", ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree
@@ -1913,8 +1915,6 @@ 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
@@ -1923,6 +1923,7 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_foreign_key "ci_builds", "ci_stages", column: "stage_id", name: "fk_3a9eaa254d", on_delete: :cascade
add_foreign_key "ci_builds", "projects", name: "fk_befce0568a", on_delete: :cascade
add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade
+ add_foreign_key "ci_job_artifacts", "projects", on_delete: :cascade
add_foreign_key "ci_pipeline_schedule_variables", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_41c35fda51", on_delete: :cascade
add_foreign_key "ci_pipeline_schedules", "projects", name: "fk_8ead60fcc4", on_delete: :cascade
add_foreign_key "ci_pipeline_schedules", "users", column: "owner_id", name: "fk_9ea99f58d2", on_delete: :nullify