diff --git a/Config/Migration/001_plugin_records.php b/Config/Migration/001_plugin_records.php index ca929e6..1ac1de1 100644 --- a/Config/Migration/001_plugin_records.php +++ b/Config/Migration/001_plugin_records.php @@ -45,6 +45,8 @@ class PluginRecords extends NetCommonsMigration { //日本語 array( 'language_id' => '2', + 'is_origin' => true, + 'is_translation' => true, 'key' => 'bbses', 'namespace' => 'netcommons/bbses', 'name' => '掲示板', @@ -58,6 +60,8 @@ class PluginRecords extends NetCommonsMigration { //英語 array( 'language_id' => '1', + 'is_origin' => false, + 'is_translation' => true, 'key' => 'bbses', 'namespace' => 'netcommons/bbses', 'name' => 'BBS', diff --git a/Config/Migration/1484544861_add_is_original_copy.php b/Config/Migration/1484544861_add_is_original_copy.php new file mode 100644 index 0000000..2683d26 --- /dev/null +++ b/Config/Migration/1484544861_add_is_original_copy.php @@ -0,0 +1,71 @@ + + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +App::uses('NetCommonsMigration', 'NetCommons.Config/Migration'); + +/** + * 多言語化対応 + * + * @author Shohei Nakajima + * @package NetCommons\Bbses\Config\Migration + */ +class AddIsOriginalCopy extends NetCommonsMigration { + +/** + * Migration description + * + * @var string + */ + public $description = 'add_is_original_copy'; + +/** + * Actions to be performed + * + * @var array $migration + */ + public $migration = array( + 'up' => array( + 'create_field' => array( + 'bbs_articles' => array( + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'), + ), + 'bbses' => array( + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する', 'after' => 'is_translation'), + ), + ), + ), + 'down' => array( + 'drop_field' => array( + 'bbs_articles' => array('is_original_copy'), + 'bbses' => array('is_original_copy'), + ), + ), + ); + +/** + * Before migration callback + * + * @param string $direction Direction of migration process (up or down) + * @return bool Should process continue + */ + public function before($direction) { + return true; + } + +/** + * After migration callback + * + * @param string $direction Direction of migration process (up or down) + * @return bool Should process continue + */ + public function after($direction) { + return true; + } +} diff --git a/Config/Schema/schema.php b/Config/Schema/schema.php index 66ae9c5..1f64974 100644 --- a/Config/Schema/schema.php +++ b/Config/Schema/schema.php @@ -86,6 +86,7 @@ public function after($event = array()) { 'is_latest' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '最新コンテンツかどうか 0:最新でない 1:最新'), 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'), 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'), + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'), 'key' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_general_ci', 'comment' => 'キー', 'charset' => 'utf8'), 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'タイトル', 'charset' => 'utf8'), 'title_icon' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), @@ -134,6 +135,7 @@ public function after($event = array()) { 'language_id' => array('type' => 'integer', 'null' => false, 'default' => '2', 'length' => 6, 'unsigned' => false, 'comment' => '言語ID'), 'is_origin' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'オリジナルかどうか'), 'is_translation' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => '翻訳したかどうか'), + 'is_original_copy' => array('type' => 'boolean', 'null' => false, 'default' => '0', 'comment' => 'オリジナルのコピー。言語を新たに追加したときに使用する'), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => '掲示板名称', 'charset' => 'utf8'), 'bbs_article_modified' => array('type' => 'datetime', 'null' => true, 'default' => null, 'comment' => '記事の最終更新日時'), 'created_user' => array('type' => 'integer', 'null' => true, 'default' => '0', 'unsigned' => false, 'comment' => '作成者'),