我使用Doctrine和3,我想使用位(64)字段。我可以看到以下超限类型:https://www.doctrine-project.org/api/dbal/2.7/Doctrine/DBAL/Types/Type.html是否可以用位字段类型扩展它: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');
}
}发布于 2018-09-27 17:22:22
我已经创建了普通的BIGINT(20)无符号字段,在php中使用它作为位值,一切都很好。
https://stackoverflow.com/questions/52525602
复制相似问题