2026-05-24 11:53:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace RomhackPlaza\Master;
|
|
|
|
|
|
|
|
|
|
use XF\AddOn\AbstractSetup;
|
|
|
|
|
use XF\AddOn\StepRunnerInstallTrait;
|
|
|
|
|
use XF\AddOn\StepRunnerUninstallTrait;
|
|
|
|
|
use XF\AddOn\StepRunnerUpgradeTrait;
|
2026-06-02 20:54:08 +02:00
|
|
|
use XF\Db\Schema\Create;
|
2026-05-24 11:53:11 +02:00
|
|
|
|
|
|
|
|
class Setup extends AbstractSetup
|
|
|
|
|
{
|
|
|
|
|
use StepRunnerInstallTrait;
|
|
|
|
|
use StepRunnerUpgradeTrait;
|
|
|
|
|
use StepRunnerUninstallTrait;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create Database xf_user new fields.
|
|
|
|
|
*/
|
|
|
|
|
public function installStep1(): void
|
|
|
|
|
{
|
|
|
|
|
$this->schemaManager()->alterTable('xf_user', function (\XF\Db\Schema\Alter $table) {
|
|
|
|
|
$table->addColumn('rhpz_entry_count', 'int')->setDefault(0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-02 20:54:08 +02:00
|
|
|
/**
|
2026-06-08 16:25:52 +02:00
|
|
|
* Create club table.
|
2026-06-02 20:54:08 +02:00
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function installStep2(): void
|
|
|
|
|
{
|
2026-06-08 16:25:52 +02:00
|
|
|
$this->schemaManager()->createTable('xf_club', function(Create $table){
|
|
|
|
|
$table->addColumn('club_id', 'int')->autoIncrement();
|
|
|
|
|
$table->addColumn( 'node_id', 'int' );
|
2026-06-02 20:54:08 +02:00
|
|
|
$table->addColumn('user_id', 'int');
|
|
|
|
|
$table->addColumn('title', 'varchar', 100);
|
|
|
|
|
$table->addColumn('description', 'text');
|
2026-06-08 16:25:52 +02:00
|
|
|
$table->addColumn('club_state', 'enum')->values(['visible','moderated','rejected'])->setDefault('moderated');
|
|
|
|
|
$table->addColumn('club_creation_date','int');
|
|
|
|
|
$table->addColumn('banner_date', 'int')->setDefault(0);
|
|
|
|
|
$table->addPrimaryKey('club_id');
|
|
|
|
|
$table->addKey('club_state');
|
2026-06-02 20:54:08 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-24 11:53:11 +02:00
|
|
|
public function uninstallStep1(): void
|
|
|
|
|
{
|
|
|
|
|
$this->schemaManager()->alterTable('xf_user', function($table) {
|
|
|
|
|
$table->dropColumns(['rhpz_entry_count']);
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-06-02 20:54:08 +02:00
|
|
|
|
|
|
|
|
public function uninstallStep2(): void
|
|
|
|
|
{
|
2026-06-08 16:25:52 +02:00
|
|
|
$this->schemaManager()->dropTable('xf_club');
|
2026-06-02 20:54:08 +02:00
|
|
|
}
|
2026-05-24 11:53:11 +02:00
|
|
|
}
|