Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
6b2954ec
Commit
6b2954ec
authored
Apr 05, 2018
by
Kamil Trzciński
Committed by
Mayra Cabrera
Apr 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and optimise DB schema
parent
8315861c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
21 deletions
+19
-21
db/migrate/20180319190020_create_deploy_tokens.rb
db/migrate/20180319190020_create_deploy_tokens.rb
+6
-5
db/migrate/20180405142733_create_project_deploy_tokens.rb
db/migrate/20180405142733_create_project_deploy_tokens.rb
+5
-10
db/schema.rb
db/schema.rb
+8
-6
No files found.
db/migrate/20180319190020_create_deploy_tokens.rb
View file @
6b2954ec
...
@@ -3,14 +3,15 @@ class CreateDeployTokens < ActiveRecord::Migration
...
@@ -3,14 +3,15 @@ class CreateDeployTokens < ActiveRecord::Migration
def
change
def
change
create_table
:deploy_tokens
do
|
t
|
create_table
:deploy_tokens
do
|
t
|
t
.
string
:name
,
null:
false
t
.
string
:token
,
index:
{
unique:
true
},
null:
false
t
.
boolean
:read_repository
,
default:
false
t
.
boolean
:read_registry
,
default:
false
t
.
boolean
:revoked
,
default:
false
t
.
boolean
:revoked
,
default:
false
t
.
datetime
:expires_at
t
.
boolean
:read_repository
,
null:
false
,
default:
false
t
.
boolean
:read_registry
,
null:
false
,
default:
false
t
.
datetime
:expires_at
t
.
timestamps
null:
false
t
.
timestamps
null:
false
t
.
string
:name
,
null:
false
t
.
string
:token
,
index:
{
unique:
true
},
null:
false
end
end
end
end
end
end
db/migrate/20180405142733_create_project_deploy_tokens.rb
View file @
6b2954ec
...
@@ -3,22 +3,17 @@ class CreateProjectDeployTokens < ActiveRecord::Migration
...
@@ -3,22 +3,17 @@ class CreateProjectDeployTokens < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
disable_ddl_transaction!
def
change
def
up
create_table
:project_deploy_tokens
do
|
t
|
create_table
:project_deploy_tokens
do
|
t
|
t
.
integer
:project_id
,
null:
false
t
.
integer
:project_id
,
null:
false
t
.
integer
:deploy_token_id
,
null:
false
t
.
integer
:deploy_token_id
,
null:
false
t
.
foreign_key
:deploy_tokens
,
column: :deploy_token_id
,
on_delete: :cascade
t
.
foreign_key
:projects
,
column: :project_id
,
on_delete: :cascade
t
.
timestamps
null:
false
t
.
timestamps
null:
false
end
end
add_concurrent_index
:project_deploy_tokens
,
[
:project_id
,
:deploy_token_id
]
add_index
:project_deploy_tokens
,
[
:project_id
,
:deploy_token_id
],
unique:
true
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
end
end
db/schema.rb
View file @
6b2954ec
...
@@ -684,14 +684,14 @@ ActiveRecord::Schema.define(version: 20180405142733) do
...
@@ -684,14 +684,14 @@ ActiveRecord::Schema.define(version: 20180405142733) do
add_index
"deploy_keys_projects"
,
[
"project_id"
],
name:
"index_deploy_keys_projects_on_project_id"
,
using: :btree
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
|
create_table
"deploy_tokens"
,
force: :cascade
do
|
t
|
t
.
string
"name"
,
null:
false
t
.
string
"token"
,
null:
false
t
.
boolean
"read_repository"
,
default:
false
t
.
boolean
"read_registry"
,
default:
false
t
.
boolean
"revoked"
,
default:
false
t
.
boolean
"revoked"
,
default:
false
t
.
boolean
"read_repository"
,
default:
false
,
null:
false
t
.
boolean
"read_registry"
,
default:
false
,
null:
false
t
.
datetime
"expires_at"
t
.
datetime
"expires_at"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
string
"name"
,
null:
false
t
.
string
"token"
,
null:
false
end
end
add_index
"deploy_tokens"
,
[
"token"
],
name:
"index_deploy_tokens_on_token"
,
unique:
true
,
using: :btree
add_index
"deploy_tokens"
,
[
"token"
],
name:
"index_deploy_tokens_on_token"
,
unique:
true
,
using: :btree
...
@@ -1450,7 +1450,7 @@ ActiveRecord::Schema.define(version: 20180405142733) do
...
@@ -1450,7 +1450,7 @@ ActiveRecord::Schema.define(version: 20180405142733) do
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
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
add_index
"project_deploy_tokens"
,
[
"project_id"
,
"deploy_token_id"
],
name:
"index_project_deploy_tokens_on_project_id_and_deploy_token_id"
,
u
nique:
true
,
u
sing: :btree
create_table
"project_features"
,
force: :cascade
do
|
t
|
create_table
"project_features"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
integer
"project_id"
...
@@ -1639,6 +1639,7 @@ ActiveRecord::Schema.define(version: 20180405142733) do
...
@@ -1639,6 +1639,7 @@ ActiveRecord::Schema.define(version: 20180405142733) do
t
.
string
"path"
,
null:
false
t
.
string
"path"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
boolean
"permanent"
end
end
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path"
,
unique:
true
,
using: :btree
add_index
"redirect_routes"
,
[
"path"
],
name:
"index_redirect_routes_on_path"
,
unique:
true
,
using: :btree
...
@@ -2094,7 +2095,6 @@ ActiveRecord::Schema.define(version: 20180405142733) do
...
@@ -2094,7 +2095,6 @@ ActiveRecord::Schema.define(version: 20180405142733) do
add_foreign_key
"clusters_applications_runners"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"clusters_applications_runners"
,
"clusters"
,
on_delete: :cascade
add_foreign_key
"container_repositories"
,
"projects"
add_foreign_key
"container_repositories"
,
"projects"
add_foreign_key
"deploy_keys_projects"
,
"projects"
,
name:
"fk_58a901ca7e"
,
on_delete: :cascade
add_foreign_key
"deploy_keys_projects"
,
"projects"
,
name:
"fk_58a901ca7e"
,
on_delete: :cascade
add_foreign_key
"deploy_tokens"
,
"projects"
add_foreign_key
"deployments"
,
"projects"
,
name:
"fk_b9a3851b82"
,
on_delete: :cascade
add_foreign_key
"deployments"
,
"projects"
,
name:
"fk_b9a3851b82"
,
on_delete: :cascade
add_foreign_key
"environments"
,
"projects"
,
name:
"fk_d1c8c1da6a"
,
on_delete: :cascade
add_foreign_key
"environments"
,
"projects"
,
name:
"fk_d1c8c1da6a"
,
on_delete: :cascade
add_foreign_key
"events"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"events"
,
"projects"
,
on_delete: :cascade
...
@@ -2160,6 +2160,8 @@ ActiveRecord::Schema.define(version: 20180405142733) do
...
@@ -2160,6 +2160,8 @@ ActiveRecord::Schema.define(version: 20180405142733) do
add_foreign_key
"project_authorizations"
,
"users"
,
on_delete: :cascade
add_foreign_key
"project_authorizations"
,
"users"
,
on_delete: :cascade
add_foreign_key
"project_auto_devops"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_auto_devops"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_custom_attributes"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_custom_attributes"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_deploy_tokens"
,
"deploy_tokens"
,
on_delete: :cascade
add_foreign_key
"project_deploy_tokens"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"project_features"
,
"projects"
,
name:
"fk_18513d9b92"
,
on_delete: :cascade
add_foreign_key
"project_features"
,
"projects"
,
name:
"fk_18513d9b92"
,
on_delete: :cascade
add_foreign_key
"project_group_links"
,
"projects"
,
name:
"fk_daa8cee94c"
,
on_delete: :cascade
add_foreign_key
"project_group_links"
,
"projects"
,
name:
"fk_daa8cee94c"
,
on_delete: :cascade
add_foreign_key
"project_import_data"
,
"projects"
,
name:
"fk_ffb9ee3a10"
,
on_delete: :cascade
add_foreign_key
"project_import_data"
,
"projects"
,
name:
"fk_ffb9ee3a10"
,
on_delete: :cascade
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment