{"id":7883,"date":"2018-10-25T16:50:01","date_gmt":"2018-10-25T18:50:01","guid":{"rendered":"http:\/\/blog.plataformatec.com.br\/?p=7883"},"modified":"2019-01-15T15:41:16","modified_gmt":"2019-01-15T17:41:16","slug":"updating-hex-pm-to-ecto-3-0","status":"publish","type":"post","link":"http:\/\/blog.plataformatec.com.br\/2018\/10\/updating-hex-pm-to-ecto-3-0\/","title":{"rendered":"Updating Hex.pm to Ecto 3.0"},"content":{"rendered":"
Ecto 3.0 is just around the corner and as you may already know it reached stable API<\/a>. To make sure everything works properly I thought I’ll try updating one of the first projects that ever used Ecto: Hex.pm<\/a>.<\/p>\n The whole upgrade was done in a single pull request<\/a>, which we will break down below.<\/p>\n First, the required steps:<\/p>\n Secondly, we got a couple deprecation warnings so here are the fixes:<\/p>\n Finally, there were a few minor glitches (or redundancies!) specific to Hex.pm: Overall the update process was pretty straightforward. There were a few minor bugs along the way which were promptly fixed upstream. Having previously updated Hex.pm to Ecto 2.0<\/a>, which took a few months (we started it early on, which made it a fast moving target back then), I can really appreciate the level of maturity that Ecto achieved and how easy it was to update this time around. \ud83d\ude42<\/p>\n Update: Add note about We are glad to be an active part of the process by contributing to the ecosystem and helping companies adopt Elixir at different stages of their adoption cycle. We would love to work with you too!<\/em><\/p>\n Do you think that your company could benefit from our expertise and assistance? Just click the button below.<\/em><\/p>\n <\/a><\/p>\n","protected":false},"excerpt":{"rendered":" Ecto 3.0 is just around the corner and as you may already know it reached stable API. To make sure everything works properly I thought I’ll try updating one of the first projects that ever used Ecto: Hex.pm. The whole upgrade was done in a single pull request, which we will break down below. First, … \u00bb<\/a><\/p>\n","protected":false},"author":70,"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,294],"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/7883"}],"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\/70"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/comments?post=7883"}],"version-history":[{"count":14,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/7883\/revisions"}],"predecessor-version":[{"id":9639,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/7883\/revisions\/9639"}],"wp:attachment":[{"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/media?parent=7883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/categories?post=7883"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/tags?post=7883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
ecto_sql<\/code> and bump the postgrex dependency. Note: SQL handling have been extracted out into a separate
ecto_sql<\/code><\/a> project, so we need to add that new dependency. (
6b3b78cf<\/code><\/a>)<\/li>\n
pool<\/code> configuration and use the default pool implementation. (
760026f3<\/code><\/a>)<\/li>\n
pool_size<\/code>\u00a0is at least
2<\/code>\u00a0when running migrations.<\/li>\n
e16ebd8f<\/code><\/a>) and because we were already using the recommended package, Jason<\/a>, we don’t need that configuration anymore. (
66f9cbdf<\/code><\/a>)<\/li>\n
time<\/code> we can’t put value with microsecond precision and similarly we can’t put into a
time_usec<\/code> field a value without microsecond precision. (
2e34b833<\/code><\/a>)<\/li>\n
Ecto.Changeset.unique_constraint\/3<\/code><\/a> are now including in the error metadata the type and the name of the constraint, which broke our test that was overly specific. (
3d19f903<\/code><\/a>)<\/li>\n<\/ol>\n
\n
d3911953<\/code><\/a>)<\/li>\n
Ecto.Multi.run\/3<\/code><\/a> now accepts a 2-arity function (first argument is now the Repo) instead of a 1-arity one before. (
95d11cc2<\/code><\/a>)<\/li>\n<\/ol>\n
c4168977<\/code><\/a>,
21eb0bf8<\/code><\/a>, and
0929cd9e<\/code><\/a>.<\/p>\n
pool_size<\/code>\u00a0when running migrations.<\/p>\n