zend-db icon indicating copy to clipboard operation
zend-db copied to clipboard

DDL improves

Open vitaliimelnychuk opened this issue 8 years ago • 2 comments

Hello, guys I want to add column with options such as AUTO INCREMENT and unsigned. How it do? Finally I've created follow class and add Constraint

`class AutoIncrement extends AbstractConstraint

{ /** * @var string */ protected $specification = 'AUTO_INCREMENT'; }`

Which is better way for creating table with DDL abstraction?

vitaliimelnychuk avatar Apr 25 '17 21:04 vitaliimelnychuk

MySQL DDL already supports auto_increment keyword.

$column->setOption('AUTO_INCREMENT', true);

In general, current API adds column options not by extending constraints, but adding it to a list of keywords for syntax generator in appropriate engine decorator, eg https://github.com/zendframework/zend-db/blob/405e301f877e1b34ccdf5ed71294949000789a40/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php#L105

alextech avatar Apr 25 '17 21:04 alextech

This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at https://github.com/laminas/laminas-db/issues/73.

michalbundyra avatar Jan 16 '20 19:01 michalbundyra