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
40c6af54
Commit
40c6af54
authored
Dec 15, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix migration file typos and reorder Table definition
parent
b9fbfe5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
25 deletions
+21
-25
db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
...grate_kubernetes_service_to_new_clusters_architectures.rb
+21
-25
No files found.
db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb
View file @
40c6af54
...
@@ -2,6 +2,13 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -2,6 +2,13 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
DOWNTIME
=
false
DOWNTIME
=
false
DEFAULT_KUBERNETES_SERVICE_CLUSTER_NAME
=
'KubernetesService'
.
freeze
DEFAULT_KUBERNETES_SERVICE_CLUSTER_NAME
=
'KubernetesService'
.
freeze
class
Project
<
ActiveRecord
::
Base
self
.
table_name
=
'projects'
has_many
:cluster_projects
,
class_name:
'ClustersProject'
has_many
:clusters
,
through: :cluster_projects
,
class_name:
'Cluster'
end
class
Cluster
<
ActiveRecord
::
Base
class
Cluster
<
ActiveRecord
::
Base
self
.
table_name
=
'clusters'
self
.
table_name
=
'clusters'
...
@@ -9,11 +16,6 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -9,11 +16,6 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
has_many
:projects
,
through: :cluster_projects
,
class_name:
'Project'
has_many
:projects
,
through: :cluster_projects
,
class_name:
'Project'
has_one
:platform_kubernetes
,
class_name:
'PlatformsKubernetes'
has_one
:platform_kubernetes
,
class_name:
'PlatformsKubernetes'
attr_encrypted
:token
,
mode: :per_attribute_iv
,
key:
Gitlab
::
Application
.
secrets
.
db_key_base
,
algorithm:
'aes-256-cbc'
accepts_nested_attributes_for
:platform_kubernetes
accepts_nested_attributes_for
:platform_kubernetes
enum
platform_type:
{
enum
platform_type:
{
...
@@ -26,11 +28,20 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -26,11 +28,20 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
}
}
end
end
class
Project
<
ActiveRecord
::
Base
class
Clusters
Project
<
ActiveRecord
::
Base
self
.
table_name
=
'projects'
self
.
table_name
=
'
cluster_
projects'
has_many
:cluster_projects
,
class_name:
'ClustersProject'
belongs_to
:cluster
,
class_name:
'Cluster'
has_many
:clusters
,
through: :cluster_projects
,
class_name:
'Cluster'
belongs_to
:project
,
class_name:
'Project'
end
class
PlatformsKubernetes
<
ActiveRecord
::
Base
self
.
table_name
=
'cluster_platforms_kubernetes'
attr_encrypted
:token
,
mode: :per_attribute_iv
,
key:
Gitlab
::
Application
.
secrets
.
db_key_base
,
algorithm:
'aes-256-cbc'
end
end
class
Service
<
ActiveRecord
::
Base
class
Service
<
ActiveRecord
::
Base
...
@@ -67,21 +78,6 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -67,21 +78,6 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
end
end
end
end
class
ClustersProject
<
ActiveRecord
::
Base
self
.
table_name
=
'cluster_projects'
belongs_to
:cluster
,
class_name:
'Cluster'
belongs_to
:project
,
class_name:
'Project'
end
class
ProvidersGcp
<
ActiveRecord
::
Base
self
.
table_name
=
'cluster_providers_gcp'
end
class
PlatformsKubernetes
<
ActiveRecord
::
Base
self
.
table_name
=
'cluster_platforms_kubernetes'
end
def
up
def
up
Service
.
unmanaged_kubernetes_service
Service
.
unmanaged_kubernetes_service
.
find_each
(
batch_size:
1
)
do
|
kubernetes_service
|
.
find_each
(
batch_size:
1
)
do
|
kubernetes_service
|
...
@@ -104,7 +100,7 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
...
@@ -104,7 +100,7 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati
# Disable the KubernetesService. Platforms::Kubernetes will be used from next time.
# Disable the KubernetesService. Platforms::Kubernetes will be used from next time.
kubernetes_service
.
active
=
false
kubernetes_service
.
active
=
false
kubernetes_service
.
prop
a
ties
.
merge!
(
{
migrated:
true
}
)
kubernetes_service
.
prop
er
ties
.
merge!
(
{
migrated:
true
}
)
kubernetes_service
.
save!
kubernetes_service
.
save!
end
end
end
end
...
...
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