jbailey
5/15/2014 - 4:46 PM

Ecto/Postrex migration query

Ecto/Postrex migration query

defmodule Repo.Migrations.CreateCards do
  use Ecto.Migration

  def up do
    "CREATE TABLE IF NOT EXISTS cards ( 
      id SERIAL PRIMARY KEY, 
      name VARCHAR (255) UNIQUE NOT NULL, 
      class VARCHAR (255) NOT NULL, 
      stars INTEGER NOT NULL, 
      cost INTEGER NOT NULL, 
      wait INTEGER NOT NULL, 
      base_attack INTEGER NOT NULL, 
      base_hp INTEGER NOT NULL, 
      attack_gain_per_level INTEGER NOT NULL, 
      hp_gain_per_level INTEGER NOT NULL, 
      level_0_skill_id INTEGER, 
      level_5_skill_id INTEGER, 
      level_10_skill_id INTEGER
   )"
  end

  def down do
    "DROP TABLE cards"
  end
end
» mix ecto.migrate Repo
* running UP _build/dev/lib/elemental_kingdoms/priv/repo/migrations/20140512193907_create_cards.exs
** (Postgrex.Error) ERROR (42883): operator does not exist: character varying = bigint
    (ecto) lib/ecto/adapters/postgres/worker.ex:21: Ecto.Adapters.Postgres.Worker.query!/4
    (ecto) lib/ecto/adapters/postgres.ex:289: Ecto.Adapters.Postgres.use_worker/3
    (ecto) lib/ecto/adapters/postgres.ex:413: Ecto.Adapters.Postgres.migrate_up/3
    (ecto) lib/ecto/migrator.ex:136: anonymous fn/3 in Ecto.Migrator.migrate/3
    (elixir) lib/enum.ex:962: Enum."-map/2-lc$^0/1-0-"/2
    (mix) lib/mix/cli.ex:93: Mix.CLI.run_task/2
    (elixir) src/elixir_lexical.erl:17: :elixir_lexical.run/2