- Affected version
- 2.0.7
PHP:
$structure->primaryKey = 'title';
$structure->columns = [
'title' => ['type' => self::STR, 'maxLength' => 250,
'censor' => true,
],
'description' => ['type' => self::STR, 'maxLength' => 250,
'nullable' => true,
]
];
Code:
>php cmd.php xf-dev:generate-schema-entity Prefix:Entity
$this->schemaManager()->createTable('table', function(\XF\Db\Schema
\Create $table)
{
$table->addColumn('title', 'varchar', 250);
$table->addColumn('description', 'varchar', 250);
$table->addPrimaryKey('title');
});
Code:
>php cmd.php xf-dev:generate-schema-entity Prefix:Entity
$this->schemaManager()->createTable('table', function(\XF\Db\Schema
\Create $table)
{
$table->addColumn('title', 'varchar', 250);
$table->addColumn('description', 'varchar', 250)->nullable(true);
$table->addPrimaryKey('title');
});