AndrewSimm
Well-known member
I still need to figure out why upgrades are not working :/
is it because your trying to create the table again so the whole thing just fails?I still need to figure out why upgrades are not working :/
Alright, if you uninstall the add-on and the reinstall then notes should work. I clearly am doing something wrong with creating the table on upgrades but it should work fine on new installs. If you uninstall and reinstall then you will need to redo permissions and options.
public function upgrade1010070Step1()
{
$sm = $this->schemaManager();
$sm->alterTable('xf_ozzmodz_spaminator_log', function (Alter $table)
{
$table->addColumn('url', 'VARCHAR', 2500)->setDefault('')->after('email1');
});
}
public function upgrade1020070Step1()
{
$sm = $this->schemaManager();
$sm->alterTable('xf_andrew_mp_user_note', function (Alter $table)
{
$table->addColumn('note_id', 'int')->autoIncrement();
$table->addColumn('note_user_id', 'int')->nullable(true)->setDefault(null);
});
}
<?php
namespace Andrew\ModeratorPanel;
use XF\AddOn\AbstractSetup;
use XF\AddOn\StepRunnerInstallTrait;
use XF\AddOn\StepRunnerUninstallTrait;
use XF\AddOn\StepRunnerUpgradeTrait;
use XF\Db\Schema\Create;
class Setup extends AbstractSetup
{
use StepRunnerInstallTrait;
use StepRunnerUpgradeTrait;
use StepRunnerUninstallTrait;
public function installStep1()
{
$this->schemaManager()->createTable('xf_andrew_mp_user_note', function(Create $table)
{
$table->addColumn('note_id', 'int')->autoIncrement();
$table->addColumn('note_user_id', 'int')->nullable(true)->setDefault(null);
$table->addColumn('user_id', 'int')->nullable(true)->setDefault(null);
$table->addColumn('username','varchar', 250)->nullable(true)->setDefault(null);
$table->addColumn('create_date', 'int',10)->nullable(true)->setDefault(\XF::$time);
$table->addColumn('message', 'mediumtext')->nullable(true)->setDefault(null);
$table->addPrimaryKey('note_id');
});
}
public function upgrade1030070Step1()
{
$sm = $this->schemaManager();
$sm->alterTable('xf_andrew_mp_user_note', function (Alter $table)
{
$table->addColumn('note_id', 'int')->autoIncrement();
$table->addColumn('note_user_id', 'int')->nullable(true)->setDefault(null);
$table->addPrimaryKey('note_id');
});
}
public function uninstallStep1()
{
$this->schemaManager()->dropTable('xf_andrew_mp_user_note');
}
}
- FIXED: Missing upgrade step to create table for user notes
So in your case, if you update the addon to 1.3.0 the setup file would be this:
Thanks, you nailed it. I just uploaded a fixed version. I really appreciate the help.PHP:<?php namespace Andrew\ModeratorPanel; use XF\AddOn\AbstractSetup; use XF\AddOn\StepRunnerInstallTrait; use XF\AddOn\StepRunnerUninstallTrait; use XF\AddOn\StepRunnerUpgradeTrait; use XF\Db\Schema\Create; class Setup extends AbstractSetup { use StepRunnerInstallTrait; use StepRunnerUpgradeTrait; use StepRunnerUninstallTrait; public function installStep1() { $this->schemaManager()->createTable('xf_andrew_mp_user_note', function(Create $table) { $table->addColumn('note_id', 'int')->autoIncrement(); $table->addColumn('note_user_id', 'int')->nullable(true)->setDefault(null); $table->addColumn('user_id', 'int')->nullable(true)->setDefault(null); $table->addColumn('username','varchar', 250)->nullable(true)->setDefault(null); $table->addColumn('create_date', 'int',10)->nullable(true)->setDefault(\XF::$time); $table->addColumn('message', 'mediumtext')->nullable(true)->setDefault(null); $table->addPrimaryKey('note_id'); }); } public function upgrade1030070Step1() { $sm = $this->schemaManager(); $sm->alterTable('xf_andrew_mp_user_note', function (Alter $table) { $table->addColumn('note_id', 'int')->autoIncrement(); $table->addColumn('note_user_id', 'int')->nullable(true)->setDefault(null); $table->addPrimaryKey('note_id'); }); } public function uninstallStep1() { $this->schemaManager()->dropTable('xf_andrew_mp_user_note'); } }
Assuming that is the only two new columns.
Thanks, you nailed it. I just uploaded a fixed version. I really appreciate the help.
Thanks, you nailed it. I just uploaded a fixed version. I really appreciate the help.
Yes, I changed it to 1.2.2.Did you change the version for the update? I had the above code set for 1.3.0
public function upgrade1020270Step1()
{
$sm = $this->schemaManager();
$sm->CreateTable('xf_andrew_mp_user_note', function (Create $table)
{
$table->addColumn('note_id', 'int')->autoIncrement();
$table->addColumn('note_user_id', 'int')->nullable(true)->setDefault(null);
$table->addColumn('user_id', 'int')->nullable(true)->setDefault(null);
$table->addColumn('username','varchar', 250)->nullable(true)->setDefault(null);
$table->addColumn('create_date', 'int',10)->nullable(true)->setDefault(\XF::$time);
$table->addColumn('message', 'mediumtext')->nullable(true)->setDefault(null);
$table->addPrimaryKey('note_id');
});
}
What version of XF are you using?I am getting this error when trying to install:
Line 120: Unknown tag profilebanner encountered. - Template name: public:andrew_moderatorpanel_user_view
v2.1.10 Patch 2What version of XF are you using?
You need to be running 2.2. XF introduced profile banners in 2.2 so that tag is not recognizable by 2.1.x versions.v2.1.10 Patch 2
Is there a way to skip it?You need to be running 2.2. XF introduced profile banners in 2.2 so that tag is not recognizable by 2.1.x versions.
<xf:profilebanner user="$user" size="l" class="memberHeader-main" toggle="memberHeader--withBanner">
I am not seeing that template.Try removing:
Code:<xf:profilebanner user="$user" size="l" class="memberHeader-main" toggle="memberHeader--withBanner">
From:
andrew_moderatorpanel_user_view
We use essential cookies to make this site work, and optional cookies to enhance your experience.