Giter VIP home page Giter VIP logo

mysql-helper-yii2's Introduction

mysql-helper-yii2

基于yii2的mysql维护类

Latest Stable Version Total Downloads

基本要求

  • yii 2.x
  • PHP版本为7.x

安装

  • 直接在根目录执行下方composer命令
composer require jcbowen/mysql-helper-yii2

使用

  • 获取库名称

    @param $dsn 如果为空,则读取配置中的dsn

Jcbowen\MysqlHelperYii2\MysqlHelperYii2::getDbName(?string $dsn = '');
  • 获取表名称
Jcbowen\MysqlHelperYii2\MysqlHelperYii2::tableName($tableName);
  • 获取表结构
Jcbowen\MysqlHelperYii2\MysqlHelperYii2::getTableSchema($tableName);
  • 创建修复两张差异表的语句

    @param array $schema1 表结构,需要修复的表 @param array $schema2 表结构,基准表 @param bool $strict 使用严格模式, 严格模式将会把表1完全变成表2的结构, 否则将只处理表2种大于表1的内容(多出的字段和索引)

Jcbowen\MysqlHelperYii2\MysqlHelperYii2::makeFixSql(array $schema1, array $schema2, bool $strict = false);

注意

  • 已有字段如果之前被设置为了NULL,后续在设置基准表的时候,一定不要设置为NOT NULL,否则会报错

mysql-helper-yii2's People

Contributors

jcbowen avatar

Watchers

 avatar

Forkers

lpzl636

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.