Magento 2 available install schema columns type
1. Type boolean
TYPE_BOOLEAN = ‘boolean’;
Boolean: These types are synonyms for TINYINT(1). A value of zero is considered false. Non-zero values are considered true.
Example
addColumn('post_id',Table::TYPE_BOOLEAN,null,[ 'identity' => false, 'nullable' => false, 'primary' => true ],'Post ID')
2. Type smallint
TYPE_SMALLINT = ‘smallint’;
Example
addColumn('post_id',Table::TYPE_SMALLINT,null,[ 'nullable' => false],'Post ID')
3. Type integer
TYPE_INTEGER = ‘integer’;
Example
addColumn('post_id',Table::TYPE_INTEGER,null,['nullable' => false],'Post ID')
4. Type bigint
TYPE_BIGINT = ‘bigint’;
Example
addColumn('post_id',Table::TYPE_BIGINT,null,[ 'nullable' => false],'Post ID')
5. Type float
TYPE_FLOAT = ‘float’;
Example
addColumn('post_id',Table::TYPE_FLOAT,null,[ 'nullable' => false],'Post ID')
6. Type numeric
TYPE_NUMERIC = ‘numeric’;
Example
addColumn('post_id',Table::TYPE_NUMERIC,null,[ 'nullable' => false],'Post ID')
7. Type decimal
TYPE_DECIMAL = ‘decimal’;
Example
addColumn('post_id',Table::TYPE_DECIMAL,null,[ 'nullable' => false],'Post ID')
8. Type date
TYPE_DATE = ‘date’;
Example
addColumn('data',Table::TYPE_DATE,null,[ 'nullable' => false],'Post ID')
9. Type timestamp
TYPE_TIMESTAMP = ‘timestamp’;
Example
->addColumn('creation_time',Table::TYPE_TIMESTAMP,null,['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT],'Creation Time')
10. Type datetime
Capable to support date-time from 1970 + auto-triggers in some RDBMS
TYPE_DATETIME = ‘datetime’;
Example
addColumn('data',Table::TYPE_DATETIME,null,[ 'nullable' => false ],'Post ID')
11. Type text
Capable to support long date-time before 1970
TYPE_TEXT = ‘text’;
Example
addColumn('data',Table::TYPE_TEXT,255,[ 'nullable' => false],'Post ID')
12. Type blob
TYPE_BLOB = ‘blob’;
Example
addColumn('data',Table::TYPE_BLOB ,null,[ 'nullable' => false],'Post ID')
13. Type varbinary
Used for back compatibility, when query param can’t use statement options
TYPE_VARBINARY = ‘varbinary’;
Example
addColumn('data',Table::TYPE_VARBINARY,null,[ 'nullable' => false],'Post ID')
That’s all.
- 1 Magento ver. 2.2.0-dev - A technical prob... 16579
- 2 ECS git pull 代码很慢的问题 14713
- 3 玩客云监工客户端 13205
- 4 Magento 2 UI Form Validation 13122
- 5 Codeigniter SSL 强制重定向至https访问 13006
- 6 magento2 完整卸载模块的正确姿势 12640
- 7 Magento fix 500 12280
- 8 Magento index is locked by another reinde... 10738
- 9 Ubuntu删除日志文件 9012
- 10 Magento 2安装ElasticSearch 6.x搜索引擎-Ub... 8621