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

What is the file tutorial.sql for ?

Hello,

I read that "the database table should be created outside of Phalcon". Ok, I understand that create databases and create tables is not phalcon's job. May be the phalcon devtools's job, I think.

What is the file tutorial.sql for ? (see in the basic tutorial)

Thanks !



1.5k
Accepted
answer

Ok, I can import a table in my base, table which is described with a .sql : "SOURCE Memo.sql;"

For example :

mirmaou #

mirmaou # mysql -u root -p

Welcome to the MySQL monitor. Commands end with ; or \g.

...

mysql>

mysql> SHOW DATABASES;

+--------------------+

| Database |

+--------------------+

| mysql |

| symfony |

| sys |

+--------------------+

mysql> CREATE DATABASE Memory;

mysql> SHOW DATABASES;

+--------------------+

| Database |

+--------------------+

| Memory |

| mysql |

| symfony |

| sys |

+--------------------+

mysql> USE Memory

Database changed

mysql> SOURCE Memo.sql;

mysql> SHOW TABLES;

+------------------+

| Tables_in_Memory |

+------------------+

| Utilisateurs |

+------------------+

mysql> DESCRIBE Utilisateurs;

+-------+------------------+------+-----+---------+----------------+

| Field | Type | Null | Key | Default | Extra |

+-------+------------------+------+-----+---------+----------------+

| id | int(10) unsigned | NO | PRI | NULL | auto_increment |

| nom | varchar(70) | NO | | NULL | |

| email | varchar(70) | NO | | NULL | |

+-------+------------------+------+-----+---------+----------------+

It's best when it's said...