PHP MySQL migration tool - php

I have a migration tool that I'm supposed to use, but the old programmer never left any documentation on how to use it and we are unable to contact him.
This is the tool here:
https://github.com/davesloan/mysql-php-migrations
I have a MySQL database set up with Joomla for both locally and on the server. What I need to do is migrate the new MySQL local files to the server(We are using github for pushing and pulling.)
Anyone know how I can do so with this tool? I fiddled with the command line a bit but never got any results.
Thank you.

I'd recommend using a different tool, where you have documentation, otherwise it's going to be tough deconstructing this.
I built a migrations tool that would work perfectly for what you need:
http://andrefigueira.github.io/Schematic/
It will map existing databases into the configuration files (schema files) and then can be used for future modifications, and these schema files are designed to be committed to your VCS and It's very simple to use.

You may try LazyRecord https://github.com/c9s/LazyRecord
LazyRecord integrates full featured PHP-based schema and the related migration features.
The most powerful feature is - automatic migration, which is similar to UIKit's lightweight database migration.
here are some screencasts:

Related

Feasibility of using Laravel compared to Codeigniter

I have been developing in Codeigniter for awhile now. I have recently read that Laravel is currently the most modern and best framework. I am interested in learning it for my next project. I'm hoping that someone could help to answer some questions that I have about Laravel.
1) How would I host it? Laravel seems to rely on composer a lot and that requires a terminal. For CI, I just download a folder and load it up to my Webserver and I can run it.
2) Dev environment. I have been using Netbeans that is connected to my server and it can push updates instantly. I want to connect it to git soon for some versioning as well. Is it the same for Laravel? How would I update it?
Same here, I have been developing Applications in Codeigniter 2,3 for past 5 years and now I am learning Laravel and have starting making beginners level application in Laravel Here are my findings which might help you
Difficulties
For Codeigniter Developer, Instantly playing everything by using router is kind of difficult. Although router is used in codeigniter as well
Installing and setting up Laravel seems like a tricky and very lengthy job especially the use of composer which is an extra thing as compared to codeigniter which is just download and uncompress or copy paste installation procedure.
But Why Laravel?
Object Relation Modeling - Eloquent ORM
We can easily create relations and joins with query builder or active records in codeigniter but to enforce referential integrity in database, we have to write triggers in our database or define relations. Luckily in Laravel the relations are made with one line of code and does a lot of job. Whereas in Codeigniter that's a lot of manual code writing.
Integration of off the self Packages.
There are thousands of developed packages readily available on packagist, which is a repository composer uses to download software packages. You just have to write one or two lines of code at composer terminal and it does all the rest, create models, controllers, views. All you have to do is include them or change the styling as per your layouts.
Think of Laravel as a PHP framework for extremely lazy developers who want to write very less and re-usable code and do lot of work from it.
Learning Resources
Laravel 5.2 from Scratch that's the one I started with, excellent course and Modern Web Development with Laravel
Uploading on Shared hosting
Click here for tutorial

Laravel and Database Design

I asked this question on Reddit, but received no answer. I thought I would try here, instead.
I am new to Laravel, and have been going over the documentation and also watching Jeffrey Way's NetTuts videos. However I haven't gotten in too deep just yet, so if this is answered clearly somewhere else, please just point me in that direction.
I come from a CodeIgniter background, and for all projects I have done with it, I typically design my databases in MySQL Workbench. I also use this to make changes to the schema, and also as a visual map of the database. The MySQL Workbench file generally gets passed around with the other developers via Git.
Laravel seems to want you to create your tables using migrations, which seems a bit counter intuitive coming from the MySQL Workbench side. I understand that migrations act as a version control for the database, which seems pretty nice. However, other than that, I don't quite get the point just yet.
Can anyone explain to me why I should be building the tables out via the migrations feature of Laravel vs. the way I've been doing it?
Laravel is a PHP framework. Like other frameworks, such as Zend, your development to deployment timeframe will be significantly reduced, as well as developing within a framework that can be understood by other developers as your projects becomes larger and you need more developers involved in the future.
Migrations, as part of Laravel, are designed to quickly and easily setup a database scheme without the need to type any MySQL. It also presents the schema correctly. As your schema exists within a file, you can easily rollback and transport your schema with ease.
Well, this is a valid concern. While Laravel doesn't specifically force you to use it, I can think of a few reasons for its implementation:
Compatibility. It works with almost any database. If you ever decide to change from MySQL to PostgreSQL, there's very little to change.
Version control. As you mentioned yourself, it allows you to have control over what's changed in your database, and provides quick and easy way to update your already running database.
Easy of use. It's incredibly easy to call it through the command line. Meaning you won't have any problems creating your database on the server side, through a shell.
The main reason Laravel has migrations is because version control. When you create a migration the name has a date attached to it. I use Laravel myself and I absolutely love migrations. Teamed up with the Schema builder it makes my life so much easier not using ancient MySQL methods. Here's some examples of the Schema and migration
Simple Command To Create A New Migration File:
php artisan migrate:make create_users_table
Inside The Users Table Migration File:
Schema::create('users', function($table){
$table->increments('id'); [will create a increments field with name of ID]
$table->string('username'); [string field with name of username]
$table->string('password'); [password is a special field]
$table->text('body'); [string field with name of username]
});
At the bottom all you need to add is this:
Schema::drop('users');
Then you run the migrate command:
php artisan migrate
It will add all the columns to the table.
if you ever want to take back or add to the database all you need to do is run this
php artisan migrate:rollback
[you can add specific commands here to only rollback certain tables]

