views:

71

answers:

1

In brief, what happens when you add a column to a table? What happens when you remove one?

In more details, suppose you have the following:

class User extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->hasColumn('username', 'string', 255);
        $this->hasColumn('password', 'string', 255);
    }
}

What happens when you add the following line to the setTableDefinition function?

$this->hasColumn('firstname', 'string', 255);

What happens when you delete the following line from the setTableDefinition function?

$this->hasColumn('password', 'string', 255);
+2  A: 

You'd want to have a look at Doctrine migrations that allows you to

The Doctrine migration package allows you to easily update your production databases through a nice programmatic interface. The changes are done in a way so that your database is versioned and you can walk backwards and forwards through the database versions.

That will allow you to perform changes to your database without screwing up your data.

phidah
Just what I was looking for. Thank you.
Mario Awad