ucan-lab/laravel-dacapo

Laravel migration support tools

4.0.6 2021-01-26 17:52 UTC

README

Build Status Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License

Introduction

Dacapo is a Laravel migration file creation support library. Define the table structure in the schema yml file, Always generate the latest and tidy migration file.

This library is intended for use only in the coding phase. In the operation phase, uninstall and return to normal migration operation.

Installation

$ composer require --dev ucan-lab/laravel-dacapo

Usage

Generate default schema.yml

$ php artisan dacapo:init

database/schemas/default.yml By default, a schema file for Laravel8 is generated.

users:
  columns:
    id: bigIncrements
    name: string
    email:
      type: string
      unique: true
    email_verified_at:
      type: timestamp
      nullable: true
    password: string
    rememberToken: true
    timestamps: true

password_resets:
  columns:
    email:
      type: string
      index: true
    token: string
    created_at:
      type: timestamp
      nullable: true

failed_jobs:
  columns:
    id: true
    uuid:
      type: string
      unique: true
    connection: text
    queue: text
    payload: longText
    exception: longText
    failed_at:
      type: timestamp
      useCurrent: true

Generate migration files

$ php artisan dacapo

3 files are generated and migrate fresh.

  • 1970_01_01_000001_create_failed_jobs_table.php
  • 1970_01_01_000001_create_password_resets_table.php
  • 1970_01_01_000001_create_users_table.php