{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/336","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/336/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/336/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/336/events","html_url":"https://github.com/elixir-lang/ecto/pull/336","id":52811457,"number":336,"title":"Updated Migration DSL","user":{"login":"joshnuss","id":4437,"avatar_url":"https://avatars.githubusercontent.com/u/4437?v=3","gravatar_id":"","url":"https://api.github.com/users/joshnuss","html_url":"https://github.com/joshnuss","followers_url":"https://api.github.com/users/joshnuss/followers","following_url":"https://api.github.com/users/joshnuss/following{/other_user}","gists_url":"https://api.github.com/users/joshnuss/gists{/gist_id}","starred_url":"https://api.github.com/users/joshnuss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshnuss/subscriptions","organizations_url":"https://api.github.com/users/joshnuss/orgs","repos_url":"https://api.github.com/users/joshnuss/repos","events_url":"https://api.github.com/users/joshnuss/events{/privacy}","received_events_url":"https://api.github.com/users/joshnuss/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2014-12-24T10:45:08Z","updated_at":"2015-03-01T07:54:42Z","closed_at":"2015-01-14T10:21:14Z","pull_request":{"url":"https://api.github.com/repos/elixir-lang/ecto/pulls/336","html_url":"https://github.com/elixir-lang/ecto/pull/336","diff_url":"https://github.com/elixir-lang/ecto/pull/336.diff","patch_url":"https://github.com/elixir-lang/ecto/pull/336.patch"},"body":"This is an updated version of #132.\r\n\r\nTODO\r\n\r\n- [x] Add more column types (boolean, decimal, etc..), currently only primary key, varchar, datetime, integer\r\n- [x] Add `timestamps/0` function to DSL (maybe this should be a separate PR, since the models should support this notion too)\r\n- [x] Shortcuts for `alter table(..)` (add_column, remove_column, modify_column, rename_column)\r\n- [x] Existence functions (column_exists?, table_exists?, index_exists?)\r\n- [x] Column options, `default`, `scale`, `precision`, others?\r\n- [x] Add `references/1` for creating foreign keys i.e.\r\n\r\n```elxir\r\ncreate table(:products) do\r\n  references(:category)\r\nend\r\n```\r\n\r\nIt supports a DSL syntax, for creating/dropping/altering objects:\r\n\r\n## Change Example:\r\n\r\n```elixir\r\ndefmodule Repo.Migrations.CreatePosts do\r\n  use Ecto.Migration\r\n\r\n  def change do\r\n    create table(:posts) do\r\n      add :title, :string\r\n      add :published_at, :time\r\n    end\r\n  end\r\nend\r\n```\r\n\r\n## Up/Down Example:\r\n```elixir\r\ndefmodule Repo.Migrations.CreatePosts do\r\n  use Ecto.Migration\r\n\r\n  def up do\r\n    create table(:posts) do\r\n      add :title, :string\r\n      add :published_at, :datetime\r\n      timestamps\r\n    end\r\n  end\r\n\r\n  def down do\r\n    drop table(:posts)\r\n  end\r\nend\r\n```\r\n\r\n## Alter Example:\r\n```elixir\r\ndefmodule Repo.Migrations.AlterPosts do\r\n  use Ecto.Migration\r\n\r\n  def change do\r\n    alter table(:posts) do\r\n      add :summary, :string\r\n      remove :published_at\r\n      modify :title, :string\r\n      rename :owner, :created_by\r\n    end\r\n  end\r\nend\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/comments/76586983","html_url":"https://github.com/elixir-lang/ecto/pull/336#issuecomment-76586983","issue_url":"https://api.github.com/repos/elixir-lang/ecto/issues/336","id":76586983,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T07:54:42Z","updated_at":"2015-03-01T07:54:42Z","body":"@rcdilorenzo no problem. The rename_column implementation we had simply didn't work. We will be glad to add it back if someone wants to contribute it. :)"}}