Skip to content

Releases: adonisjs/lucid

Added BaseSeeder and accept connection,client in model factories

21 Jun 05:49
Compare
Choose a tag to compare
  • improvement: update seeder template to use BaseSeeder f41a92d
  • improvement: allow passing model adapter options via the query method c5e44ac
  • feat: add BaseSeeder abd0882
  • feat: allow defining custom connection and client in factories fd64466
  • fix: prefix seeder to the class name 4d9ab93

v8.2.1...v8.2.2

Fixes to factories and seeds commands

20 Jun 20:06
Compare
Choose a tag to compare
  • fix: persist belongs to before persisting the parent model 380d684
  • improvement: close connections after db:seed command daab588
  • fix: use directories.seeds path over seedsPath directory fd2ce31

v8.2.0...v8.2.1

Adding support for factories and seeds

20 Jun 18:37
Compare
Choose a tag to compare
  • chore: update validator 1a6ed3b
  • refactor: register seeds typings bf1e082
  • refactor: bind Adonis/Lucid/Factory to ioc container 7a0c370
  • chore: update dependencies 1772663
  • feat: add support for seeders a213661
  • feat: allow defining custom handler for generating stub ids e755e2e
  • feat: add fakerjs fe0febe
  • feat: implement factory model hooks and add ids stub calls d494f13
  • improvement: rename to 4563a00
  • improvement: improve overall factories API 7d8398c
  • fix: pivot table insert attributes 934c33d
  • ci: add debug log 0952dcc
  • improvement: cleanup factory relationships structure 80d63d7
  • chore: fix linting issues 28dae25
  • feat: implement core of the factories 5c65731
  • test: add test for select statement 3d50f77
  • fix(commands): correct typo in migration:status description 3141153
  • fix(QueryBuilder): support falsy values in between pairs (#556) 2d2e7cb
  • test: await the call to refresh ff9fb2e
  • feat(Model): make refresh chainable d09e3b5
  • improvement(Model): make merge, fill & save chainable (#554) 7a518d8
  • feat: add toObject method to model fa8ae6e
  • improvement: remove max listeners limit from transaction client 1b99bb8
  • fix: cast page and limit to numbers, since paginate receives input from the HTTP request bd38a5d
  • fix: use deep equal diff to find dirty values 5ebbc9e
  • fix: transform query aliases to lowercase, since postgresql converts them to lowercase ccc1ca4
  • test: update expose port in docker test file ecfb1c6
  • test: skip dialect version check for now a1e9079
  • test: add tests to ensure that relationship query builder handles groupLimit properly 4e5f262
  • feat: implement groupLimit for relationship preloading def372c
  • chore: update dependencies 76037a6
  • refactor: move relationships persistance hydration to relation class e443b20

v8.1.1...v8.2.0

Adding pagination hooks and bug fixes

15 May 06:38
Compare
Choose a tag to compare

Pagination hooks

We have added ORM hooks for pagination too.

beforePaginate

class User extends BaseModel {
  @beforePaginate()
  public static someMethod ([countQuery, query]) {
  }
}

afterPaginate

class User extends BaseModel {
  @afterPaginate()
  public static someMethod (paginator) {
    console.log(paginator.all())
    console.log(paginator.total)
  }
}

Commits

  • chore: update dependencies f7bd18f
  • feat: add pagination hooks 1f9b1d3
  • fix: re-compute dirty properties after initiating auto update columns b309acb
  • chore: update dependencies ef3cf10
  • fix(serialization): pick all fields when pick property is undefined fa0a214
  • improvement: updateOrCreate and updateOrCreateMany can handle concurrent updates too 5bee648
  • chore: update dependencies 4754a8c
  • chore: update dependencies ed90d3a

v8.1.0...v8.1.1

Improving model serialization process by allowing fields to pick or omit

01 May 10:03
Compare
Choose a tag to compare

The serialization process accepts a tree of fields to pick and omit for the model and its relationships. Example:

const user = await User.find(1)
user.serialize({
  fields: ['username', 'email', 'id'],
})

// Verbose mode
user.serialize({
  fields: {
    pick: ['username', 'email', 'id'],
    omit: ['id']
  },
})

When pick and omit both have the same set of properties, the omit will win.

Relationships

Quite often you would want to also cherry pick fields for relationships as well.

user.serialize({
  fields: {
    pick: ['username', 'email', 'id'],
    omit: ['id']
  },
  relations: {
    posts: {
      fields: ['title', 'body', 'published_at']
    }
  }
})

Feels verbose?

Well, you will never type these fields to pick or omit manually. Usually, you will be following an API standard like JSONAPI, which allows the consumer of your API to specify the fields. There we will be a preprocessor in between the model.serialize the user defined query string options. That preprocessor will convert the query string to this tree.

Commits

  • improvement: adding support to pick and omit fields during serialize process d3d4f92

v8.0.5...v8.1.0

Handful of bug fixes

30 Apr 15:40
Compare
Choose a tag to compare
  • improvement: allow whereNot contraints for the unique and the exists rules 1bdf5e6
  • feat: add useTransaction and useConnection methods 789f038
  • improvement: making ddl queries compute the query method and not the pretty printer 7d40daf
  • fix: update mysql config type to accept mysql2 as a client 2623e66
  • fix: use for of loop to iterate over registered connections bfdf53a

v8.0.4...v8.0.5

Improvements to migrations dry run output

28 Apr 04:17
Compare
Choose a tag to compare
  • fix: pretty sql queries with proper formatting 77f6043
  • chore: update dependencies d0c5c80

v8.0.3...v8.0.4

Improvements to logging and some new additions

27 Apr 10:22
Compare
Choose a tag to compare

Bug Fixes

  • Fix SimplePaginator.toJSON static type

Improvements

  • Do not register health checker, until one or more connections have health checks enabled
  • Improvements to the query debugging. Now debugging can be control globally, at connection level or at query level.

Additions

  • Added findBy and findByOrFail methods to model

Commits

  • improvement: serialize datetime to iso string 7091bab
  • feat: query.delete method, it is an alias for the existing .del method ea7166c
  • improvement: protect preload method to be called from a deleted instance eaff60a
  • feat: add findBy and findByOrFail methods 3d3a8f4
  • improvement: streamline query logging by disabling knex logger and user event emitter 21f01d6
  • improvement: register health checker only when one or more connections are using it 117ec61
  • chore: update dependencies 7611427
  • fix(types): fix type returned by SimplePaginator.toJSON (#535) e386e94

v8.0.2...v8.0.3

Removing redundant log statement

20 Apr 15:21
Compare
Choose a tag to compare
  • fix: remove redundant console.log statement 1c1dd25

v8.0.1...v8.0.2

Improvements to the sync method, along with some bug fixes

20 Apr 15:01
Compare
Choose a tag to compare
  • improvement: improve sync method to not select all pivot rows 76ebf32
  • fix: always set updatedAt when model is dirty d7e5672
  • fix: Database.transaction accept callback to be passed to the query client 5e07ed8
  • chore: update dependencies 072c794
  • fix(types): correct type of Model.createMany values parameter (#533) 6727f8e

v8.0.0...v8.0.1