diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-10-16 23:03:59 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-10-22 17:54:00 +0300 |
commit | e3ca493876ab71ed29817a0af436fc563f564bbe (patch) | |
tree | bca9826ae1cc1b8140249e570626f22eb48cb960 /db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb | |
parent | a310a638db037d3914cf12e580c7a41209d2d06e (diff) |
Add Clusters::KubernetesNamespace model
This model will be used to persist into database Kubernetes properties,
such as namespace, service account name and service account token.
Diffstat (limited to 'db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb')
-rw-r--r-- | db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb new file mode 100644 index 00000000000..a58c190e1d6 --- /dev/null +++ b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateClustersKubernetesNamespaces < ActiveRecord::Migration + DOWNTIME = false + INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace' + + def change + create_table :clusters_kubernetes_namespaces, id: :bigserial do |t| + t.references :cluster, null: false, index: true, foreign_key: { on_delete: :cascade } + t.references :project, index: true, foreign_key: { on_delete: :nullify } + t.references :cluster_project, index: true, foreign_key: { on_delete: :nullify } + + t.timestamps_with_timezone null: false + + t.string :encrypted_service_account_token_iv + t.string :namespace, null: false + t.string :service_account_name + + t.text :encrypted_service_account_token + + t.index [:cluster_id, :namespace], name: INDEX_NAME, unique: true + end + end +end |