定制 ucan-lab/laravel-dacapo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ucan-lab/laravel-dacapo

最新稳定版本:5.2.0

Composer 安装命令:

composer require ucan-lab/laravel-dacapo

包简介

Laravel migration support tools

README 文档

README

Build Status Latest Stable Version Total Downloads Daily Downloads 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:
    name: string
    email:
      type: string
      unique:
    email_verified_at:
      type: timestamp
      nullable:
    password: string
    rememberToken:
    timestamps:

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

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

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

Dacapo Option

# Execute migrate and seeding
$ php artisan dacapo --seed
# Do not execute migrate
$ php artisan dacapo --no-migrate

Schema file format

  • {} any value
  • database/schemas/*.yml
  • If it cannot be expressed in YAML, it can be used together with standard migration.
    • php artisan make:migration
# COMMENT
{TableName}:
  columns:
    {ColumnName}: {ColumnType}
    {ColumnName}:
      type: {ColumnType}
    {ColumnName}:
      unique: true
      nullable: true
      default: {DefaultValue}
      comment: {ColumnName}
      {ColumnModifier}: {ColumnModifierValue}
  indexes:
    - columns: {ColumnName}
      type: {IndexType}
    - columns: [{ColumnName}, {ColumnName}]
      type: {IndexType}
    - columns: {ColumnName}
      type: {IndexType}
      name: {IndexName}
  foreign_keys:
    - columns: {ColumnName}
      references: {ReferenceColumnName}
      table: {ReferenceTableName}
    - columns: {ColumnName}
      references: {ReferenceColumnName}
      table: {ReferenceTableName}
      onUpdateAction: {ConstraintProperty}
      onDeleteAction: {ConstraintProperty}
    - columns: [{ColumnName}, {ColumnName}]
      references: [{ReferenceColumnName}, {ReferenceColumnName}]
      table: {ReferenceTableName}

{TableName}:
  columns:
    {ColumnName}: {ColumnType}

Dacapo Clear Migrations

$ php artisan dacapo:clear
$ php artisan dacapo:clear --all
  • --all Delete including standard migration files.

Dacapo Stub publish

$ php artisan dacapo:stub:publish

Dacapo Uninstall

$ php artisan dacapo:uninstall
$ composer remove --dev ucan-lab/laravel-dacapo

统计信息

  • 总下载量: 314.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 112
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 112
  • Watchers: 1
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-05