{"id":5123,"date":"2016-02-18T14:18:28","date_gmt":"2016-02-18T16:18:28","guid":{"rendered":"http:\/\/blog.plataformatec.com.br\/?p=5123"},"modified":"2016-02-19T05:58:18","modified_gmt":"2016-02-19T07:58:18","slug":"ecto-2-0-0-beta-0-is-out","status":"publish","type":"post","link":"http:\/\/blog.plataformatec.com.br\/2016\/02\/ecto-2-0-0-beta-0-is-out\/","title":{"rendered":"Ecto 2.0.0-beta.0 is out!"},"content":{"rendered":"
Hello everyone,<\/p>\n
We are really glad to announce that Ecto 2.0.0-beta.0 has been released. The upcoming Ecto version packs many goodies:<\/p>\n
The effective deprecation of Ecto.Model in favor of a more data-oriented approach<\/p>\n<\/li>\n
Support for many_to_many associations and a more flexible approach to associations in general, including parallel preloading of associations<\/p>\n<\/li>\n
Introduction of a new SQL sandbox that allows developers to run database concurrent tests<\/p>\n<\/li>\n
Support for subqueries, composite primary keys, There are many more features, bug fixes and improvements. There are also backwards incompatible changes (hence the 2.0.0 version). We recommend you to check the CHANGELOG for more information<\/a>.<\/p>\n We appreciate developers to give this beta version a try. Keep in mind this is a beta release: bugs and regressions may exist. If you encounter an unexpected behaviour, please open up an issue report<\/a>.<\/p>\n When trying the beta version, please pay close attention to performance. We have measured performance improvements up to 50% in some situations, but other use cases may have degraded. Please let us know of any performance measurement you run, for both positive and negative net outcomes.<\/p>\n This release supports only the Postgrex adapter, for PostgreSQL. MySQL support and a couple extra features, like structure loading and dumping, will be added before 2.0.0 is released.<\/p>\n Using Ecto 2.0 in Phoenix projects is relatively straight-forward. For a newly generated project, changes should be made to your dependencies and test files.<\/p>\n The first step is to update your Phoenix projects by default use test transactions in the test environment. Ecto 2.0 replaces test transactions by the new SQL sandbox. In your by<\/p>\n Then, in each by<\/p>\n Notice the new version no longer needs to guard against And that’s it! Of course, your project may have used other Ecto features that have been deprecated, so don’t forget to read the CHANGELOG<\/a>.<\/p>\n We are also planning to release a series of blog posts, detailing and explaining the new Ecto 2.0 features, so keep posted!<\/p>\n Hello everyone, We are really glad to announce that Ecto 2.0.0-beta.0 has been released. The upcoming Ecto version packs many goodies: We have migrated to DBConnection, which considerably improves the performance of how Ecto manages connections to the database as a whole. Improved pool management, faster encoding\/decoding, support for prepared queries and more The effective … \u00bb<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[238,143,245],"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/5123"}],"collection":[{"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/comments?post=5123"}],"version-history":[{"count":6,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/5123\/revisions"}],"predecessor-version":[{"id":5130,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/5123\/revisions\/5130"}],"wp:attachment":[{"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/media?parent=5123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/categories?post=5123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/tags?post=5123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}insert_all<\/code> (alongside
update_all<\/code> and
delete_all<\/code>) and more<\/p>\n<\/li>\n<\/ul>\n
Using Ecto 2.0 in Phoenix projects<\/h2>\n
Phoenix.Ecto<\/code> dependency to
3.0.0-beta<\/code> in your
mix.exs<\/code>. This dependency will effectively depend on Ecto 2.0 and integrate it with Phoenix:<\/p>\n
{:phoenix_ecto, \"~> 3.0.0-beta\"}\n<\/code><\/pre>\n
test\/test_helper.exs<\/code>, replace the following<\/p>\n
Ecto.Adapters.SQL.begin_test_transaction(Demo.Repo)\n<\/code><\/pre>\n
Ecto.Adapters.SQL.Sandbox.mode(Demo.Repo, :manual)\n<\/code><\/pre>\n
test\/support\/*_case.ex<\/code> file, replace:<\/p>\n
unless tags[:async] do\n Ecto.Adapters.SQL.restart_test_transaction(Demo.Repo, [])\nend\n<\/code><\/pre>\n
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Demo.Repo)\n<\/code><\/pre>\n
tags[:async]<\/code>. With Ecto 2.0, you can run tests that depend on the database concurrently. For running acceptance tests via tools like Hound<\/a>, you will currently need to use the shared mode but we will tackle it before the final 2.0 release. That’s all powered by and documented in the new SQL sandbox<\/a>.<\/p>\n
\n
\n<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"