assertj / assertj-db

Assertions for database
https://assertj.github.io/doc/#assertj-db
Apache License 2.0
113 stars 19 forks source link

Sort Changes by the specified field other than the primary key #259

Open Sergey-citc opened 2 years ago

Sergey-citc commented 2 years ago

According to documentation, changes sorted by primary key and if there are no primary key by the values of the row (for a modification). My table has a primary key, but it doesn't fit because it has a type UUID. So the changes is sorted randomly.

Is there any function to set sorting on any other field? If not, can you add?

I tried like below code, it doesn't work:

Table(dataSource, "table_name", arrayOf(Order.asc("created")))...

clemstoquart commented 1 year ago

Hello,

You can do something like that:

// Get the data from "members" table and order on "name" column in ascending order
Table table = new Table(source, "members", new Order[] { Order.asc("name") });