-
Notifications
You must be signed in to change notification settings - Fork 6
/
addSchema.php
45 lines (36 loc) · 1.75 KB
/
addSchema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
use Magento\Framework\DB\Ddl\Table;
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$installer = $this->_objectManager->create('\Magento\Setup\Module\Setup');
$installer->startSetup();
$table = $installer->getConnection()
->newTable($installer->getTable('magepow_comments'))
->addColumn(
'comment_id',
Table::TYPE_INTEGER,
null,
['identity' => true, 'nullable' => false, 'primary' => true],
'Comment ID'
)
->addColumn('title', Table::TYPE_TEXT, 255, ['nullable' => true, 'default' => null], 'Title')
->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')
->addColumn('store', Table::TYPE_TEXT, 255, ['nullable' => true, 'default' => '0'])
->addColumn('created_time', Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => Table::TIMESTAMP_INIT], 'Created Time')
->addColumn('update_time', Table::TYPE_DATETIME, null, ['nullable' => true, 'default' => null], 'Update Time')
->addIndex($installer->getIdxName('comment_id', ['comment_id']), ['comment_id'])
->setComment('Magepow Comments');
$installer->getConnection()->createTable($table);
$installer->endSetup();
echo 'Done!';
//the method must end with this line
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);