News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Registering Doctrine Type Mappings for standalone migrations
November 18, 2014 @ 10:50:47

In a previous post Rob Allen showed you how to use Doctrine migrations as a standalone tool in your applications. In this new post he takes that a step further and shows you how to use the type mapping functionality (allowing for more customized column handling).

Shortly after starting to use Doctrine Migrations as a standalone tool in my project, I came across this error message [about an unknown database type "bit"]. This means that I have a column in my database of type bit which is used for booleans in SQL Server, but confuses the MySQL platform as it's not a default mapping. To support this, you need to modify the database connection's Platform object to know about the new mapping. However, with the setup that I'm using, I didn't have access to the connection object that's automatically created in the Migrations AbstractCommand object. After poking around in the code for a bit, I discovered that the solution is to create the connection object myself and then attach it as a new helper to the ConsoleApplication object.

He includes the code you'll need to add to your "migrations.php" file to set up the mapping relating his "bit" type example back to a "boolean" type. While this specific example is for the "bit" mapping, it shows how any mapping type can be added in. Finally he adds the connection (the one he set the type on) to enable it to be included in the helper set collection.

0 comments voice your opinion now!
register type migration doctrine database tutorial custom mapping

Link: http://akrabat.com/php/registering-doctrine-type-mappings-for-standalone-migrations/

Rob Allen:
Using Doctrine Migrations as a standalone tool
November 13, 2014 @ 10:14:56

Rob Allen has a recent post to his site showing you how you can use Doctrine migrations as a standalone tool for its migrations functionality. Migrations allow you to script the setup of your database, replacing the need to manually create and configure the system by hand.

My current project has reached the point where a good migrations system is required. As I'm targeting two different database engines (MySQL and MS SQL Server) and we're already using DBAL, it made sense to use Migrations from the Doctrine project.

