diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-05 20:22:34 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-07 05:20:16 +0300 |
commit | 8315861c9a50675b4f4f4ca536f0da90f27994f3 (patch) | |
tree | b5f25e5dbd74621ef77d480ba69f4f21d5c00d7d /db | |
parent | 72220a99d1cdbcf8a914f9e765c43e63eaee2548 (diff) |
Include ProjectDeployTokens
Also:
- Changes scopes from serializer to use boolean columns
- Fixes broken specs
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180319190020_create_deploy_tokens.rb | 4 | ||||
-rw-r--r-- | db/migrate/20180405142733_create_project_deploy_tokens.rb | 24 | ||||
-rw-r--r-- | db/schema.rb | 16 |
3 files changed, 38 insertions, 6 deletions
diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb index 53808300fc1..dfe85b3b552 100644 --- a/db/migrate/20180319190020_create_deploy_tokens.rb +++ b/db/migrate/20180319190020_create_deploy_tokens.rb @@ -3,10 +3,10 @@ class CreateDeployTokens < ActiveRecord::Migration def change create_table :deploy_tokens do |t| - t.references :project, index: true, foreign_key: true, null: false t.string :name, null: false t.string :token, index: { unique: true }, null: false - t.string :scopes + t.boolean :read_repository, default: false + t.boolean :read_registry, default: false t.boolean :revoked, default: false t.datetime :expires_at diff --git a/db/migrate/20180405142733_create_project_deploy_tokens.rb b/db/migrate/20180405142733_create_project_deploy_tokens.rb new file mode 100644 index 00000000000..c12f468828b --- /dev/null +++ b/db/migrate/20180405142733_create_project_deploy_tokens.rb @@ -0,0 +1,24 @@ +class CreateProjectDeployTokens < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :project_deploy_tokens do |t| + t.integer :project_id, null: false + t.integer :deploy_token_id, null: false + + t.timestamps null: false + end + + add_concurrent_index :project_deploy_tokens, [:project_id, :deploy_token_id] + end + + def down + drop_table :project_deploy_tokens + + remove_index :project_deploy_tokens, column: [:project_id, :deploy_token_id] if index_exists?(:project_deploy_tokens, [:project_id, :deploy_token_id]) + end +end diff --git a/db/schema.rb b/db/schema.rb index 333baa245b7..6f1f3ba3e89 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: 20180405101928) do +ActiveRecord::Schema.define(version: 20180405142733) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -684,17 +684,16 @@ ActiveRecord::Schema.define(version: 20180405101928) do add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree create_table "deploy_tokens", force: :cascade do |t| - t.integer "project_id", null: false t.string "name", null: false t.string "token", null: false - t.string "scopes" + t.boolean "read_repository", default: false + t.boolean "read_registry", default: false t.boolean "revoked", default: false t.datetime "expires_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - add_index "deploy_tokens", ["project_id"], name: "index_deploy_tokens_on_project_id", using: :btree add_index "deploy_tokens", ["token"], name: "index_deploy_tokens_on_token", unique: true, using: :btree create_table "deployments", force: :cascade do |t| @@ -1444,6 +1443,15 @@ ActiveRecord::Schema.define(version: 20180405101928) do add_index "project_custom_attributes", ["key", "value"], name: "index_project_custom_attributes_on_key_and_value", using: :btree add_index "project_custom_attributes", ["project_id", "key"], name: "index_project_custom_attributes_on_project_id_and_key", unique: true, using: :btree + create_table "project_deploy_tokens", force: :cascade do |t| + t.integer "project_id", null: false + t.integer "deploy_token_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "project_deploy_tokens", ["project_id", "deploy_token_id"], name: "index_project_deploy_tokens_on_project_id_and_deploy_token_id", using: :btree + create_table "project_features", force: :cascade do |t| t.integer "project_id" t.integer "merge_requests_access_level" |