This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.2 » How to make a change on the database?
How to make a change on the database? [message #101774] Tue, 29 June 2010 15:57 Go to next message
xare  is currently offline xare
Messages: 14
Registered: June 2010
Junior Member
Hi have just taken over a project another programmer started which is online. This project runs on symfony 1.2.11

In order to develop it further I need to perform changes on the Database tables by adding columns and make new tables.

I have understood by reading the jobeet tutorial what is the process of creating a database and adding data to it using symfony.

This process consists basically of six steps:
1. Write down the structure on config/schema.yml
2. Generate the sql statements
php symfony propel:Build --sql
3. Create the tables into the DB
php symfony propel:insert-sql
4. Generate the model
php symfony propel:build --model
or better
php symfony propel:build -all
5. Create data files at /data/fixtures.
6. Run
php symfony propel:data load

This process is very good to start a project but what is much more scary is to perform a change on the data base, build or update the models and be able to retrieve data after that model has been created.

The database has grown so much that even if we make backups we pretend to make such changes and make sure everything goes all right avoiding as much as we can to delete the data or regenerate it.

I want to ask if this process would be the correct one.
1. Go to the database and add a column on the desired table
2. Run php symfony propel:build --model and php symfony propel:build --forms in order to update the model and form files related to the table where the change has been performed

I do not want to run any order that would change or alter the data that is already inside the database.

Is my strategy appropriate? Am I missing something?

Thanks so much for your help in advance.

xare
Re: How to make a change on the database? [message #101783 is a reply to message #101774 ] Tue, 29 June 2010 18:03 Go to previous messageGo to next message
DBA_Alex  is currently offline DBA_Alex
Messages: 257
Registered: July 2008
Location: North Carolina, USA
Faithful Member
That's the way to do it. Just make sure you also update your schema file before you build your model, forms, and filters.

Building the classes does not modify the database in any way - just updates your project to handle the new database setup. Make sure that you modify the database as well - otherwise problems may occur.

Good luck Smile


Currently Using
---------------------------
Symfony 1.4/Doctrine 1.2
MySQL 5.1
Re: How to make a change on the database? [message #101823 is a reply to message #101783 ] Wed, 30 June 2010 08:49 Go to previous messageGo to next message
xare  is currently offline xare
Messages: 14
Registered: June 2010
Junior Member
I have a question.

Is there a way to create schema.yml from the database structure?

I have a huge DB with nearly 60 tables and the schema.yml is not updated so I have to either write it down from 0 or there is a way to create it from the database structure?

Thanks
Re: How to make a change on the database? [message #101828 is a reply to message #101823 ] Wed, 30 June 2010 09:11 Go to previous message
xare  is currently offline xare
Messages: 14
Registered: June 2010
Junior Member
OK I have found the solution

by running php symfony propel:build-schema I got my schema.yml updated.

Now another one, the php symfony propel:build --model on the 1st run it creates the base model files and also the empty ones for customisations. I imagine that now it will not replace them.
Previous Topic:Doctrine issue: 'There are no tasks defined in the "doctrine" namespace'
Next Topic:call or Share a partial from 2 applications.
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software