Files
thetool/db/migrations/20240822153505_create_mailtemplate.php
2024-09-17 18:18:38 +02:00

54 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class CreateMailtemplate extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Mailtemplate");
$table->addColumn("is_include", "integer", ["null" => false, "default" => 0, "limit" => Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
$table->addColumn("name", "string", ["null" => false, "limit" => 255]);
$table->addColumn("code", "string", ["null" => false, "limit" => 64]);
$table->addColumn("description", "string", ["null" => true, "default" => null, "limit" => 1024]);
$table->addColumn("subject", "string", ["null" => true, "default" => null, "limit" => 255]);
$table->addColumn("body_text", "text", ["null" => true, "default" => null]);
$table->addColumn("body_html", "text", ["null" => true, "default" => null]);
$table->addColumn("note", "text", ["null" => true, "default" => null]);
$table->addColumn("create_by", "integer", ["null" => false]);
$table->addColumn("edit_by", "integer", ["null" => false]);
$table->addColumn("create", "integer", ["null" => false]);
$table->addColumn("edit", "integer", ["null" => false]);
$table->create();
$tfile = $this->table("MailtemplateFile");
$tfile->addColumn("mailtemplate_id", "integer", ["null" => false]);
$tfile->addColumn("file_id", "integer", ["null" => false]);
$tfile->addColumn("filename", "string", ["null" => false]);
$tfile->addColumn("create_by", "integer", ["null" => false]);
$tfile->addColumn("edit_by", "integer", ["null" => false]);
$tfile->addColumn("create", "integer", ["null" => false]);
$tfile->addColumn("edit", "integer", ["null" => false]);
$tfile->create();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("MailtemplateFile")->drop()->save();
$this->table("Mailtemplate")->drop()->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}