diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-02 17:10:46 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-11-02 17:10:46 +0300 |
commit | 64be8d70ae20928df351e495a3442bb6036bc3e7 (patch) | |
tree | 6eb01452391ccfa45d1dbaeae261d118d323bcc1 /db | |
parent | 461c385ebca7ecb52d0b385fd61c856eb395481a (diff) |
Improve backend structure of data
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb | 8 | ||||
-rw-r--r-- | db/schema.rb | 35 |
2 files changed, 25 insertions, 18 deletions
diff --git a/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb b/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb index 93611bf8a12..1035adfe2b5 100644 --- a/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb +++ b/db/migrate/20171031100710_create_clusters_kubernetes_helm_apps.rb @@ -1,12 +1,12 @@ class CreateClustersKubernetesHelmApps < ActiveRecord::Migration def change - create_table :clusters_kubernetes_helm_apps do |t| - t.integer :status, null: false + create_table :clusters_applications_helm do |t| + t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade } t.datetime_with_timezone :created_at, null: false t.datetime_with_timezone :updated_at, null: false - - t.references :service, index: true, null: false, foreign_key: { on_delete: :cascade } + + t.integer :status, null: false t.string :version, null: false t.text :status_reason end diff --git a/db/schema.rb b/db/schema.rb index d76977d45f2..02df408b45e 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: 20171017145932) do +ActiveRecord::Schema.define(version: 20171031100710) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -464,9 +464,7 @@ ActiveRecord::Schema.define(version: 20171017145932) do create_table "cluster_platforms_kubernetes", force: :cascade do |t| t.integer "cluster_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.text "api_url" + t.string "api_url" t.text "ca_cert" t.string "namespace" t.string "username" @@ -474,6 +472,8 @@ ActiveRecord::Schema.define(version: 20171017145932) do t.string "encrypted_password_iv" t.text "encrypted_token" t.string "encrypted_token_iv" + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false end add_index "cluster_platforms_kubernetes", ["cluster_id"], name: "index_cluster_platforms_kubernetes_on_cluster_id", unique: true, using: :btree @@ -491,33 +491,39 @@ ActiveRecord::Schema.define(version: 20171017145932) do create_table "cluster_providers_gcp", force: :cascade do |t| t.integer "cluster_id", null: false t.integer "status" - t.integer "num_nodes", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false t.text "status_reason" t.string "gcp_project_id", null: false t.string "zone", null: false + t.integer "num_nodes", null: false t.string "machine_type" t.string "operation_id" t.string "endpoint" t.text "encrypted_access_token" t.string "encrypted_access_token_iv" + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false end add_index "cluster_providers_gcp", ["cluster_id"], name: "index_cluster_providers_gcp_on_cluster_id", unique: true, using: :btree create_table "clusters", force: :cascade do |t| - t.integer "user_id", null: false - t.integer "provider_type" - t.integer "platform_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.integer "user_id" t.boolean "enabled", default: true t.string "name", null: false + t.integer "provider_type" + t.integer "platform_type" + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false end - add_index "clusters", ["enabled"], name: "index_clusters_on_enabled", using: :btree - add_index "clusters", ["user_id"], name: "index_clusters_on_user_id", using: :btree + create_table "clusters_applications_helm", force: :cascade do |t| + t.integer "cluster_id", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.integer "status", null: false + t.string "version", null: false + t.text "status_reason" + end create_table "container_repositories", force: :cascade do |t| t.integer "project_id", null: false @@ -1872,6 +1878,7 @@ ActiveRecord::Schema.define(version: 20171017145932) do add_foreign_key "cluster_projects", "projects", on_delete: :cascade add_foreign_key "cluster_providers_gcp", "clusters", on_delete: :cascade add_foreign_key "clusters", "users", on_delete: :nullify + add_foreign_key "clusters_applications_helm", "clusters", on_delete: :cascade add_foreign_key "container_repositories", "projects" add_foreign_key "deploy_keys_projects", "projects", name: "fk_58a901ca7e", on_delete: :cascade add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade |