Skip to content

Commit

Permalink
[Docs] Update upgrade docs
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte committed Jun 18, 2023
1 parent 18286d4 commit f100432
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docs/prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ Thus in your AppServiceProvider you will need to set `Schema::defaultStringLengt

This package expects the primary key of your `User` model to be an auto-incrementing `int`. If it is not, you may need to modify the `create_permission_tables` migration and/or modify the default configuration. See [https://spatie.be/docs/laravel-permission/advanced-usage/uuid](https://spatie.be/docs/laravel-permission/advanced-usage/uuid) for more information.

## Database foreign-key relationship support

To enforce database integrity, this package uses foreign-key relationships with cascading deletes. This prevents data mismatch situations if database records are manipulated outside of this package. If your database engine does not support foreign-key relationships, then you will have to alter the migration files accordingly.

IMPROVEMENTS TO FOREIGN KEY HANDLING WERE ADDED IN v6, SO UPGRADING IS RECOMMENDED.
14 changes: 8 additions & 6 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ weight: 6

ALL upgrades of this package should follow these steps:

1. Upgrading between major versions of this package always require the usual Composer steps:
1. Composer. Upgrading between major versions of this package always require the usual Composer steps:
- Update your `composer.json` to specify the new major version, such as `^6.0`
- Then run `composer update`.

2. Compare the `migration` file stubs in the NEW version of this package against the migrations you've already run inside your app. If necessary, create a new migration (by hand) to apply any new changes.
2. Migrations. Compare the `migration` file stubs in the NEW version of this package against the migrations you've already run inside your app. If necessary, create a new migration (by hand) to apply any new database changes.

3. If you have made any custom Models from this package into your own app, compare the old and new models and apply any relevant updates to your custom models.
3. Config file. Incorporate any changes to the permission.php config file, updating your existing file. (It may be easiest to make a backup copy of your existing file, re-publish it from this package, and then re-make your customizations to it.)

4. If you have overridden any methods from this package's Traits, compare the old and new traits, and apply any relevant updates to your overridden methods.
4. Models. If you have made any custom Models from this package into your own app, compare the old and new models and apply any relevant updates to your custom models.

5. Apply any version-specific special updates as outlined below...
5. Custom Methods/Traits. If you have overridden any methods from this package's Traits, compare the old and new traits, and apply any relevant updates to your overridden methods.

6. Review the changelog, which details all the changes: https://github.com/spatie/laravel-permission/blob/main/CHANGELOG.md
6. Apply any version-specific special updates as outlined below...

7. Review the changelog, which details all the changes: [CHANGELOG](https://github.com/spatie/laravel-permission/blob/main/CHANGELOG.md)
and/or consult the [Release Notes](https://github.com/spatie/laravel-permission/releases)


Expand Down

0 comments on commit f100432

Please sign in to comment.