colopl/laravel-tidb 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

colopl/laravel-tidb

最新稳定版本:v5.0.0

Composer 安装命令:

composer require colopl/laravel-tidb

包简介

Laravel database driver for PingCAP TiDB

README 文档

README

Laravel database driver for TiDB

Requirements

  • PHP >= 8.0
  • Laravel 11
  • TiDB >= 7.0

Installation

Install via composer

composer require colopl/laravel-tidb

That's all. You can use database connection as usual.

Features

  • Added autoRandom($shard_bits = null) to ColumnDefinition
  • When user defines $table->id() in the migration file, it will add PRIMARY KEY AUTO_RANDOM to the schema instead of PRIMARY KEY AUTO_INCREMENT so that data gets distributed evenly.
  • Added Support for nested transactions (MySQL driver will throw an exception)
  • Added Support for adding/dropping multiple columns (MySQL driver will throw an exception)

Unsupported features

  1. Nesting transactions and then rolling them back will always rollback to the first transaction since SAVEPOINT is not supported by TiDB. In other words, rolling back with $connection->rollBack() will always rollback level to 0.
  2. Adding and dropping multiple columns atomically is not fully supported. Defining multiple columns in migrations is supported but will be executed one by one and will not be atomic. Ex: $table->dropColumn('title', 'content')

For unsupported features for TiDB itself, please see MySQL Compatibility.

Testing

You can run tests on docker by the following command.

make test

License

Apache 2.0 - See LICENSE for more information.

统计信息

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

GitHub 信息

  • Stars: 25
  • Watchers: 8
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2021-12-03