Skip to content

Commit

Permalink
Update README.md and CHANGELOG.md files
Browse files Browse the repository at this point in the history
  • Loading branch information
alajusticia committed Jul 18, 2023
1 parent 9e7e6a6 commit ca34a8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to `laravel-expirable` will be documented in this file.

## 2.2 - 2023-07-18

- Add `mode` key to `expirable.php` configuration file to specify the type of delete used by the `expirable:purge` command, value defaulting to `hard`.

- Add `--mode=hard/soft` option to `expirable:purge` command, taking the `mode` key in `expirable.php` configuration file if not specified, otherwise defaulting to `hard` for backward compatibility.

## 2.1 - 2023-07-14

- Add ability to pass which models to delete in argument of the `expirable:purge` command.
- Add `since` option for the `expirable:purge` command to delete only the models that have expired for at least a given period of time.

## 2.0 - 2023-03-07

- Add support for Laravel 10.
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,14 @@ You can also specify a period of time to delete models expired since that given
php artisan expirable:purge "App\Models\Subscription" --since="2 months"
```

By default, this command will use force deletion to purge the models. If needed, you can specify the `mode` option with the value `soft` to perform a soft delete:

```
php artisan expirable:purge --mode=soft
```

:warning: Be aware that if you try to purge models depending on tables with foreign key constraints using the default `hard` mode, you will have to specify the desired action for the "on delete" property of the constraint (for example using the onDelete('cascade'), cascadeOnDelete() or nullOnDelete() modifiers on the foreign key in your migrations: [https://laravel.com/docs/10.x/migrations#foreign-key-constraints](https://laravel.com/docs/10.x/migrations#foreign-key-constraints)) or purge the child models first (ordering the command arguments or the array in the config file to start with the children) to avoid SQL errors.

## License

Open source, licensed under the [MIT license](LICENSE).

0 comments on commit ca34a8b

Please sign in to comment.