Skip to content

Instantly share code, notes, and snippets.

@jbailey
Last active August 29, 2015 14:01
Show Gist options
  • Save jbailey/4544dd6224141ac31cab to your computer and use it in GitHub Desktop.
Save jbailey/4544dd6224141ac31cab to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment