Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Commit

Permalink
Remove deprecated cache columns
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomassaro committed Dec 23, 2017
1 parent 18d6f89 commit 308a54f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
24 changes: 12 additions & 12 deletions priv/repo/cache/migrations/20170713020139_initial_migration.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 308a54f

Please sign in to comment.