Re: Database Migrations ala RoR

2007-09-27 Thread gonzoprosperity

I am not sure I understand your question.

But if I think I do, then you want data from one column/table to be
just magically created in another table?

You would have to achieve this by first adding the column and then
executing a SELECT, looping over the data and then issuing an INSERT
(or an UPDATE).

The toolkit has methods for arbitrary query execution, for exactly
these purposes.

For docs, check out

http://code.google.com/p/ruckusing/wiki/MigrationMethods

And scroll to the very bottom and look at Query Execution - Queries
that return results.

/cody

On Sep 24, 12:43 pm, Sonic Baker [EMAIL PROTECTED] wrote:
 hmmm

 I was thinking along the lines of introducing a new association. So a field
 with values in one table may have to be replaced with a foreign key field to
 a new/existing table holding the data previously in the original table. The
 new field in the original table would then have to be filled with id's which
 match the entries in the new table.
 Perhaps this is holy grail type of functionality but I was just checking
 just in case.

 Cheers,

 Sonic


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-24 Thread Sonic Baker
hmmm

I was thinking along the lines of introducing a new association. So a field
with values in one table may have to be replaced with a foreign key field to
a new/existing table holding the data previously in the original table. The
new field in the original table would then have to be filled with id's which
match the entries in the new table.
Perhaps this is holy grail type of functionality but I was just checking
just in case.

Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-18 Thread Grant Cox

I haven't looked at the code, but I would be extremely surprised if
all existing data had to be hosed between schema changes.  I expect
that each schema change is about adding / removing / renaming fields
(and optionally creating / dropping tables) - so unless you specify it
all data will remain.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-18 Thread gonzoprosperity

Existing data is definitely NOT hosed. As Grant Cox points out below,
its really for schema modification. And the only data changes that
might be executed were if you wrote any DROP table / column
statements.

Also, data from an arbitrary DB can be generated via set of INSERT
statements, which in turn is generated by mysqldump (for example, if
MySQL is your DB). Just look at the -t flag to mysqldump which
suppresses the CREATE statements and just emits pure INSERT
statements.

Assuming your table structures have not changed, thats all your data.

/cody

On Sep 17, 10:16 am, Sonic Baker [EMAIL PROTECTED] wrote:
 Hi there,

 On 9/11/07, gonzoprosperity [EMAIL PROTECTED] wrote:



  //populate it with some default data
  $this-execute(INSERT INTO users (...) VALUES (...));

  Does this answer your question?

 I was wondering if, once the new schema is defined, can the data from the
 old structure be imported automatically from the old schema, via any method.
 I guess no is the answer then.
 Thanks for your help.

 Sonic


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-17 Thread Sonic Baker
Hi there,

On 9/11/07, gonzoprosperity [EMAIL PROTECTED] wrote:


 //populate it with some default data
 $this-execute(INSERT INTO users (...) VALUES (...));

 Does this answer your question?


I was wondering if, once the new schema is defined, can the data from the
old structure be imported automatically from the old schema, via any method.
I guess no is the answer then.
Thanks for your help.

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-11 Thread gonzoprosperity

I wasnt sure if there was a built-in migration system. I did see this
one:

http://joelmoss.info/switchboard/blog/1992:Cake_DB_Migrations_strikes_back

But it wasnt clear whether it was part of core or not (by now, or
intended to be).

Thanks for the feedback. Let me try and address your points:

 - cakePHP is php4 and php5 compatible.

Yes, Ruckusing Migrations is built with PHP5 syntax. I guess this is a
show-stopper for CakePHP integration? I dont mean to sound like an
a**hole but I think its time we in the PHP community take a hard stand
and move forward with PHP5. I know this topic has been beating to
death, but still.

 - cakePHP has a console and tasks. So your system needs to be
 integrated into a task and run from the cakephp console.

I am new to CakePHP and didnt know there was a console. Cool. That
being said, I dont think it would be that hard to integrate it into
the console system.

 - cakePHP dislikes any third party libs like PEAR, at least in the
 core. the only exception I've seen is simpleTest and even though, it's
 not required to run the framework.

