Skip to content

Commit

Permalink
prepare first release
Browse files Browse the repository at this point in the history
  • Loading branch information
forxer committed Oct 27, 2021
1 parent 505f12c commit 195689b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# laravel-pk-int-to-bingint
Convert DB primary keys and related foreign keys type from INT to BIGINT
Laravel convert primary keys INT to BIGINT
==========================================

Convert DB primary keys and related foreign keys type from INT to BIGINT in a Laravel project.

This package is particularly useful for old projects that need to be updated.

Indeed, since Laravel 5.8 the ID columns are by default of type BIGINT. If you install new packages that use this new "standard" you will have trouble creating the foreign keys.

As a result, this package will transform all the primary keys of type INT into BIGINT.
It will also update the relationships on these keys.

It proceeds in 4 steps:

- introspection of the database and verification of the integrity of foreign keys (if an integrity is not respected it stops and indicates it to you)
- droping all foreign key constraints on each table
- converting INT to BIGINT on primary and foreign key columns on each table
- restoring all foreign key constraints on each table

Instalation
-----------

Install the package with Composer:

```sh
composer require axn/laravel-pk-int-to-bigint
```

Usage
-----

Create a dump of your data in case there is a problem.

Run the command:

```sh
php artisan pk-int-to-bigint:transform
```
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axn/laravel-pk-int-to-bigint",
"description": "Convert DB primary keys and related foreign keys type from INT to BIGINT.",
"description": "Convert DB primary keys and related foreign keys type from INT to BIGINT in a Laravel project",
"homepage": "https://github.com/AXN-Informatique/laravel-pk-int-to-bigint",
"support": {
"issues": "https://github.com/AXN-Informatique/laravel-pk-int-to-bigint/issues"
Expand Down
2 changes: 1 addition & 1 deletion src/Console/TransformCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TransformCommand extends Command
{
protected $signature = 'pk-int-to-bigint:transform';

protected $description = 'Convert DB primary keys and related foreign keys type from INT to BIGINT';
protected $description = 'Convert DB primary keys and related foreign keys type from INT to BIGINT in a Laravel project';

protected $transformer;

Expand Down

0 comments on commit 195689b

Please sign in to comment.