Giter Site home page Giter Site logo

mankowitz / laravel-pk-int-to-bigint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from axn-informatique/laravel-pk-int-to-bigint

0.0 0.0 0.0 26 KB

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

License: MIT License

PHP 100.00%

laravel-pk-int-to-bigint's Introduction

Laravel convert primary keys INT to BIGINT

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

This is especially 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 be of great help to you to modernize an old application.

It proceeds in 4 steps:

  1. 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)
  2. droping all foreign key constraints on each table
  3. converting INT to BIGINT on primary and foreign key columns on each table
  4. restoring all foreign key constraints on each table

Instalation

Install the package with Composer:

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

Usage

First create a dump of your database in case there is a problem.

Manualy

If you want to run the command directly:

php artisan pk-int-to-bigint:transform

With migration

Pusblish the migration:

php artisan vendor:publish --tag="pk-int-to-bigint-migration"

So you can incorporate it into your deployment workflow with:

php artisan migrate

laravel-pk-int-to-bigint's People

Contributors

forxer avatar godismyjudge95 avatar lgtaxn avatar mankowitz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.