-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to create a migration based on database
- Loading branch information
Showing
8 changed files
with
295 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use Rougin\Refinery\Migration; | ||
|
||
class Migration_create_users_table extends Migration | ||
{ | ||
/** | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$data = array('id' => array()); | ||
$data['id']['type'] = 'integer'; | ||
$data['id']['auto_increment'] = true; | ||
$data['id']['constraint'] = 10; | ||
$this->dbforge->add_field($data); | ||
$this->dbforge->add_key('id', true); | ||
|
||
$data = array('name' => array()); | ||
$data['name']['type'] = 'varchar'; | ||
$data['name']['auto_increment'] = false; | ||
$data['name']['constraint'] = 100; | ||
$data['name']['default'] = null; | ||
$data['name']['null'] = true; | ||
$data['name']['unsigned'] = false; | ||
$this->dbforge->add_field($data); | ||
|
||
$this->dbforge->create_table('users'); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
$this->dbforge->drop_table('users'); | ||
} | ||
} |
Oops, something went wrong.