zovafit / ecto-ordered Goto Github PK
View Code? Open in Web Editor NEWEcto extension for ordered models
Ecto extension for ordered models
At the moment the interface for setting the ranking column is a set_order/4
which is fine, but makes things inconvenient if you only want to set the scope column (which is something I've done in Zova's implementation).
So, perhaps set_order/2
with a keyword list of options is more appropriate.
To continue along that line, then maybe a __using__
macro would make sense to push that config out of the normal flow.
Hello!
I'd like to know if this repo is still maintained so that I can try to contribute to it.
Thanks ! ๐
Currently there are a few compiler warnings generated. I'll take care of them.
Since callbacks have been deprecated since Ecto 1.1 and are being removed in Ecto 2, are there plans to update to a solution which doesn't rely on callbacks?
I'm guessing it's going involve some use of Ecto.Multi
to handle the transactional side of this without having to pessimistically lock.
I'm happy to help out, I'm just wondering whether there were plans or if there was a better solution you could point to.
In a write-heavy environment reordering results in ShareLock deadlocks in PostgreSQL.
Relevant application error trace:
Process 14260 waits for ShareLock on transaction 1966288; blocked by process 14258.
Process 14258 waits for ShareLock on transaction 1966289; blocked by process 14260.
(ecto) lib/ecto/adapters/sql.ex:440: Ecto.Adapters.SQL.execute_or_reset/7
(ecto_ordered) lib/ecto_ordered.ex:242: EctoOrdered.increment_other_ranks/2
(ecto_ordered) lib/ecto_ordered.ex:172: EctoOrdered.ensure_unique_position/2
(ecto) lib/ecto/repo/schema.ex:456: anonymous fn/2 in Ecto.Repo.Schema.run_prepare/2
(elixir) lib/enum.ex:1811: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto) lib/ecto/repo/schema.ex:193: anonymous fn/14 in Ecto.Repo.Schema.do_insert/4
(ecto) lib/ecto/repo/schema.ex:768: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/6
(ecto) lib/ecto/adapters/sql.ex:576: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
(db_connection) lib/db_connection.ex:1275: DBConnection.transaction_run/4
(db_connection) lib/db_connection.ex:1199: DBConnection.run_begin/3
(db_connection) lib/db_connection.ex:790: DBConnection.transaction/3
Relevant lines from postgresql.log
:
ERROR: deadlock detected
DETAIL: Process 14254 waits for ShareLock on transaction 1929658; blocked by process 14258.
Process 14258 waits for ShareLock on transaction 1929659; blocked by process 14254.
Process 14254: UPDATE "tasks" AS t0 SET "order" = t0."order" + $1 WHERE (t0."order" >= $2)
Process 14258: UPDATE "tasks" AS t0 SET "order" = t0."order" + $1 WHERE (t0."order" >= $2) AND (t0."id" != $3)
HINT: See server log for query details.
CONTEXT: while updating tuple (341,256) in relation "tasks"
STATEMENT: UPDATE "tasks" AS t0 SET "order" = t0."order" + $1 WHERE (t0."order" >= $2)
I'm not sure if this has been encountered before by you @mootpointer. I'd be happy to submit a PR but I'm not sure I know where to start.
It would be great to have the ability to move: :first
and move: :last
to order an item at either the top or the bottom of an ordered list, respectively.
Hey @mootpointer, any chance we can create a milestone of tasks for things we need to do for a 0.2
release bump?
I'm anxious to help out again here. Feel free to add me as a collaborator and I can help triage more directly.
Thanks!
Right now scoped
is no longer needed in the use
. Can we document this change in the README?
how to set :prefix for multi tenant?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.