From 308a54fc54a619ff1674c560246b2b58260ee943 Mon Sep 17 00:00:00 2001 From: Renato Massaro Date: Sat, 23 Dec 2017 09:28:25 -0200 Subject: [PATCH] Remove deprecated cache columns --- .../20170713020139_initial_migration.exs | 24 +++++++++---------- ...112419_remove_deprecated_cache_columns.exs | 16 +++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 priv/repo/cache/migrations/20171223112419_remove_deprecated_cache_columns.exs diff --git a/priv/repo/cache/migrations/20170713020139_initial_migration.exs b/priv/repo/cache/migrations/20170713020139_initial_migration.exs index ce758801..c6377a4c 100644 --- a/priv/repo/cache/migrations/20170713020139_initial_migration.exs +++ b/priv/repo/cache/migrations/20170713020139_initial_migration.exs @@ -5,16 +5,16 @@ defmodule Helix.Cache.Repo.Migrations.InitialMigration do create table(:server_cache, primary_key: false) do add :server_id, :inet, primary_key: true - add :entity_id, :inet - add :motherboard_id, :inet + add :entity_id, :inet # removed + add :motherboard_id, :inet # removed add :networks, {:array, :json} add :storages, {:array, :inet} - add :resources, :map - add :components, {:array, :inet} + add :resources, :map # removed + add :components, {:array, :inet} # removed add :expiration_date, :utc_datetime end - create index(:server_cache, [:entity_id]) - create index(:server_cache, [:motherboard_id]) + create index(:server_cache, [:entity_id]) # removed + create index(:server_cache, [:motherboard_id]) # removed create index(:server_cache, [:expiration_date]) create table(:storage_cache, primary_key: false) do @@ -32,12 +32,12 @@ defmodule Helix.Cache.Repo.Migrations.InitialMigration do end create index(:network_cache, [:expiration_date]) - create table(:component_cache, primary_key: false) do - add :component_id, :inet, primary_key: true - add :motherboard_id, :inet - add :expiration_date, :utc_datetime - end - create index(:component_cache, [:expiration_date]) + create table(:component_cache, primary_key: false) do # removed + add :component_id, :inet, primary_key: true # removed + add :motherboard_id, :inet # removed + add :expiration_date, :utc_datetime # removed + end # removed + create index(:component_cache, [:expiration_date]) # removed create table(:web_cache, primary_key: false) do add :network_id, :inet, primary_key: true diff --git a/priv/repo/cache/migrations/20171223112419_remove_deprecated_cache_columns.exs b/priv/repo/cache/migrations/20171223112419_remove_deprecated_cache_columns.exs new file mode 100644 index 00000000..82a82b63 --- /dev/null +++ b/priv/repo/cache/migrations/20171223112419_remove_deprecated_cache_columns.exs @@ -0,0 +1,16 @@ +defmodule Helix.Cache.Repo.Migrations.RemoveDeprecatedCacheColumns do + use Ecto.Migration + + def change do + drop index(:server_cache, [:entity_id]) + drop index(:server_cache, [:motherboard_id]) + alter table(:server_cache, primary_key: false) do + remove :entity_id + remove :motherboard_id + remove :resources + remove :components + end + + drop table(:component_cache) + end +end