我将Zend Famework 3与Doctrine DBAL一起使用,并且我想使用BIT(64)字段。 我可以看到以下支持的类型: https://www.doctrine-project.org/api/dbal/2.7/Doctrine/DBAL/Types/Type.html 是否可以使用BIT字段类型扩展它:https://dev.mysql.com/doc/refman/8.0/en/bit-type.html?
我需要使用权限掩码之类的东西。
这是简单的代码:
namespace Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
class Version1 extends AbstractMigration {
/**
* Upgrades the schema to its newer state.
* @param Schema $schema
*/
public function up(Schema $schema) {
$table = $schema->createTable('user');
$table->addColumn('id', 'integer', ['autoincrement' => true, 'unsigned' => true]);
$table->addColumn('bitmask', 'bit??', []);
$table->setPrimaryKey(['id']);
$table->addOption('engine', 'InnoDB');
}
}
答案 0 :(得分:0)
我创建了普通的BIGINT(20)UNSIGNED字段,并在php中将其用作BIT值,并且一切正常。