In version 4, does lucid have soft delete feature like in version 3?


I don’t find any information about soft deleting on version 4 documentation. And when I tried to create soft delete timestamp with softDeletes() method, error shows that it is not a function.

class UserSchema extends Schema {
  up() {
    return this.create('users', table => {
      table.string('username', 80).notNullable().unique();
      table.string('email', 254).notNullable().unique();
      table.string('password', 60).notNullable();

  down() {

TypeError: table.softDeletes is not a function
    at TableBuilder.create.table [as _fn] (/home/chabib/Code/api.askodis/.dist/database/migrations/1503250034279_user.js:17:16)
    at TableBuilder.toSQL (/home/chabib/Code/api.askodis/node_modules/knex/lib/schema/tablebuilder.js:71:12)
    at SchemaCompiler_MySQL.createTable (/home/chabib/Code/api.askodis/node_modules/knex/lib/schema/compiler.js:62:23)
    at SchemaCompiler_MySQL.toSQL (/home/chabib/Code/api.askodis/node_modules/knex/lib/schema/compiler.js:51:26)
    at SchemaBuilder.toSQL (/home/chabib/Code/api.askodis/node_modules/knex/lib/schema/builder.js:57:43)
    at /home/chabib/Code/api.askodis/node_modules/knex/lib/runner.js:56:32
From previous event:
    at (/home/chabib/Code/api.askodis/node_modules/knex/lib/runner.js:51:31)
    at SchemaBuilder.Target.then (/home/chabib/Code/api.askodis/node_modules/knex/lib/interface.js:35:43)


Hi @chabib! After fast looking in lucid codebase i found, that it unit test has code like this:

   db.schema.createTable('profiles', function (table) {

It’s look like this feature exists, but nod documented yet and npt obvious. Can you try it?


Yes soft deletes are not part of the core of Lucid, I will be creating a trait for that.


@virk Hey bro :slight_smile:, when is possible release with that?


Where can I find it?


Sorry for bumping this thread. Is there a solution out there yet?

Many thanks.


Hey @jacksoncharles! :wave:

Yes, there’s an experimental package build by radmen.

It will be added to the score after some testing.
Here’s the related PR about it: