Skip to content

shankarThiyagaraajan/PHP_Migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Migration

Simple PHP package for Database Migration, with zero dependancy.

Packagist Release Wordpresss License

For Wordpress Migration

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'
            ]
           ]
          ];

For Core PHP

  $my_table_schema = [
        'student' => [
            'student_id' => 'integer',
            'name' => 'string',
            'class' => 'string',
            'dob'  => 'data',
            'age' => 'integer'
        ],
        'class' => [
            'class_id' => 'integer',
            'student_id' => 'integer',
            'section' => 'string'
        ]
     ];

Finally


$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.

License

MIT License © Shankar Thiyagaraajan

About

Simple and Effective migration for Wordpress and Core php

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages