Welcome Guest, Not a member yet? Register   Sign In
Craftsman - Interactive CLI
#4

Craftsman now supports HMVC Environments with a new feature: 'Modular Migrations'.

Modular Migrations: manage your database scheme's evolution through independent versions of your components.

Example:

Suppose we have our application directory:

Code:
+- APPPATH/
| +- migrations/
| | +- 001_add_blog.php
| | +- 002_add_posts.php

And an application library uses a database scheme (like Ion Auth, etc). This migrations reside in:

Code:
+- APPPATH
| +- libraries/
| | +- XLib/
| | | +- migrations
| | | | +- 001_add_session.php
| | | | +- 002_add_other_stuff.php

If you're familiar with the Codeigniter Migration Class, it is imposible to maintain separated migration version files in your application, you need to merge these files in one directory and fix the migration file name.

With Craftsman you can run the command:

Code:
php vendor/bin/craftsman migration:latest --path="application/libraries/XLib"

And that's all, your migrations are now independent.

In your database you can see that every component have a version assigned:

Code:
mysql> SELECT * FROM ci_migrations;

+---------------+---------+
| module        | version |
+---------------+---------+
| ci_system     |       2 |
| xlib          |       2 |
+---------------+---------+

Also you can change the component name stored in the database with the '--name' option:

Code:
php vendor/bin/craftsman migration:latest --name="foo" --path="application/libraries/XLib"
Reply


Messages In This Thread
Craftsman - Interactive CLI - by dsv - 08-18-2015, 03:34 AM
RE: Craftsman CLI - by dsv - 04-07-2016, 09:16 AM
RE: Craftsman CLI - by dsv - 07-09-2016, 11:00 AM
RE: Craftsman CLI - by dsv - 12-08-2016, 04:52 PM
RE: Craftsman - Interactive CLI - by dsv - 01-09-2017, 10:51 AM
RE: Craftsman - Interactive CLI - by abmcr - 02-05-2017, 10:08 AM
RE: Craftsman - Interactive CLI - by dsv - 02-20-2017, 02:08 PM
RE: Craftsman - Interactive CLI - by cvetan - 04-03-2018, 03:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB