We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon devtools commando lines

Hi,

I have a question. I want to create a complete new migration. How can I do this? I tried phalcon migration name_of_the_migration, because with phalcon create project_name I can create a project and with phalcon controller controller_name I can create a controller and with phalcon model model_name I can create a model. And if I have created a new migration how can I execute it?

I'm new here and I want to learn phalcon. The devtool is very important, because you are much quicker if you can use it correctly.

I can Laravel and there it is very useful to know the commandos. Currently I am learning phalcon, so I think it is very useful to see the differences between both frameworks.

I hope there is somebody who can help me. For a person who is working with phalcon it's probably no problem to tell me the correct code, but I can't find it in the documentation or the codes I have tried didn't work.

Sorr for bad english and I hope you can help me very quickly

so you need a folder in your project folder named .phalcon to use phalcon's command line , and to create a migration you just run : phalcon migration --action generate --migrations /path/to/save/ . and to run a migration just change the action from generate to run



1.8k

thank you very much. Both things are working really fine.

It was my mistake. But I ask for the wrong thing. With the command I can only create a migration to an existing table.

I can't explain it very good. But I am searching for this: php artisan make:migration create_users_table --create=users In Laravel I can create a empty migration file which not belongs to an existing table in a database.

I was searching for the same thing here in phalcon. It should create something like this:

<?php

use Phalcon\Db\Column as Column; use Phalcon\Db\Index as Index; use Phalcon\Db\Reference as Reference;

class [Name] extends \Phalcon\Mvc\Model\Migration { public function up() { ... } }

I want to create a migration at the beginn of an project and then create the table with this migration.

Maybe there aren't a command. But if there is existing one, it would help me a lot.

Thank you very much, again. Your help helps me to understand many thins and I have learnt new things. But I want to know the above explained thing.

So the way i know is that when you run the generate command it will grab all the tables and save it , so each time you run the generate command it will create a new version in a folder . example : /migrations/1.0.0/ , but are you trying just to migrate a single table?



7.0k

I want to know if this is possible using phalcon. laravel's method is very flexiable. Hope phalcon could provide the same function!