summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 09:36:09 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-03 09:36:09 +0200
commitfc550b398be6cdc4584dad79411929305815ffaa (patch)
tree0995b6990fa3599dddfed5bd2720589731bcdf31 /db
parent83d1fe9b5aeb947c1387666205ecaca81f2bf3a2 (diff)
parente7e9307219d1c81427f95444b36471c519dc06c2 (diff)
downloadgitlab-ce-fc550b398be6cdc4584dad79411929305815ffaa.tar.gz
Merge branch 'master' into feature/multi-level-container-registry-images
* master: (230 commits) Fix N+1 query in loading pipelines in merge requests Fix Spinach and Capybara dependencies Prevent users from disconnecting gitlab account from CAS 30276 Move issue, mr, todos next to profile dropdown in top nav Refactor SearchController#show Properly eagerly-load the Capybara server for JS feature specs only Updating documentation to include a missing step in the update procedure Eager-load the Capybara server to prevent timeouts Increase Capybara's timeout Add metrics button to Environment Overview page Fix link to Jira service documentation Handle parsing OpenBSD ps output properly to display sidekiq infos on ... Eliminate unnecessary queries that add ~500 ms of load time for a large issue 20914 Limits line length for project home page Allow users to import GitHub projects to subgroups Update dpl CI example Fix the docs:check:links job Don't clean up the gitlab-test-fork_bare repo Make GitLab use Gitaly for commit_is_ancestor Remove unnecessary ORDER BY clause from `forked_to_project_id` subquery ...
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/production/001_admin.rb8
-rw-r--r--db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb2
-rw-r--r--db/migrate/20170314082049_create_system_note_metadata.rb23
-rw-r--r--db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb10
-rw-r--r--db/schema.rb10
5 files changed, 49 insertions, 4 deletions
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb
index b37dc794015..1c7c89f7bbd 100644
--- a/db/fixtures/production/001_admin.rb
+++ b/db/fixtures/production/001_admin.rb
@@ -12,10 +12,12 @@ else
user_args[:password] = ENV['GITLAB_ROOT_PASSWORD']
end
-user = User.new(user_args)
-user.skip_confirmation!
+# Only admins can create other admin users in Users::CreateService so to solve
+# the chicken-and-egg problem, we pass a non-persisted admin user to the service.
+transient_admin = User.new(admin: true)
+user = Users::CreateService.new(transient_admin, user_args.merge!(skip_confirmation: true)).execute
-if user.save
+if user.persisted?
puts "Administrator account created:".color(:green)
puts
puts "login: root".color(:green)
diff --git a/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb b/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb
index 1e2abea5254..69dd15b8b4e 100644
--- a/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb
+++ b/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb
@@ -17,7 +17,7 @@ class RemoveUnusedCiTablesAndColumns < ActiveRecord::Migration
end
remove_column :ci_pipelines, :push_data, :text
- remove_column :ci_builds, :job_id, :integer
+ remove_column :ci_builds, :job_id, :integer if column_exists?(:ci_builds, :job_id)
remove_column :ci_builds, :deploy, :boolean
end
diff --git a/db/migrate/20170314082049_create_system_note_metadata.rb b/db/migrate/20170314082049_create_system_note_metadata.rb
new file mode 100644
index 00000000000..dd1e6cf8172
--- /dev/null
+++ b/db/migrate/20170314082049_create_system_note_metadata.rb
@@ -0,0 +1,23 @@
+class CreateSystemNoteMetadata < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :system_note_metadata do |t|
+ t.references :note, null: false
+ t.integer :commit_count
+ t.string :action
+
+ t.timestamps null: false
+ end
+
+ add_concurrent_foreign_key :system_note_metadata, :notes, column: :note_id
+ end
+
+ def down
+ drop_table :system_note_metadata
+ end
+end
diff --git a/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb b/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb
new file mode 100644
index 00000000000..524eb2557ce
--- /dev/null
+++ b/db/migrate/20170316061730_readd_notified_of_own_activity_to_users.rb
@@ -0,0 +1,10 @@
+class ReaddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+
+ def change
+ add_column :users, :notified_of_own_activity, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8f32b62bf14..598ee70872b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1080,6 +1080,14 @@ ActiveRecord::Schema.define(version: 20170322013926) do
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id", "project_id"], name: "index_subscriptions_on_subscribable_and_user_id_and_project_id", unique: true, using: :btree
+ create_table "system_note_metadata", force: :cascade do |t|
+ t.integer "note_id", null: false
+ t.integer "commit_count"
+ t.string "action"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "taggings", force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
@@ -1241,6 +1249,7 @@ ActiveRecord::Schema.define(version: 20170322013926) do
t.string "organization"
t.boolean "authorized_projects_populated"
t.boolean "ghost"
+ t.boolean "notified_of_own_activity"
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
@@ -1312,6 +1321,7 @@ ActiveRecord::Schema.define(version: 20170322013926) do
add_foreign_key "protected_branch_merge_access_levels", "protected_branches"
add_foreign_key "protected_branch_push_access_levels", "protected_branches"
add_foreign_key "subscriptions", "projects", on_delete: :cascade
+ add_foreign_key "system_note_metadata", "notes", name: "fk_d83a918cb1", on_delete: :cascade
add_foreign_key "timelogs", "issues", name: "fk_timelogs_issues_issue_id", on_delete: :cascade
add_foreign_key "timelogs", "merge_requests", name: "fk_timelogs_merge_requests_merge_request_id", on_delete: :cascade
add_foreign_key "trending_projects", "projects", on_delete: :cascade