He walks you through the installation (via Composer and a command-line script to bootstrap the Doctrine environment outside of the usual framework context. He includes an example yaml configuration file and PHP-based connection information config. He finishes off the post by showing how to build a simple migration that creates an "artists" table (with "name" and "id" columns) and run the command to do the work.

0 comments voice your opinion now!
migration standalone tool doctrine tutorial commandline

Link: http://akrabat.com/php/using-doctrine-migrations-outside-of-doctrine-orm-or-symfony/

SitePoint PHP Blog:
Database Versioning with Ladder Migrations
April 22, 2014 @ 10:48:41

The SitePoint PHP blog has posted another tutorial looking at database versioning (see this postfocusing on Ladder migrations. Ladder is a simple PHP-based way to write migrations with rollbacks in a clear, easy to read format.

Version control systems are invaluable for tracking changes in your code, particularly when you're working in a team. However, most applications don't consist solely of application code. Managing changes to the database has always been a little more challenging, particularly when you're adding new features which require changes to the schema. [...] One solution is to move responsibility for creating and modifying the database schema into code, using migrations. That way, changes can be managed along with the rest of your application, and features we take for granted in version control - such as being able to compare versions and keep an audit trail - can be used for database changes.

He introduces the Ladder tool briefly, shows how to get it installed/configured and gets into writing a first simple migration. It creates a "users" table with two columns and comes with both "up" and "down" methods to make rollbacks easier. Ladder also provides functionality for database seeding, pre-populating the database tables with sample data either from hard-coded values or from a CVS file.

0 comments voice your opinion now!
database migration ladder versioning tutorial project

Link: http://www.sitepoint.com/database-versioning-ladder-migrations

PHP.net:
PHP 5.6.0alpha2 released
February 14, 2014 @ 10:22:48

The second alpha (not for use in production) of the PHP 5.6.x series has been officially announced on the main PHP.net site today.

The PHP development team announces the immediate availability of PHP 5.6.0alpha2. This release adds new features and fixes bugs. All users of PHP are encouraged to test this version carefully, and report any bugs in the bug tracking system. [...] PHP 5.6.0alpha2 comes with a number of new features, including: peer certificates are now verified by default when connecting to SSL/TLS servers, an exponentiation operator has been added: **, and output encoding handling [that] has been simplified by using default_charset as the default character encoding.

If you're looking for more information about what's involved in migrating up to this version, check out the upgrade guide or for just the full list of change take a look at the NEWS file. You can download this alpha release from the PHP QA site (Windows binaries here).

0 comments voice your opinion now!
php56 alpha2 release migration guide news download language

Link: http://php.net/index.php#id2014-02-13-1

Etsy Code as Craft:
There and Back Again Migrating Geolocation Data to GeoNames
April 01, 2013 @ 11:48:36

On the Etsy "Code as Craft" blog there's a recent post about their move to using the GeoNames service internally rather than the external, third-party API previously in use.

People are passionate about where they live. At Etsy we need to keep track of lots of different locations, such as buyers' billing and shipping addresses and sellers' shop locations. As Etsy continues to expand internationally we wanted to provide better localization and translations for our location place names. We determined that the best way to effect this change was to move from using a closed location API provider to internal services backed by the open GeoNames data set.

The post details some of the steps in the process including the mapping of the current data to the new structure (the script is available on github). They talk about how they mapped their old data over (trial and error sometimes) and the creation of a database of "GeoNameIDs" for each customer in their records. They've also implemented a Lucene/Solr search for improved searching and auto-suggestion based on the user's location.

0 comments voice your opinion now!
data migration geonames geolocation api script


Zend Framework Blog:
Zend Framework 1 is Migrating to Git!
March 28, 2013 @ 09:29:23

The Zend Framework project has announced a major move for the framework's development - the Zend Framework v1 repositories will be moving from Subversion to Git over the next year or so.

Since its inception, Zend Framework 1 has used Subversion for versioning. However, as we approach its end-of-life (which will occur 12-18 months from the time this post is written), and as our experience with ZF2 processes becomes more familiar, we -- the Zend team and the Community Review team -- feel that we can better support ZF1 via GitHub. As such, we will be migrating the ZF1 Subversion repository to GitHub this week. Please read on for details!

The post details the steps that'll be taken during the process including the changing of the location of the "master" branch (and how to change svn to point to it) and the updates to the integration of the Dojo libraries. They also talk some about the "extras" repository and how things will work with the Issue Tracker and pull requests in the future.

The repository and issues migration is the first step in a series of planned migrations. We also plan to eventually migrate our wiki to GitHub; this will allow us to offload functionality from the main ZF website, and also consolidate all development-related functionality (other than the mailing list) in a central location.
0 comments voice your opinion now!
zendframework1 git migration subversion github


PHPMaster.com:
PHPFog is Coming to an End - But Don't Panic!
November 27, 2012 @ 09:40:57

If you're a PHPFog user, you know that they're discontinuing the service in favor of their AppFog product. If you're looking to migrate over to this from PHPFog, you should check out this new article from PHPMaster.com with some of the differences between the two services.

Have you heard PHPFog is coming to an end? No, well - it is. That's right, in a recent announcement on their mailing list, the company has said that PHPFog will be no more by the end of January, 2013. But if you're on their platform, don't panic! The new, combined platform may be even better than what you're accustomed to with them now.

He talks about some of the things that are different including the technologies it employs, addons it provides, the differing deployment process and when teh final cut-off date is. He links to their own migration guide for most of the steps but mentions one specific change that might trip you up - the change to store connection information in the "VCAP_SERVICES" environment variable.

0 comments voice your opinion now!
phpfog appfog migration differences guide database


Rob Morgan:
Getting Started With Phinx
October 18, 2012 @ 12:30:49

Rob Morgan has a recent post showing you how to use Phinx, a PHP-based database migration tool, to handle your database changes (both "up" and "down").

Earlier this year I decided to open-source one of my personal software projects - Phinx. Phinx is a database migration tool (think Ruby on Rails ActiveRecord migrations) where can you describe all of your database transformations in pure PHP. I have used this tool for many of my consulting projects, however it still took a lot of effort to turn it into a re-usable product. In this tutorial I'm going to explain how to install Phinx and use it with a simple guestbook application.

He uses a sample guestbook project for his example, showing how to get it all installed and how to create a migration that adds a "posts" table.

0 comments voice your opinion now!
phinx database migration tutorial introduction guestbook


PHPMaster.com:
Artisan and Laravel Migrations
August 28, 2012 @ 08:38:08

PHPMaster.com has continued their series about the Laravel framework today with this new tutorial they show you how to use the command line tool Artisan to work with database migrations.

For those who struggle with maintaining their database schema, or who have problems applying updates and often revert them, there is a solution. Laravel, the MVC framework which I wrote about previously, offers you migrations.

On the surface, the migrations are simple sets of "up" and "down" methods that allow you to apply and remove the changes required for the migration. It also allows you to perform a "rollback" on the updates just made and a "reset" to clear out all changes and start over from the base. There's also a shortcut to help generate migration code from a configuration string.

0 comments voice your opinion now!
laravel migration framework database tutorial


Stefan Koopmanschap:
Data migration with Doctrine2
July 25, 2012 @ 08:18:32

In this latest post to his site Stefan Koopmanschap shares a solution he's found to migrating data with Doctrine2 from an existing structure.

A project that I'm working on right now required me to migrate data from the existing database to the new database and database structure. Since the application is built on top of Symfony2, I decided to write a Command that would take care of the migration. I ran into an issue though: Doctrine2 insisted on creating new IDs where I wanted to keep the old one. The solution turned out to be really simple.

The actual code for the Command is only a few lines long - it just turns off the "AUTO" strategy for each of your entities, making it ignore any IDs you have set on the entity already.

0 comments voice your opinion now!
data migration doctrine2 strategy auto tutorial



Community Events





Don't see your event here?
Let us know!


install interview library update series community version introduction security release symfony voicesoftheelephpant podcast package language tool composer framework opinion laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework