Closed scrptd95 closed 2 years ago
Hello, this is new feature. At that moment there is no logic to auto detect SQL View
and create it via morph()
method.
What you can do now, is to create empty migration and put SQL code of view creation inside up()
method, example:
public function up()
{
$this->getConnection()->execute('CREATE VIEW ...');
}
Ah thx for the hint. For now i'll handle it this way.
Also thank you for your fast response!
Hi, How can I manage the migrate order? Views should run last.
Expected and Actual Behavior
Hi Guys, recently i created a view in my mysql db and was curious if the phalcon/migrations util would pick it up. I ran
phalcon migrations generate
to generate the migration file, wiped my tables and executedphalcon migrations run
to check whether my db will be correctly created or not.Migration File: `<?php
use Phalcon\Db\Column; use Phalcon\Db\Exception; use Phalcon\Db\Index; use Phalcon\Db\Reference; use Phalcon\Migrations\Mvc\Model\Migration;
/**
Class ViolationsMigration_104 */ class ViolationsMigration_104 extends Migration { /**
/**
/**
Create table syntax of created table via migration run:
CREATE TABLE
violations(
violationsdecimal(32,0) DEFAULT NULL,
logged_forint NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
The table gets created but not as a view. It seems that the
TABLE_TYPE
gets ignored ? Also i'm curious where or if the migration generate task stores/saves the query related to the view.Expected behavior:
phalcon migrations generate
correctly creates the migration file for mysql viewphalcon migrations run
correctly creates the view in the dbDetails