DB Migration 1.0.0
2023-12-21
576次浏览
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
- auth client
- view
- html
- bootstrap
- release
- redis
- apidoc
- Yii 2.0
- Yii 1.1
- mongodb
- mailer
- extensions
- twig
- gii
- queue
- runner
- http 客户端
- console
- validation
- cache
- sphinx
- widget
- hydrator
- translator
- error handler
- db
- http
- symfonymailer
- log
- config
- swiftmailer
- 图书
- imagine
- i18n
- IDE
- assets
- csrf
- swagger
- elasticsearch
- router
- smarty
- definitions
- logging
- fastroute
- user