From c26d32826b2af32aed0d282d9fd752391e23adfa Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Mon, 26 Aug 2024 15:18:09 +0200 Subject: [PATCH] update mailtemplate migration --- .../20240822153505_create_mailtemplate.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/db/migrations/20240822153505_create_mailtemplate.php b/db/migrations/20240822153505_create_mailtemplate.php index ef5d08a52..17385ff7b 100644 --- a/db/migrations/20240822153505_create_mailtemplate.php +++ b/db/migrations/20240822153505_create_mailtemplate.php @@ -9,17 +9,29 @@ final class CreateMailtemplate extends AbstractMigration { if($this->getEnvironment() == "thetool") { $table = $this->table("Mailtemplate"); + $table->addColumn("is_include", "int", ["null" => false, "default" => 0, "limit" => Phinx\Db\Adapter\MysqlAdapter::INT_TINY]); $table->addColumn("name", "string", ["null" => false, "limit" => 255]); - $table->addColumn("description", "string", ["null" => true, "default" => true, "limit" => 1024]); + $table->addColumn("code", "string", ["null" => false, "limit" => 64]); + $table->addColumn("description", "string", ["null" => true, "default" => null, "limit" => 1024]); $table->addColumn("subject", "string", ["null" => false, "limit" => 255]); - $table->addColumn("body", "text", ["null" => false]); - $table->addColumn("note", "text", ["null" => false]); + $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") { @@ -30,6 +42,7 @@ final class CreateMailtemplate extends AbstractMigration public function down(): void { if($this->getEnvironment() == "thetool") { + $this->table("MailtemplateFile")->drop()->save(); $this->table("Mailtemplate")->drop()->save(); }