This repository has been archived by the owner on Aug 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.php
53 lines (44 loc) · 1.63 KB
/
Setup.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
<?php
namespace Kieran\Roster;
use XF\Db\Schema\Create;
class Setup extends \XF\AddOn\AbstractSetup
{
use \XF\AddOn\StepRunnerInstallTrait;
use \XF\AddOn\StepRunnerUninstallTrait;
// php cmd.php xf-addon:install Kieran/Roster
// php cmd.php xf-addon:build-release Kieran/Roster
public function installStep1(array $stepParams = [])
{
$this->schemaManager()->createTable('xf_kieran_roster_row', function(Create $table)
{
$table->addColumn('row_id', 'int')->autoIncrement();
$table->addColumn('enabled', 'int')->setDefault(0);
$table->addColumn('description', 'text');
$table->addColumn('parent_id', 'int')->setDefault(0);
$table->addColumn('group_id', 'varbinary', 255);
$table->addColumn('title', 'varchar', 255);
$table->addColumn('sort_order', 'int', 11)->setDefault(1);
$table->addColumn('row', 'int', 11)->setDefault(1);
$table->addColumn('image', 'varchar', 255);
$table->addPrimaryKey('row_id');
$table->addUniqueKey(['row_id'], 'row_id');
});
$this->schemaManager()->createTable('xf_kieran_roster_title', function(Create $table)
{
$table->addColumn('title_id', 'int')->autoIncrement();
$table->addColumn('row_id', 'int')->setDefault(0);
$table->addColumn('user_id', 'int');
$table->addColumn('title', 'varchar', 255)->setDefault('');
$table->addPrimaryKey('title_id');
$table->addUniqueKey(['title_id', 'row_id'], 'title_id_row_id');
});
}
public function upgrade(array $stepParams = [])
{
}
public function uninstallStep1(array $stepParams = [])
{
$this->schemaManager()->dropTable('xf_kieran_roster_row');
$this->schemaManager()->dropTable('xf_kieran_roster_title');
}
}