-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
193 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
return [ | ||
'paths' => [ | ||
'migrations' => getenv('PHINX_CONFIG_DIR') . 'tests/_data/assets/db/migrations', | ||
'seeds' => getenv('PHINX_CONFIG_DIR') . 'tests/_data/assets/db/seeds', | ||
], | ||
'environments' => [ | ||
'default_migration_table' => 'phinxlog', | ||
'default_database' => 'mysql', | ||
'mysql' => [ | ||
'adapter' => 'mysql', | ||
'host' => getenv('DATA_MYSQL_HOST'), | ||
'name' => 'gonano', | ||
'user' => getenv('DATA_MYSQL_USER'), | ||
'pass' => getenv('DATA_MYSQL_PASS'), | ||
'port' => 3306, | ||
'charset' => 'utf8', | ||
], | ||
'postgres' => [ | ||
'adapter' => 'pgsql', | ||
'host' => getenv('DATA_POSTGRES_HOST'), | ||
'name' => 'gonano', | ||
'user' => getenv('DATA_POSTGRES_USER'), | ||
'pass' => getenv('DATA_POSTGRES_PASS'), | ||
// 'port' => 3306, | ||
'charset' => 'utf8', | ||
], | ||
'sqlite' => [ | ||
'adapter' => 'sqlite', | ||
'name' => getenv('PHINX_CONFIG_DIR') . 'tests/_data/assets/db/phalcon', | ||
'suffix' => '.db', | ||
], | ||
], | ||
'version_order' => 'creation', | ||
]; |
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
63 changes: 63 additions & 0 deletions
63
tests/_data/assets/db/migrations/20190511001045_add_employees_table.php
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,63 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class AddEmployeesTable extends AbstractMigration | ||
{ | ||
public function up() | ||
{ | ||
$table = $this->table( | ||
'co_employees', | ||
[ | ||
'id' => 'empId', | ||
'signed' => false, | ||
] | ||
); | ||
$table | ||
->addColumn( | ||
'empNameFirst', | ||
'string', | ||
[ | ||
'limit' => 64, | ||
'null' => false, | ||
'default' => '', | ||
] | ||
) | ||
->addColumn( | ||
'empNameLast', | ||
'string', | ||
[ | ||
'limit' => 128, | ||
'null' => false, | ||
'default' => '', | ||
] | ||
) | ||
->addColumn( | ||
'empCreatedDate', | ||
'datetime', | ||
[ | ||
'null' => true, | ||
] | ||
) | ||
->addColumn( | ||
'empCreatedEmpId', | ||
'integer', | ||
[ | ||
'limit' => 11, | ||
'null' => false, | ||
'signed' => false, | ||
'default' => 0, | ||
] | ||
) | ||
->addIndex('empNameFirst') | ||
->addIndex('empNameLast') | ||
->addIndex('empCreatedDate') | ||
->addIndex('empCreatedEmpId') | ||
->save(); | ||
} | ||
|
||
public function down() | ||
{ | ||
$this->table('co_employees')->drop()->save(); | ||
} | ||
} |
Binary file not shown.
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,34 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Phalcon Framework. | ||
* | ||
* (c) Phalcon Team <team@phalconphp.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Phalcon\Test\Models; | ||
|
||
use Phalcon\Mvc\Model; | ||
|
||
/** | ||
* Class Employees | ||
* | ||
* @package Phalcon\Test\Models | ||
* | ||
* @property int $empId; | ||
* @property string $empNameFirst; | ||
* @property string $empNameLast; | ||
* @property string $empCreatedDate; | ||
* @property int $empCreatedEmpId; | ||
*/ | ||
class Employees extends Model | ||
{ | ||
|
||
public function initialize() | ||
{ | ||
$this->setSource("co_employees"); | ||
} | ||
} |
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