Skip to content

Commit

Permalink
Fix rename column names
Browse files Browse the repository at this point in the history
  • Loading branch information
s-nakajima committed May 1, 2015
1 parent af87833 commit 37043f3
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bbses CakeMigration
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Kotaro Hokada <kotaro.hokada@gmail.com>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
Expand All @@ -12,7 +12,7 @@
/**
* Bbses CakeMigration
*
* @author Kotaro Hokada <kotaro.hokada@gmail.com>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\Bbses\Config\Migration
*/
class RenameIsCommentAutoApproval extends CakeMigration {
Expand All @@ -31,20 +31,26 @@ class RenameIsCommentAutoApproval extends CakeMigration {
*/
public $migration = array(
'up' => array(
'create_table' => array(),
'alter_field' => array(
'create_table' => array(
),
'create_field' => array(
'bbs_settings' => array(
'use_comment' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use comments, 0:Unused 1:Use | コメント機能 0:使わない 1:使う | | '),
'is_comment_auto_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use comments auto approval, 0:Unused 1:Use | コメントの承認機能 0:使わない 1:使う | | '),
'is_comment_auto_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments approval, 0:Unused 1:Use | コメントの承認機能 0:使わない 1:使う | | ', 'after' => 'use_comment'),
),
),
'drop_field' => array(
'bbs_settings' => array('use_comment_approval'),
),
),
'down' => array(
'drop_table' => array(),
'alter_field' => array(
'drop_table' => array(
),
'drop_field' => array(
'bbs_settings' => array('is_comment_auto_approval'),
),
'create_field' => array(
'bbs_settings' => array(
'use_comment' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments, 0:Unused 1:Use | コメント機能 0:使わない 1:使う | | '),
'is_comment_auto_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments approval, 0:Unused 1:Use | コメントの承認機能 0:使わない 1:使う | | '),
'use_comment_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments approval, 0:Unused 1:Use | コメントの承認機能 0:使わない 1:使う | | '),
),
),
),
Expand Down
78 changes: 78 additions & 0 deletions Config/Migration/1430476690_rename_use_workflow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/**
* Bbses CakeMigration
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/

/**
* Bbses CakeMigration
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\Bbses\Config\Migration
*/
class RenameUseWorkflow extends CakeMigration {

/**
* Migration description
*
* @var string
*/
public $description = 'rename_use_workflow';

/**
* Actions to be performed
*
* @var array $migration
*/
public $migration = array(
'up' => array(
'create_table' => array(
),
'create_field' => array(
'bbs_settings' => array(
'use_workflow' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of the post approval, 0:Unused 1:Use | 記事の承認機能 0:使わない 1:使う | | ', 'after' => 'bbs_key'),
),
),
'drop_field' => array(
'bbs_settings' => array('use_post_approval'),
),
),
'down' => array(
'drop_table' => array(
),
'drop_field' => array(
'bbs_settings' => array('use_workflow'),
),
'create_field' => array(
'bbs_settings' => array(
'use_post_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of the post approval, 0:Unused 1:Use | 記事の承認機能 0:使わない 1:使う | | '),
),
),
),
);

/**
* 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;
}
}
2 changes: 1 addition & 1 deletion Config/Schema/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function after($event = array()) {
public $bbs_settings = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary', 'comment' => 'ID | | | '),
'bbs_key' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'comment' => 'bbs key | 掲示板キー | Hash値 | ', 'charset' => 'utf8'),
'use_workflow' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use workflow, 0:Unused 1:Use | 記事の承認機能 0:使わない 1:使う | | '),
'use_workflow' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of the post approval, 0:Unused 1:Use | 記事の承認機能 0:使わない 1:使う | | '),
'use_comment' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments, 0:Unused 1:Use | コメント機能 0:使わない 1:使う | | '),
'is_comment_auto_approval' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of comments approval, 0:Unused 1:Use | コメントの承認機能 0:使わない 1:使う | | '),
'use_like' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'comment' => 'Use of like button, 0:Unused 1:Use | 高い評価ボタンの使用 0:使わない 1:使う | | '),
Expand Down

0 comments on commit 37043f3

Please sign in to comment.