sporz

PHP implementation of the board game "sporz"
git clone https://0x1A4.1337.cx/code2/sporz.git
Log | Files | Refs

commit d3244fe7037fc9313883f68ae3ff13aeda1e1c23
parent b33d7b1f99924c0fee33a0c3e7c8f105ffd06789
Author: git <git@shroomrider.com>
Date:   Mon Nov 21 14:45:00 +0100

add Action table

Diffstat:
db/migrations/20161121133613_add_action_table.php | 40++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)
diff --git a/db/migrations/20161121133613_add_action_table.php b/db/migrations/20161121133613_add_action_table.php @@ -0,0 +1,40 @@ +<?php + +use Phinx\Migration\AbstractMigration; + +class AddActionTable extends AbstractMigration +{ + /** + * Change Method. + * + * Write your reversible migrations using this method. + * + * More information on writing migrations is available here: + * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class + * + * The following commands can be used in this method and Phinx will + * automatically reverse them when rolling back: + * + * createTable + * renameTable + * addColumn + * renameColumn + * addIndex + * addForeignKey + * + * Remember to call "create()" or "update()" and NOT "save()" when working + * with the Table class. + */ + public function change() + { + $actions = $this->table('action'); + $actions->addColumn('player_id', 'integer', array('signed'=>false, 'null'=>false)); + $actions->addForeignKey('player_id', 'player', 'id', array('delete'=> 'RESTRICT', 'update'=> 'NO_ACTION')); + $actions->addColumn('turn', 'integer', array('signed'=>false, 'null'=>false)); + $actions->addColumn('type_action', 'string', array('limit'=>20)); + $actions->addColumn('target_id', 'integer', array('signed'=>false)); + $actions->addForeignKey('target_id', 'player', 'id', array('delete'=> 'RESTRICT', 'update'=> 'NO_ACTION')); + $actions->addColumn('confirmed', 'integer', array('signed'=>false,'null'=>false,'default'=>0)); + $actions->create(); + } +}