This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscripts.php
executable file
·44 lines (42 loc) · 2.13 KB
/
scripts.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
<?php
return [
'enable' => function ($app) {
$util = $app['db']->getUtility();
if( !$util->tableExists('@docs_post') ){
$util->createTable('@docs_post' , function($table){
$table->addColumn('id' , 'integer' , ['autoincrement' => true , 'unsigned' => true , 'length' => 10]);
$table->addColumn('user_id' , 'integer' , ['notnull' => false]);
$table->addColumn('category_id' , 'integer');
$table->addColumn('title' , 'string');
$table->addColumn('slug' , 'string');
$table->addColumn('status' , 'integer');
$table->addColumn('date' , 'datetime');
$table->addColumn('modified' , 'datetime' , ['notnull' => false]);
$table->addColumn('content' , 'text' , ['notnull' => false]);
$table->addColumn('priority' , 'integer' , ['default' => 999]);
$table->addColumn('data' , 'json' , ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['title'] , '@DOCS_POST_TITLE');
$table->addIndex(['slug'] , '@DOCS_POST_SLUG');
});
}
if( !$util->tableExists('@docs_category') ){
$util->createTable('@docs_category' , function($table){
$table->addColumn('id' , 'integer' , ['autoincrement' => true , 'unsigned' => true , 'length' => 10]);
$table->addColumn('title' , 'string');
$table->addColumn('slug' , 'string');
$table->addColumn('status' , 'integer');
$table->addColumn('priority' , 'integer' , ['default' => 999]);
$table->addColumn('roles' , 'simple_array' , ['notnull' => false]);
$table->addColumn('data' , 'json' , ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['title'] , '@DOCS_CATEGORY_TITLE');
$table->addIndex(['slug'] , '@DOCS_CATEGORY_SLUG');
});
}
},
'disable' => function ($app) {
$util = $app['db']->getUtility();
},
'updates' => []
];