PHP code example of iqomp / migrate
1. Go to this page and download the library: Download iqomp/migrate library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iqomp / migrate example snippets
return [
'/ModelClassName/' => [
'fields' => [
'/field-name/' => [
'comment' => '/comment/',
'type' => '/type/',
'attrs' => [
// list of column attrs
],
'index' => '/index/'
]
],
'indexes' => [
'/index-name/' => [
'type' => '/index-type/',
'fields' => [
'/field/' => [ /* option */ ]
// list of columns
],
]
],
'data' => [
'/search-field/' => [
'/search-value/' => [
'/field/' => '/value/'
]
]
]
],
'Company\\Model\\User' => [
'fields' => [
'id' => [
'type' => 'int',
'attrs' => [
'unsigned' => true,
'primary_key' => true,
'auto_increment' => true
],
'index' => 100
],
'name' => [
'type' => 'varchar',
'attrs' => [
'length' => 5,
'null' => false,
'unique' => true
],
'index' => 200
],
'status' => [
'comment' => '0: Deleted, 1: Active',
'type' => 'tinyint',
'attrs' => [
'null' => false,
'default' => 1
],
'index' => 3000
]
],
'indexes' => [
'by_name_status' => [
'fields' => [
'name' => [],
'status' => []
]
]
],
'data' => [
'name' => [
'admin' => [
'name' => 'admin',
'status' => 1
]
]
]
]
];
// ...
public function __invoke()
{
return [
'model' => [
'migrators' => [
'/db-type/' => 'ClassHandler',
'mysql' => 'Vendor\\Module\\Migrator'
]
]
];
}
// ...
json
{
"extra": {
"iqomp": {
"migrate": "iqomp/migrate/config.php"
}
}
}