kohana-pack / timestamped-migrations

Rails Like migrations for Kohana 3
MIT License
6 stars 0 forks source link

_to_ in table name #16

Open seyfer opened 10 years ago

seyfer commented 10 years ago

If table called like "clients_to_seances" Then db:generate generates error code

./bash/minion db:generate --name=add_id_to_clients_to_seances

class Add_Id_To_Clients_To_Seances extends Migration
{
    public function up()
    {
        $this->add_column('seances', 'id_to_clients', 'integer');
    }
    public function down()
    {
        $this->remove_column('seances', 'id_to_clients');
    }
}

Expected

class Add_Id_To_Clients_To_Seances extends Migration
{
    public function up()
    {
        $this->add_column('clients_to_seances', 'id', 'integer');
    }
    public function down()
    {
        $this->remove_column('clients_to_seances', 'id');
    }
}
seyfer commented 10 years ago

What if i'm want add column names "from" and "to"

./bash/minion db:generate --name=add_from_and_to_to_clients_to_seances

Then i'm have

class Add_From_And_To_To_Clients_To_Seances extends Migration
{
    public function up()
    {
        $this->add_column('seances', 'from', 'string');
        $this->add_column('seances', 'to_to_clients', 'string');
    }

    public function down()
    {
        $this->remove_column('seances', 'from');
        $this->remove_column('seances', 'to_to_clients');
    }
}