triplex v1.3.0 Release Notes

Release Date: 2019-05-31 // almost 5 years ago
  • ๐Ÿ› Bug fixes

    • ๐Ÿ›  Fixed compilation error when optional adapters are not included in downstream project.

    ๐Ÿ”„ Changed

    • ๐Ÿณ docker-compose configuration that allows easy setup for test databases.
    • Triplex.create/1,2 now rolls back the prefix creation if the func fails with error tuple
    • ๐Ÿฑ Now we support to Ecto 3! ๐ŸŽ‰ But be aware that this new version does not support
      the old versions of Ecto, only 3.0 and up

    ๐Ÿ’ฅ Breaking changes

    โฌ†๏ธ It's not our fault, but there is a breaking change if you upgrade it because migration on
    Ecto 3 are ran on a different process.

    The problem you may find is basically with this kind of code:

    Repo.transaction(fn -\> {:ok, \_} = Triplex.create("tenant") User.insert!(%{name: "Demo user 1"}) User.insert!(%{name: "Demo user 2"})end)
    

    As Triplex.create/1 runs the tenant migrations, and they will run on different processes,
    you will get an error from your db saying that the given tenant prefix (schema or database
    depending on the db) does not exist.

    That occurs because the new processes will checkout a new connection to db, making them
    not aware of the current transaction, since it is on another db connection. But don't panic,
    we have a solution for you!

    Here is how you could achieve the same results on success or fail:

    Triplex.create\_schema("tenant", Repo, fn(tenant, repo) -\>Repo.transaction(fn -\> {:ok, \_} = Triplex.migrate(tenant, repo) User.insert!(%{name: "Demo user 1"}) User.insert!(%{name: "Demo user 2"}) tenant end)end)
    

    ๐Ÿ“š For more details about these function check the online documentation for Triplex.create/1,2
    and Triplex.create_schema/1,2,3.


Previous changes from v1.3.0-rc.1

  • ๐Ÿ› Bug fixes

    • ๐Ÿ›  Fixed compilation error when optional adapters are not included in downstream project.

    ๐Ÿ”„ Changed

    • ๐Ÿณ docker-compose configuration that allows easy setup for test databases.