Conversation
|
|
||
| # Inherit all behaviour from Ecto.Adapters.SQL | ||
| use Ecto.Adapters.SQL, :postgrex | ||
| use Ecto.Adapters.SQL, driver: :postgrex, migration_lock: nil |
There was a problem hiding this comment.
migration_lock is intended to create a read lock on the schema migrations table so that migrations can be run concurrently, but only one runner proceeds. For postgres and mysql, it uses FOR UPDATE as in SELECT * FROM schema_migrations FOR UPDATE. I didn't check if redshift has something equivalent.
| current = | ||
| case elem(sources, pos) do | ||
| {table, schema} -> | ||
| {table, schema, _alias} -> |
There was a problem hiding this comment.
Ecto 3 allows naming for bindings. I believe that's what the third argument is, but it'll need to be double checked.
|
|
||
| defp default_expr({:ok, %{} = map}, :map) do | ||
| default = Ecto.Adapter.json_library().encode!(map) | ||
| default = json_library().encode!(map) |
There was a problem hiding this comment.
Ecto 3 got rid of this method and instead tells you to configure postgrex with the json library. I went with just using the postgrex configured one for now.
| {:ecto, "~> 2.2"}, | ||
| {:postgrex, "~> 0.13"}, | ||
| {:ecto_replay_sandbox, "~> 1.0.0"}, | ||
| {:ecto_sql, "~> 3.2"}, |
There was a problem hiding this comment.
Ecto 3 split into ecto and ecto_sql, ecto_sql pulls in both dependencies and contains the adapter code.
| |> select([m], {m.id, ^true}) | ||
| |> join(:inner, [], Schema2, fragment("?", ^true)) | ||
| |> join(:inner, [], Schema2, fragment("?", ^false)) | ||
| |> join(:inner, [], Schema2, on: fragment("?", ^true)) |
There was a problem hiding this comment.
join now requires the on clause to be specified under the on: key
|
|
||
| assert execute_ddl(create) == [ | ||
| ~s|CREATE TABLE "posts" ("a" varchar(max) DEFAULT '{"foo":"bar","baz":"boom"}')| | ||
| ~s|CREATE TABLE "posts" ("a" varchar(max) DEFAULT '{"baz":"boom","foo":"bar"}')| |
There was a problem hiding this comment.
The JSON library produced a different order
Started trying to upgrade this to Ecto 3. I've got 4 tests failing with these changes. Haven't attempted to run the integration tests yet.