Changelog History
-
v1.3.0 Changes
May 31, 2019๐ 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,2now rolls back the prefix creation if thefuncfails 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/1runs 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
andTriplex.create_schema/1,2,3. -
v1.3.0-rc.1 Changes
March 07, 2019๐ 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.
-
v1.3.0-rc.0 Changes
March 03, 2019โ Added
- ๐ Support to MySQL ๐ฌ
๐ Changed
Triplex.create/1,2now rolls back the prefix creation if thefuncfails 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/1runs 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
andTriplex.create_schema/1,2,3. -
v1.2.0 Changes
December 19, 2017๐ This is the official release of the candidate 1.2.0-rc.0
๐ For more details check the release canditate.
-
v1.2.0-rc.0 Changes
November 24, 2017๐ This is the release candidate for triplex new version!
Hope to get an official review in a week or two!
๐ Changelog
๐ In short, this release has this three main changes:
- ๐ Plug as an optional dependency, so if you don't use any plug on your app, triplex will not add this dependency on your project.
- ๐ The support for using triplex on OTP releases, which I really didn't know we had a problem with, but now, thanks to @dustinfarris, we do not have it anymore! PS: if anyone does need this correction on a
1.1patch release, please let me know. - ๐ Docs and README improved.
- ๐จ Refactors on plug configs and method return values.
๐ The PR's in this release are:
- Defining a return for all the commands on
Triplex(#42) @kelvinst - ๐จ Refactoring plug configuration (#43) @kelvinst
- ๐ Fixing func execution on Triplex.create/2 (#44) @kelvinst
- chore: clean up readme (#48) @dustinfarris
- ๐ fix: do not use Mix during runtime (#49) @dustinfarris
- Making the plug dependency optional (#50) @kelvinst
Thanks for all your work @dustinfarris!
๐ฅ Breaking changes
For those who wonder, there were not big changes, but here is the list of what can break on your code.
1. Some method return values changed on PR #42
If you use any of the second element of the return on the following methods, be sure to check if they still work:
Triplex.create_schema/3- this method was returning either the givenfuncresult (the 3rd param), which could be pretty much anything, or the result of aEcto.Adapters.SQL.query/4call, which also can change depending on ecto's version. Now it returns{:ok, tenant}, wheretenantis the name of the tenant.
If you need your
funcresult, you can change your code as follows:# Thiscase Triplex.create\_schema("test", Repo, your\_func) do {:ok, func\_return} -\> func\_return {:error, reason} -\> raise reasonend# Becomes thiswith {:ok, \_} \<- Triplex.create\_schema("test", Repo), {:ok, func\_return} \<- your\_func.("test", Repo) do func\_returnelse {:error, reason} -\> raise reasonendTriplex.create/2- this method was returning{:ok, migrations}, wheremigrationswas the list of migrations ran (which could be even an empty list). This changed because this method actually just delegates toTriplex.create_schema/3sendingTriplex.migrate/2as the fun, so now it returns{:ok, tenant}as well.
So if you need the migrations ran, here is how you should do:
# Thiscase Triplex.create("test", Repo) do {:ok, migrations} -\> migrations {:error, reason} -\> raise reasonend# Becomes thiswith {:ok, \_} \<- Triplex.create\_schema("test", Repo), {:ok, migrations} \<- Triplex.migrate("test", Repo) do migrationselse {:error, reason} -\> raise reasonend๐จ 2. Refactored
Triplex.PlugConfigon #43๐ง This was a restructuring on the plugs configuration, which was only one configuration for all the plugs and now we changed to specific configs for each plug type.
๐ This only affects you if you were using the module
Triplex.PlugConfig(which was completely removed) explicitly, otherwise you should be ok!