This repository has been archived by the owner on Sep 8, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ash Smith
committed
Aug 16, 2015
1 parent
f8369dd
commit 33061c1
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php namespace Ashsmith\Blog\Setup; | ||
|
||
use Magento\Framework\Setup\InstallSchemaInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
use Magento\Framework\DB\Ddl\Table; | ||
|
||
class InstallSchema implements InstallSchemaInterface | ||
{ | ||
/** | ||
* Installs DB schema for a module | ||
* | ||
* @param SchemaSetupInterface $setup | ||
* @param ModuleContextInterface $context | ||
* @return void | ||
*/ | ||
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$installer = $setup; | ||
|
||
$installer->startSetup(); | ||
|
||
$table = $installer->getConnection() | ||
->newTable($installer->getTable('ashsmith_blog_post')) | ||
->addColumn( | ||
'post_id', | ||
Table::TYPE_SMALLINT, | ||
null, | ||
['identity' => true, 'nullable' => false, 'primary' => true], | ||
'Post ID' | ||
) | ||
->addColumn('url_key', Table::TYPE_TEXT, 100, ['nullable' => true, 'default' => null]) | ||
->addColumn('title', Table::TYPE_TEXT, 255, ['nullable' => false], 'Blog Title') | ||
->addColumn('content', Table::TYPE_TEXT, '2M', [], 'Blog Content') | ||
->addColumn('is_active', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Is Post Active?') | ||
->addColumn('creation_time', Table::TYPE_DATETIME, null, ['nullable' => false], 'Creation Time') | ||
->addColumn('update_time', Table::TYPE_DATETIME, null, ['nullable' => false], 'Update Time') | ||
->addIndex($installer->getIdxName('blog_post', ['url_key']), ['url_key']) | ||
->setComment('Ash Smith Blog Posts'); | ||
|
||
$installer->getConnection()->createTable($table); | ||
|
||
$installer->endSetup(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters