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
4 changed files
with
184 additions
and
4 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,56 @@ | |||
<?php | |||
|
|||
/** | |||
* This file is part of the Phalcon Framework. | |||
* | |||
* (c) Phalcon Team <team@phalcon.io> | |||
* | |||
* For the full copyright and license information, please view the LICENSE.md | |||
* file that was distributed with this source code. | |||
*/ | |||
|
|||
namespace Phalcon\Test\Fixtures\Migrations; | |||
|
|||
use Phalcon\Db\Adapter\AdapterInterface; | |||
|
|||
class InvoicesMigration | |||
{ | |||
public function __invoke(AdapterInterface $db) | |||
{ | |||
$sql = <<<SQL | |||
drop table if exists `co_invoices` | |||
SQL; | |||
$db->execute($sql); | |||
|
|||
$sql = <<<SQL | |||
create table co_invoices | |||
( | |||
inv_id int(10) auto_increment primary key, | |||
inv_cst_id int(10) null, | |||
inv_status_flag tinyint(1) null, | |||
inv_title varchar(100) null, | |||
inv_total float(10, 2) null, | |||
inv_created_at datetime null | |||
); | |||
SQL; | |||
$db->execute($sql); | |||
|
|||
$sql = <<<SQL | |||
create index co_invoices_inv_created_at_index | |||
on co_invoices (inv_created_at); | |||
SQL; | |||
$db->execute($sql); | |||
|
|||
$sql = <<<SQL | |||
create index co_invoices_inv_cst_id_index | |||
on co_invoices (inv_cst_id); | |||
SQL; | |||
$db->execute($sql); | |||
|
|||
$sql = <<<SQL | |||
create index co_invoices_inv_status_flag_index | |||
on co_invoices (inv_status_flag); | |||
SQL; | |||
$db->execute($sql); | |||
} | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
<?php | |||
|
|||
/** | |||
* This file is part of the Phalcon Framework. | |||
* | |||
* (c) Phalcon Team <team@phalcon.io> | |||
* | |||
* For the full copyright and license information, please view the LICENSE.md | |||
* file that was distributed with this source code. | |||
*/ | |||
|
|||
namespace Phalcon\Test\Models; | |||
|
|||
use Phalcon\Mvc\Model; | |||
|
|||
class Invoices extends Model | |||
{ | |||
public $inv_id; | |||
public $inv_cst_id; | |||
public $inv_status_flag; | |||
public $inv_title; | |||
public $inv_total; | |||
public $inv_created_at; | |||
|
|||
public function initialize() | |||
{ | |||
$this->setSource('co_invoices'); | |||
} | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
<?php | |||
|
|||
/** | |||
* This file is part of the Phalcon Framework. | |||
* | |||
* (c) Phalcon Team <team@phalcon.io> | |||
* | |||
* For the full copyright and license information, please view the LICENSE.md | |||
* file that was distributed with this source code. | |||
*/ | |||
|
|||
namespace Phalcon\Test\Models; | |||
|
|||
use Phalcon\Mvc\Model; | |||
use function getenv; | |||
|
|||
class InvoicesSchema extends Model | |||
{ | |||
public $inv_id; | |||
public $inv_cst_id; | |||
public $inv_status_flag; | |||
public $inv_title; | |||
public $inv_total; | |||
public $inv_created_at; | |||
|
|||
public function initialize() | |||
{ | |||
$this->setSource('co_invoices'); | |||
$this->setSchema( | |||
getenv('DATA_MYSQL_NAME') | |||
); | |||
} | |||
} |
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