This repository has been archived by the owner on Jan 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
scripts.php
66 lines (59 loc) · 1.42 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
return [
/*
* Installation hook
*
*/
'install' => function( $app ) {
$util = $app[ 'db' ]->getUtility();
if ( $util->tableExists( '@assets_asset' ) === false ) {
$util->createTable(
'@assets_asset',
function( $table ) {
$table->addColumn(
'id',
'integer',
[
'unsigned' => true,
'length' => 10,
'autoincrement' => true
]
);
$table->addColumn( 'status', 'smallint' );
$table->addColumn( 'slug', 'string', [ 'length' => 255 ] );
$table->addColumn( 'title', 'string', [ 'length' => 255 ] );
$table->addColumn( 'nodes', 'simple_array', [ 'notnull' => false ] );
$table->addColumn( 'data', 'json_array', [ 'notnull' => false ] );
$table->addColumn( 'date', 'datetime', [ 'notnull' => false ] );
$table->addColumn( 'modified', 'datetime' );
$table->setPrimaryKey( [ 'id' ] );
$table->addUniqueIndex( [ 'slug' ], '@ASSETS_SLUG' );
}
);
}
},
/*
* Enable hook
*
*/
'enable' => function( $app ) {
},
/*
* Uninstall hook
*
*/
'uninstall' => function( $app ) {
// remove the tables
$util = $app[ 'db' ]->getUtility();
if ( $util->tableExists( '@assets_asset' ) ) {
$util->dropTable( '@assets_asset' );
}
// remove the config
$app[ 'config' ]->remove( 'spqr/assets' );
},
/*
* Runs all updates that are newer than the current version.
*
*/
'updates' => [],
];