jmhobbs / kohana-3-migrations

A simple, SQL based migrations system for Kohana 3.
19 stars 6 forks source link

.sql files are weak #1

Closed philsturgeon closed 13 years ago

philsturgeon commented 13 years ago

Hey,

Although this is awesome code, basing your migrations around .sql files is a bit weak. In Rails, CodeIgniter and Fuel migrations are done with .rb or .php files, which means you can run SQL and any other code too.

For example, if I add a new column to a table and my model or controller is expecting that value, I'll need to clear the cache to stop a PHP errors popping up. This is only one of several possible examples.

Run a PHP file and you can do lots more. :)

jmhobbs commented 13 years ago

Yes, it's very weak, but it was super fast to write! :-)

Good points and one thing I've run into is bad SQL files breaking my migrations since there is no good transaction wrappers.

I'll start working on another version, it's just sad you can't build a nice DSL in PHP like Ruby.

philsturgeon commented 13 years ago

Damn right, add_column :foo, :bar, :string is lovely!

Here is my Fuel implementation for Migrations. Fuel isn ot all that different from Kohana in many places so much of it should apply. :)

jmhobbs commented 13 years ago

https://github.com/philsturgeon/codeigniter-migrations/blob/master/migrations/001_Create_accounts.php

This looks like a decent model to work off of.