diff options
author | Valery Sizov <valery@gitlab.com> | 2017-03-07 14:42:45 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-03-07 14:42:45 +0300 |
commit | a8cf2e8d54d05771242fcad39277b270053f15b4 (patch) | |
tree | f17dc745f292924b230f0c11f53ba678fcb533a9 /db | |
parent | a0108c6925239aab8164c28851d19f5d01eb8321 (diff) | |
parent | ac9d792946deb17a402646e5481087e4d92f88ad (diff) |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into orderable-issues
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/15_award_emoji.rb | 2 | ||||
-rw-r--r-- | db/migrate/20170120131253_create_chat_teams.rb | 18 | ||||
-rw-r--r-- | db/migrate/20170130221926_create_uploads.rb | 20 | ||||
-rw-r--r-- | db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb | 19 | ||||
-rw-r--r-- | db/schema.rb | 27 |
5 files changed, 84 insertions, 2 deletions
diff --git a/db/fixtures/development/15_award_emoji.rb b/db/fixtures/development/15_award_emoji.rb index ea343c26b69..137a036edaf 100644 --- a/db/fixtures/development/15_award_emoji.rb +++ b/db/fixtures/development/15_award_emoji.rb @@ -1,7 +1,7 @@ require './spec/support/sidekiq' Gitlab::Seeder.quiet do - emoji = Gitlab::AwardEmoji.emojis.keys + emoji = Gitlab::Emoji.emojis.keys Issue.order(Gitlab::Database.random).limit(Issue.count / 2).each do |issue| project = issue.project diff --git a/db/migrate/20170120131253_create_chat_teams.rb b/db/migrate/20170120131253_create_chat_teams.rb new file mode 100644 index 00000000000..7995d383986 --- /dev/null +++ b/db/migrate/20170120131253_create_chat_teams.rb @@ -0,0 +1,18 @@ +class CreateChatTeams < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = true + DOWNTIME_REASON = "Adding a foreign key" + + disable_ddl_transaction! + + def change + create_table :chat_teams do |t| + t.references :namespace, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } + t.string :team_id + t.string :name + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20170130221926_create_uploads.rb b/db/migrate/20170130221926_create_uploads.rb new file mode 100644 index 00000000000..6f06c5dd840 --- /dev/null +++ b/db/migrate/20170130221926_create_uploads.rb @@ -0,0 +1,20 @@ +class CreateUploads < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :uploads do |t| + t.integer :size, limit: 8, null: false + t.string :path, null: false + t.string :checksum, limit: 64 + t.references :model, polymorphic: true + t.string :uploader, null: false + t.datetime :created_at, null: false + end + + add_index :uploads, :path + add_index :uploads, :checksum + add_index :uploads, [:model_id, :model_type] + end +end diff --git a/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb b/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb new file mode 100644 index 00000000000..9020e0d054c --- /dev/null +++ b/db/post_migrate/20170306170512_migrate_legacy_manual_actions.rb @@ -0,0 +1,19 @@ +class MigrateLegacyManualActions < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + execute <<-EOS + UPDATE ci_builds SET status = 'manual', allow_failure = true + WHERE ci_builds.when = 'manual' AND ci_builds.status = 'skipped'; + EOS + end + + def down + execute <<-EOS + UPDATE ci_builds SET status = 'skipped', allow_failure = false + WHERE ci_builds.when = 'manual' AND ci_builds.status = 'manual'; + EOS + end +end diff --git a/db/schema.rb b/db/schema.rb index 3d2339fceea..efb9eaa8d00 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170305203726) do +ActiveRecord::Schema.define(version: 20170306170512) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -175,6 +175,16 @@ ActiveRecord::Schema.define(version: 20170305203726) do add_index "chat_names", ["service_id", "team_id", "chat_id"], name: "index_chat_names_on_service_id_and_team_id_and_chat_id", unique: true, using: :btree add_index "chat_names", ["user_id", "service_id"], name: "index_chat_names_on_user_id_and_service_id", unique: true, using: :btree + create_table "chat_teams", force: :cascade do |t| + t.integer "namespace_id", null: false + t.string "team_id" + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "chat_teams", ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true, using: :btree + create_table "ci_application_settings", force: :cascade do |t| t.boolean "all_broken_builds" t.boolean "add_pusher" @@ -1216,6 +1226,20 @@ ActiveRecord::Schema.define(version: 20170305203726) do add_index "u2f_registrations", ["key_handle"], name: "index_u2f_registrations_on_key_handle", using: :btree add_index "u2f_registrations", ["user_id"], name: "index_u2f_registrations_on_user_id", using: :btree + create_table "uploads", force: :cascade do |t| + t.integer "size", limit: 8, null: false + t.string "path", null: false + t.string "checksum", limit: 64 + t.integer "model_id" + t.string "model_type" + t.string "uploader", null: false + t.datetime "created_at", null: false + end + + add_index "uploads", ["checksum"], name: "index_uploads_on_checksum", using: :btree + add_index "uploads", ["model_id", "model_type"], name: "index_uploads_on_model_id_and_model_type", using: :btree + add_index "uploads", ["path"], name: "index_uploads_on_path", using: :btree + create_table "user_agent_details", force: :cascade do |t| t.string "user_agent", null: false t.string "ip_address", null: false @@ -1340,6 +1364,7 @@ ActiveRecord::Schema.define(version: 20170305203726) do add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree add_foreign_key "boards", "projects" + add_foreign_key "chat_teams", "namespaces", on_delete: :cascade add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade add_foreign_key "label_priorities", "labels", on_delete: :cascade |