PHP Database Deployment git/capistrano

I'm working for a company which is using PHP. There are different CMS Systems being used like Wordpress or Magento.
We are working with git having our own repository server and we have to deploy to different servers our different customers.
I've set up a deploymentscript using capistrano which works fine but the Database Synchronisation is quite tricky.
Imagine the live-database contains user data and I have to create some new features after the site already launched and there are loads of sql data within the database already. I personally work with a dummy database since I don't need any customer information.
How are you PHP geeks are deploying your databases? I don't want to change the contents but only migrate new or modified tables. I'm looking for a complete deployment solution for that. I'm also open for other options besides capistrano if needed. Especially with Magento I had serious problems to keep my database sync..
Any help is appreciated.
Recently I have discovered this project: http://dbv.vizuina.com/, but I don't have used it, otherwise Symfony has a similar feature called migrations and it works very well.

What php frameworks have database migration support?

I'm looking for a good php framework with support for handling database migrations. Ideally I would like to be able to run a command that generates a migration script, one that updates the database with changes and can handle rolling back those changes. Is there anything out there that does this?
The Doctrine project supports migrations - http://www.doctrine-project.org/projects/migrations/2.0/docs/reference/introduction/en
Hmm, that documentation is a bit lacking, at least in the introduction. Hopefully it gets better as it goes on.
Whilst most popular in Symfony, this can easily be integrated into other frameworks or even used on its own.
Promising, but not yet have a stable version : https://github.com/fuel/fuel
There is a new php framework called Laravel and it has migrations the same way as ruby on rails. It seems so pretty!
You can find it at http://laravel.com/
Migrations Docs
In addition, the framework introduces the idea of bundles, what can give to your project a great modular view.
If you try it, tell us your experience! :)
symfony - http://www.symfony-project.org/
In symfony you can write database schema using ORM like Propel, it is independant from database driver. If you have a database already, you want to migrate to a different db, I think you can dump the db, change the db config, and re-import it to the new db. (though I have not tried it myself.)
There are much php framework over there that can use any database. For example Zend, Ci, Cake and many others. One thing you should do is change database type that's usually stored in configuration file. And then migrate your database manually. No framework that can generate migration script automatically. U can also use ESF for database migration

Data import and migrate using Doctrine

I need to load data from an old DB into a migrated schema of this DB using Doctrine migration system.
I guess Doctrine might help me in this process.
I tried and lost a few hours using ETL scripts programs, without success.
From my point of view I need to :
Create a DB with the V0 schema
Load the data from the old DB (schema are identical)
Migrate DB to latest version using Doctrine migration
Extract data
Load it in the new DB
WHat do you think of this process?
Do you think it is feasable using Doctrine?
I tried a few searches on Google without success.
I am currently reviewed the features of Doctrine_Core class.
Thanks for your help
Yes, it is possible to migrate data from one database to another using Doctrine.
It sounds like you're trying to do a one-time database revision and migration and that your applications are not currently written using Doctrine. In that scenario, database abstraction has little or no benefit, unless you're also rewriting the applications to use it.
If you have no prior experience using Doctrine then I seriously doubt that writing custom migration classes in it will be easier than doing it with whatever database API you are already experienced using. It makes sense to use the migration classes (some times) if you are already using Doctrine for your development. Otherwise it's another layer and API you don't need.
I'm using Doctrine 1.2, which has some nice features for migrations but also a number of bugs and omissions of expected functionality. Reportedly version 2 improves on this but I haven't used it yet.

Categories