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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a7192e2e
Commit
a7192e2e
authored
Nov 14, 2018
by
Kamil Trzciński
Committed by
Andreas Brandl
Nov 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'revert-drop-gcp-clusters-table' into 'master'"
parent
7674a8f4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
32 deletions
+95
-32
changelogs/unreleased/drop-gcp-cluster-table.yml
changelogs/unreleased/drop-gcp-cluster-table.yml
+5
-0
db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
+37
-0
db/migrate/20181031190559_drop_gcp_clusters_table.rb
db/migrate/20181031190559_drop_gcp_clusters_table.rb
+53
-0
db/schema.rb
db/schema.rb
+0
-32
No files found.
changelogs/unreleased/drop-gcp-cluster-table.yml
0 → 100644
View file @
a7192e2e
---
title
:
Drop gcp_clusters table
merge_request
:
22713
author
:
type
:
other
db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
0 → 100644
View file @
a7192e2e
# frozen_string_literal: true
class
DropFkGcpClustersTable
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
remove_foreign_key_if_exists
:gcp_clusters
,
column: :project_id
remove_foreign_key_if_exists
:gcp_clusters
,
column: :user_id
remove_foreign_key_if_exists
:gcp_clusters
,
column: :service_id
end
def
down
add_foreign_key_if_not_exists
:gcp_clusters
,
:projects
,
column: :project_id
,
on_delete: :cascade
add_foreign_key_if_not_exists
:gcp_clusters
,
:users
,
column: :user_id
,
on_delete: :nullify
add_foreign_key_if_not_exists
:gcp_clusters
,
:services
,
column: :service_id
,
on_delete: :nullify
end
private
def
add_foreign_key_if_not_exists
(
source
,
target
,
column
:,
on_delete
:)
return
unless
table_exists?
(
source
)
return
if
foreign_key_exists?
(
source
,
target
,
column:
column
)
add_concurrent_foreign_key
(
source
,
target
,
column:
column
,
on_delete:
on_delete
)
end
def
remove_foreign_key_if_exists
(
table
,
column
:)
return
unless
table_exists?
(
table
)
return
unless
foreign_key_exists?
(
table
,
column:
column
)
remove_foreign_key
(
table
,
column:
column
)
end
end
db/migrate/20181031190559_drop_gcp_clusters_table.rb
0 → 100644
View file @
a7192e2e
# frozen_string_literal: true
class
DropGcpClustersTable
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
drop_table
:gcp_clusters
end
def
down
create_table
:gcp_clusters
do
|
t
|
# Order columns by best align scheme
t
.
references
:project
,
null:
false
,
index:
{
unique:
true
},
foreign_key:
{
on_delete: :cascade
}
t
.
references
:user
,
foreign_key:
{
on_delete: :nullify
}
t
.
references
:service
,
foreign_key:
{
on_delete: :nullify
}
t
.
integer
:status
t
.
integer
:gcp_cluster_size
,
null:
false
# Timestamps
t
.
datetime_with_timezone
:created_at
,
null:
false
t
.
datetime_with_timezone
:updated_at
,
null:
false
# Enable/disable
t
.
boolean
:enabled
,
default:
true
# General
t
.
text
:status_reason
# k8s integration specific
t
.
string
:project_namespace
# Cluster details
t
.
string
:endpoint
t
.
text
:ca_cert
t
.
text
:encrypted_kubernetes_token
t
.
string
:encrypted_kubernetes_token_iv
t
.
string
:username
t
.
text
:encrypted_password
t
.
string
:encrypted_password_iv
# GKE
t
.
string
:gcp_project_id
,
null:
false
t
.
string
:gcp_cluster_zone
,
null:
false
t
.
string
:gcp_cluster_name
,
null:
false
t
.
string
:gcp_machine_type
t
.
string
:gcp_operation_id
t
.
text
:encrypted_gcp_token
t
.
string
:encrypted_gcp_token_iv
end
end
end
db/schema.rb
View file @
a7192e2e
...
...
@@ -936,35 +936,6 @@ ActiveRecord::Schema.define(version: 20181107054254) do
add_index
"forked_project_links"
,
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
,
using: :btree
create_table
"gcp_clusters"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"user_id"
t
.
integer
"service_id"
t
.
integer
"status"
t
.
integer
"gcp_cluster_size"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
boolean
"enabled"
,
default:
true
t
.
text
"status_reason"
t
.
string
"project_namespace"
t
.
string
"endpoint"
t
.
text
"ca_cert"
t
.
text
"encrypted_kubernetes_token"
t
.
string
"encrypted_kubernetes_token_iv"
t
.
string
"username"
t
.
text
"encrypted_password"
t
.
string
"encrypted_password_iv"
t
.
string
"gcp_project_id"
,
null:
false
t
.
string
"gcp_cluster_zone"
,
null:
false
t
.
string
"gcp_cluster_name"
,
null:
false
t
.
string
"gcp_machine_type"
t
.
string
"gcp_operation_id"
t
.
text
"encrypted_gcp_token"
t
.
string
"encrypted_gcp_token_iv"
end
add_index
"gcp_clusters"
,
[
"project_id"
],
name:
"index_gcp_clusters_on_project_id"
,
unique:
true
,
using: :btree
create_table
"gpg_key_subkeys"
,
force: :cascade
do
|
t
|
t
.
integer
"gpg_key_id"
,
null:
false
t
.
binary
"keyid"
...
...
@@ -2450,9 +2421,6 @@ ActiveRecord::Schema.define(version: 20181107054254) do
add_foreign_key
"fork_network_members"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"fork_networks"
,
"projects"
,
column:
"root_project_id"
,
name:
"fk_e7b436b2b5"
,
on_delete: :nullify
add_foreign_key
"forked_project_links"
,
"projects"
,
column:
"forked_to_project_id"
,
name:
"fk_434510edb0"
,
on_delete: :cascade
add_foreign_key
"gcp_clusters"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"gcp_clusters"
,
"services"
,
on_delete: :nullify
add_foreign_key
"gcp_clusters"
,
"users"
,
on_delete: :nullify
add_foreign_key
"gpg_key_subkeys"
,
"gpg_keys"
,
on_delete: :cascade
add_foreign_key
"gpg_keys"
,
"users"
,
on_delete: :cascade
add_foreign_key
"gpg_signatures"
,
"gpg_key_subkeys"
,
on_delete: :nullify
...
...
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