diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/04_project.rb | 1 | ||||
-rw-r--r-- | db/fixtures/development/17_cycle_analytics.rb | 1 | ||||
-rw-r--r-- | db/fixtures/support/serialized_transaction.rb | 9 | ||||
-rw-r--r-- | db/migrate/20161010142410_create_project_authorizations.rb | 15 | ||||
-rw-r--r-- | db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 11 |
6 files changed, 46 insertions, 0 deletions
diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb index a984eda5ab5..18a2df7c059 100644 --- a/db/fixtures/development/04_project.rb +++ b/db/fixtures/development/04_project.rb @@ -1,4 +1,5 @@ require 'sidekiq/testing' +require './db/fixtures/support/serialized_transaction' Sidekiq::Testing.inline! do Gitlab::Seeder.quiet do diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index 916ee8dbac8..7b3908fae98 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -1,5 +1,6 @@ require 'sidekiq/testing' require './spec/support/test_env' +require './db/fixtures/support/serialized_transaction' class Gitlab::Seeder::CycleAnalytics def initialize(project, perf: false) diff --git a/db/fixtures/support/serialized_transaction.rb b/db/fixtures/support/serialized_transaction.rb new file mode 100644 index 00000000000..d3305b661e5 --- /dev/null +++ b/db/fixtures/support/serialized_transaction.rb @@ -0,0 +1,9 @@ +require 'gitlab/database' + +module Gitlab + module Database + def self.serialized_transaction + connection.transaction { yield } + end + end +end diff --git a/db/migrate/20161010142410_create_project_authorizations.rb b/db/migrate/20161010142410_create_project_authorizations.rb new file mode 100644 index 00000000000..e095ab969f8 --- /dev/null +++ b/db/migrate/20161010142410_create_project_authorizations.rb @@ -0,0 +1,15 @@ +class CreateProjectAuthorizations < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :project_authorizations do |t| + t.references :user, foreign_key: { on_delete: :cascade } + t.references :project, foreign_key: { on_delete: :cascade } + t.integer :access_level + + t.index [:user_id, :project_id, :access_level], unique: true, name: 'index_project_authorizations_on_user_id_project_id_access_level' + end + end +end diff --git a/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb b/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb new file mode 100644 index 00000000000..8f6be9dd677 --- /dev/null +++ b/db/migrate/20161017091941_add_authorized_projects_populated_to_users.rb @@ -0,0 +1,9 @@ +class AddAuthorizedProjectsPopulatedToUsers < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :users, :authorized_projects_populated, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 19bd6b63acb..db2ce689afc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -861,6 +861,14 @@ ActiveRecord::Schema.define(version: 20161117114805) do add_index "personal_access_tokens", ["token"], name: "index_personal_access_tokens_on_token", unique: true, using: :btree add_index "personal_access_tokens", ["user_id"], name: "index_personal_access_tokens_on_user_id", using: :btree + create_table "project_authorizations", force: :cascade do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "access_level" + end + + add_index "project_authorizations", ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree + create_table "project_features", force: :cascade do |t| t.integer "project_id" t.integer "merge_requests_access_level" @@ -1205,6 +1213,7 @@ ActiveRecord::Schema.define(version: 20161117114805) do t.boolean "external", default: false t.string "organization" t.string "incoming_email_token" + t.boolean "authorized_projects_populated" end add_index "users", ["admin"], name: "index_users_on_admin", using: :btree @@ -1267,6 +1276,8 @@ ActiveRecord::Schema.define(version: 20161117114805) do add_foreign_key "merge_requests_closing_issues", "issues", on_delete: :cascade add_foreign_key "merge_requests_closing_issues", "merge_requests", on_delete: :cascade add_foreign_key "personal_access_tokens", "users" + add_foreign_key "project_authorizations", "projects", on_delete: :cascade + add_foreign_key "project_authorizations", "users", on_delete: :cascade 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 |