Simple PHP package for Database Migration, with zero dependancy.
include_once('/wordpress/migration.php');
$my_table_schema = [
'student_meta' => [
'id' => [ // Result : "id int(20) auto_increment primary key"
'key' => [
'auto_increment',
'primary key'
],
'type' => 'int',
'limit' => 20
],
'name' => [ // Result : "name varchar(255) unique key"
'key' => [
'unique key'
],
'type' => 'varchar',
'limit' => 255
],
'value' => [ // Result : "value longtext"
'key' => [],
'type' => 'longtext',
'limit' => ''
],
'__table_property' => [ // For Table Properties.
'ENGINE' => 'InnoDB'
]
]
];
$my_table_schema = [
'student' => [
'student_id' => 'integer',
'name' => 'string',
'class' => 'string',
'dob' => 'data',
'age' => 'integer'
],
'class' => [
'class_id' => 'integer',
'student_id' => 'integer',
'section' => 'string'
]
];
$table_schema = "YOUR_TABLE_SCHEMA" ($my_table_schema)
// Trigger Migration.
ST_DATABASE::migrate($table_schema); // It's Generate Formatted MySQL Query and Execute.
It will creates the table Student and Class with given properties.
MIT License © Shankar Thiyagaraajan