DB Migration 1.0.0
2023-12-21
843次浏览
First stable version of DB Migration package was realeased.
It allows you to manage database schema using migrations.
Supports the following databases out of the box:
- MSSQL of versions 2017, 2019, 2022.
- MySQL of versions 5.7–8.0.
- MariaDB of versions 10.4–10.9.
- Oracle of versions 12c–21c.
- PostgreSQL of versions 9.6–15.
- SQLite of version 3.3 and above.
- You can use it in Yii applications, Symfony console or as a standalone utility.
Migrations itself are written with IDE-friendly query builder:
<?php
declare(strict_types=1);
namespace App\Migrations;
use Yiisoft\Db\Migration\MigrationBuilder;
use Yiisoft\Db\Migration\RevertibleMigrationInterface;
final class M231219204516Test implements RevertibleMigrationInterface
{
public function up(MigrationBuilder $b): void
{
$b->createTable('test', [
'id' => $b->primaryKey(),
'name' => $b->string(255)->notNull(),
'email' => $b->string(255)->notNull(),
'status' => $b->integer()->notNull()->defaultValue(10),
'created_at' => $b->dateTime()->notNull(),
'updated_at' => $b->dateTime()->notNull(),
]);
}
public function down(MigrationBuilder $b): void
{
$b->dropTable('test');
}
}
新闻归档
热门标签
- yii3
- 扩展
- 发布
- yii2
- debug
- view
- auth client
- html
- bootstrap
- release
- apidoc
- Yii 1.1
- mongodb
- redis
- Yii 2.0
- runner
- extensions
- mailer
- validation
- gii
- console
- http 客户端
- queue
- twig
- error handler
- http
- hydrator
- translator
- cache
- widget
- sphinx
- config
- symfonymailer
- log
- assets
- db
- router
- swiftmailer
- swagger
- 图书
- elasticsearch
- imagine
- fastroute
- rbac
- i18n
- IDE
- widgets
- definitions
- user
- csrf