This isnt any issue. I could easily write my own DB adapter, or just
use the adapter thats part of CakePHP.

 - cakePHP has some conventions ( dates, assoc_id, dependent/
 independent assocs, etc ). your system should be aware of that to make
 life a bit easier.

When you say conventions do you mean coding/style conventions? Your
examples (dates, assoc_id) imply a DB schema convention. My
migrations framework doesnt auto-create migrations (it does generate a
skeleton file), but in terms of column names, thats totally on behalf
of the end-user to name the columns as they see fit. From what I
understand of your comment, this is not an issue which concerns my
framework.

Please correct me if I am wrong. Or point me towards a URL where I can
learn more about this.

 I personally dislike YAML and would prefer PHP to write migrations.

I wasnt sure if this was a concern or not. I, too, am not fond of the
YAML syntax. My framework uses pure PHP (e.g. PHP method calls such as
add_column(), create_table(), etc which is all done via PHP code.
Not a single lick of YAML.

Thanks for your feedback and I will look into the console and adapter
stuff.

/Cody Caughlan

On Sep 10, 6:43 am, CraZyLeGs [EMAIL PROTECTED] wrote:
 Hi,

 I don't think there is a built-in migration system in cakePHP yet. the
 one that is available is written by a cakePHP user.
 means it's not official.

 I heard that john is playing around with migrations in his sandbox, I
 don't know the progress though.
 But back to your framework. For it to be adopted, I think it should
 follow cakePHP' direction:
 - cakePHP is php4 and php5 compatible.
 - cakePHP has a console and tasks. So your system needs to be
 integrated into a task and run from the cakephp console.
 - cakePHP dislikes any third party libs like PEAR, at least in the
 core. the only exception I've seen is simpleTest and even though, it's
 not required to run the framework.
 - cakePHP has some conventions ( dates, assoc_id, dependent/
 independent assocs, etc ). your system should be aware of that to make
 life a bit easier.

 I personally dislike YAML and would prefer PHP to write migrations.

 Good luck.

 On Sep 9, 1:20 am, gonzoprosperity [EMAIL PROTECTED] wrote:

  I have written a migrations toolkit/framework in PHP5, heavily modeled
  after the migrations system in Ruby on Rails.

 http://code.google.com/p/ruckusing/

  I believe it to be feature-complete and extensible than the current
  migrations system in CakePHP.

  My system is currently production-ready and I think it will integrate
  very easily into CakePHP. It can live in its own sub-directory and
  doesnt really need to communicate back with the core framework.

  Any interest in integrating this system into CakePHP?

  Some features:

  - task-based API (think rake for Ruby)
  - can be used for deployment, specify a different environment on the
  command line and migrations will be executed against that DB.
  - Very extensible. Currently, only MySQL support is available, but
  adapters for other RDMBSs could be easily written.
  - more goodies...

  -Cody Caughlan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-11 Thread Sonic Baker
Hey there,

Just wondering, does your Migrations handle the data as well as the schema.
That would certainly be of interest to me.

Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-11 Thread gonzoprosperity

You mean does it support loading in a bunch of data via YAML files, or
something like that?

No it does not.

However, there is nothing preventing you from issuing a series of
INSERT statements..

code:
...create table here..

//populate it with some default data
$this-execute(INSERT INTO users (...) VALUES (...));

Does this answer your question?

/Cody Caughlan

On Sep 11, 11:56 am, Sonic Baker [EMAIL PROTECTED] wrote:
 Hey there,

 Just wondering, does your Migrations handle the data as well as the schema.
 That would certainly be of interest to me.

 Cheers,

 Sonic


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-10 Thread CraZyLeGs

Hi,

I don't think there is a built-in migration system in cakePHP yet. the
one that is available is written by a cakePHP user.
means it's not official.

I heard that john is playing around with migrations in his sandbox, I
don't know the progress though.
But back to your framework. For it to be adopted, I think it should
follow cakePHP' direction:
- cakePHP is php4 and php5 compatible.
- cakePHP has a console and tasks. So your system needs to be
integrated into a task and run from the cakephp console.
- cakePHP dislikes any third party libs like PEAR, at least in the
core. the only exception I've seen is simpleTest and even though, it's
not required to run the framework.
- cakePHP has some conventions ( dates, assoc_id, dependent/
independent assocs, etc ). your system should be aware of that to make
life a bit easier.

I personally dislike YAML and would prefer PHP to write migrations.

Good luck.

On Sep 9, 1:20 am, gonzoprosperity [EMAIL PROTECTED] wrote:
 I have written a migrations toolkit/framework in PHP5, heavily modeled
 after the migrations system in Ruby on Rails.

 http://code.google.com/p/ruckusing/

 I believe it to be feature-complete and extensible than the current
 migrations system in CakePHP.

 My system is currently production-ready and I think it will integrate
 very easily into CakePHP. It can live in its own sub-directory and
 doesnt really need to communicate back with the core framework.

 Any interest in integrating this system into CakePHP?

 Some features:

 - task-based API (think rake for Ruby)
 - can be used for deployment, specify a different environment on the
 command line and migrations will be executed against that DB.
 - Very extensible. Currently, only MySQL support is available, but
 adapters for other RDMBSs could be easily written.
 - more goodies...

 -Cody Caughlan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-10 Thread John David Anderson


On Sep 10, 2007, at 7:43 AM, CraZyLeGs wrote:


 Hi,

 I don't think there is a built-in migration system in cakePHP yet. the
 one that is available is written by a cakePHP user.
 means it's not official.

 I heard that john is playing around with migrations in his sandbox, I
 don't know the progress though.

Garret took over - we might use something from mine, but I think  
gwoo's is more complete. We're working on reconciling any benefits  
from mine with his. Maybe we can look at yours as well?

 But back to your framework. For it to be adopted, I think it should
 follow cakePHP' direction:
 - cakePHP is php4 and php5 compatible.
 - cakePHP has a console and tasks. So your system needs to be
 integrated into a task and run from the cakephp console.
 - cakePHP dislikes any third party libs like PEAR, at least in the
 core. the only exception I've seen is simpleTest and even though, it's
 not required to run the framework.
 - cakePHP has some conventions ( dates, assoc_id, dependent/
 independent assocs, etc ). your system should be aware of that to make
 life a bit easier.

 I personally dislike YAML and would prefer PHP to write migrations.

YAML would definitely be a show stopper. There's probably not going  
to be a YAML parser in the core real soon.

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Migrations ala RoR

2007-09-10 Thread Gwoo

Joel Moss also wrote a migrations that integrates with 1.2.
http://joelmoss.info/switchboard/blog/2583:Migrations_v33
One of the best things about Cake is how easy it is to drop these
third party packages into vendors.

The Cake 1.2 core has a alpha version of the CakeSchema that John
refers to. This is not an advanced migration system, but more of a
snapshot of the database that allows you to create portable schemas
that can also be used to update and alter tables. If you are working
with a database other than MySql you can help us with the DBO. There
is no plan to go further than CakeSchema in the 1.2 core.





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Database Migrations ala RoR

2007-09-09 Thread gonzoprosperity

I have written a migrations toolkit/framework in PHP5, heavily modeled
after the migrations system in Ruby on Rails.

http://code.google.com/p/ruckusing/

I believe it to be feature-complete and extensible than the current
migrations system in CakePHP.

My system is currently production-ready and I think it will integrate
very easily into CakePHP. It can live in its own sub-directory and
doesnt really need to communicate back with the core framework.

Any interest in integrating this system into CakePHP?

Some features:

- task-based API (think rake for Ruby)
- can be used for deployment, specify a different environment on the
command line and migrations will be executed against that DB.
- Very extensible. Currently, only MySQL support is available, but
adapters for other RDMBSs could be easily written.
- more goodies...

-Cody Caughlan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---