title: Ecto add/3 default not working properly
body: <p>I have trouble with getting default value to use. I believe that I have set it up properly but it doesn't seem to work. When queried, new records have none (nothing, blank space) in the PGAdmin instead of supposed 0.</p>
  
  <p>Migration:</p>
  
  <pre><code>    create table(:teachers) do
        add :login, :string
        add :password, :string
        add :email, :string
        add :role, :integer, default: 0
  
        timestamps
      end
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>defmodule Ep.Teacher do
    use Ep.Web, :model
  
    schema "teachers" do
      field :login, :string
      field :password, :string
      field :email, :string
      field :role, :integer
  
      has_many :tests, Ep.Test, on_delete: :fetch_and_delete
  
      timestamps
    end
  
    @required_fields ~w(login password email)
    @optional_fields ~w(role)
  
    def changeset(model, params \\ :empty) do
      model
      |&gt; cast(params, @required_fields, @optional_fields)
    end
  end
  </code></pre>
  
  <p>PGAdmin table stats:</p>
  
  <pre><code>CREATE TABLE public.teachers
  (
    id integer NOT NULL DEFAULT nextval('teachers_id_seq'::regclass),
    ....
    role integer DEFAULT 0,
    ....
    CONSTRAINT teachers_pkey PRIMARY KEY (id)
  )
  WITH (
    OIDS=FALSE
  );
  ALTER TABLE public.teachers
    OWNER TO postgres;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code> def create(conn, %{"teacher" =&gt; teacher_params}) do
      IO.inspect teacher_params
      changeset = Teacher.changeset(%Teacher{}, teacher_params)
      case Repo.insert(changeset) do
        {:ok, _teacher} -&gt;
          conn
          |&gt; put_flash(:info, "Teacher created successfully.")
          |&gt; redirect(to: teacher_path(conn, :index))
        {:error, changeset} -&gt;
          render(conn, "new.html", changeset: changeset)
      end
    end
  </code></pre>