PHPackages                             toramanlis/laravel-implicit-migrations - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. toramanlis/laravel-implicit-migrations

ActiveLibrary[Database &amp; ORM](/categories/database)

toramanlis/laravel-implicit-migrations
======================================

This package is a tool that creates Laravel migration files by inspecting the application's models.

v1.0.4(3mo ago)39281MITPHPCI passing

Since Sep 5Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/toramanlis/laravel-implicit-migrations)[ Packagist](https://packagist.org/packages/toramanlis/laravel-implicit-migrations)[ Patreon](https://www.patreon.com/toramanlis)[ RSS](/packages/toramanlis-laravel-implicit-migrations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (14)Used By (0)

[![codecov](https://camo.githubusercontent.com/d66f631ffaaa5a429bedce5e86229f8debd1d209d0a5ab1763768450c4f3a02a/68747470733a2f2f636f6465636f762e696f2f67682f746f72616d616e6c69732f6c61726176656c2d696d706c696369742d6d6967726174696f6e732f67726170682f62616467652e7376673f746f6b656e3d42483556424e49574d49)](https://codecov.io/gh/toramanlis/laravel-implicit-migrations)[![Latest Version on Packagist](https://camo.githubusercontent.com/7a84b9f0aeb3a5c9fe0ab668fc195b7571f6ecf68648d966c586be172ce5b89b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f72616d616e6c69732f6c61726176656c2d696d706c696369742d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/toramanlis/laravel-implicit-migrations)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/39ef99976ba485726ffcf7f8dbb65fe70462670f823ebe3f40a53f2755380e0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f72616d616e6c69732f6c61726176656c2d696d706c696369742d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/toramanlis/laravel-implicit-migrations)

[![Laravel Implicit Migrations](https://repository-images.githubusercontent.com/853000736/e44bfe61-b6ff-46cb-87f8-0c5b67e6c438)](https://repository-images.githubusercontent.com/853000736/e44bfe61-b6ff-46cb-87f8-0c5b67e6c438)

- [Overview](#overview)
    - [What It Is](#what-it-is)
    - [How It Works](#how-it-works)
        - [Implications](#implications)
            - [Annotations](#annotations)
            - [PHP Attributes](#php-attributes)
        - [Updates](#updates)
- [Installation](#installation)
    - [Publishing The Attributes](#publishing-the-attributes)
    - [Opting Out From Attributes](#opting-out-from-attributes)
    - [Installing To Production](#installing-to-production)
- [Configuration](#configuration)
    - [`database.model_paths`](#databasemodel_paths)
    - [`database.auto_infer_migrations`](#databaseauto_infer_migrations)
    - [`database.implications.`](#databaseimplicationsimplication_name_in_snake_case)
- [Manual Migrations](#manual-migrations)
- [Implication Reference](#implication-reference)
    - [`Table`](#table)
    - [`Column`](#column)
    - [`Binary`](#binary)
    - [`Char`](#char)
    - [`CString`](#cstring "`String` is a reserved word in PHP")
    - [`Integer`](#integer)
    - [`TinyInteger`](#tinyinteger)
    - [`SmallInteger`](#smallinteger)
    - [`MedumInteger`](#mediuminteger)
    - [`BigInteger`](#biginteger)
    - [`Increments`](#increments)
    - [`TinyIncrements`](#tinyincrements)
    - [`SmallIncrements`](#smallincrements)
    - [`MedumIncrements`](#mediumincrements)
    - [`CFloat`](#cfloat "`Float` is a reserved word in PHP")
    - [`Decimal`](#decimal)
    - [`DateTime`](#datetime)
    - [`DateTimeTz`](#datetimetz)
    - [`Time`](#time)
    - [`TimeTz`](#timetz)
    - [`Timestamp`](#timestamp)
    - [`TimestampTz`](#timestamptz)
    - [`Enum`](#enum)
    - [`Set`](#set)
    - [`Geometry`](#geometry)
    - [`Geography`](#geography)
    - [`Computed`](#computed)
    - [`Index`](#index)
    - [`Unique`](#unique)
    - [`Primary`](#primary)
    - [`Relationship`](#relationship)
    - [`ForeignKey`](#foreignkey)
    - [`PivotTable`](#pivottable)
    - [`PivotColumn`](#pivotcolumn)
    - [`Off`](#off)

Overview
========

[](#overview)

What It Is
----------

[](#what-it-is)

This package is a tool that creates Laravel migration files by inspecting the application's models with the command `php artisan implicit-migrations:generate`. Even after you change the model classes, you can run the command and generate a migration with the necessary update operations.

How It Works
------------

[](#how-it-works)

With the most basic configuration, the `implicit-migrations:generate` artisan command looks at a Eloquent model and finds necessary information about the table properties such as the table name, primary key etc. Then it goes over the properties of the model and collects the name, type and default value information if provided. With the information collected, it creates a migration file and populates the `up()` and `down()` methods with the appropriate definitions.

### Implications

[](#implications)

For further details, the generator refers to some additional data in the model class which we call "Implications". These can be specified with either annotations or attributes on the class, its properties and methods.

#### Annotations

[](#annotations)

Annotations in DocBlocks with the format `@()` are recognized and interpreted as implications. For example, an annotation like this tells the generator that this integer property corresponds to an `UNSIGNED` `INT` column named `product_id` in the `order_items` table:

```
