1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/manual/docs/Connection modules - Export - Creating new table.php

24 lines
695 B
PHP
Raw Normal View History

2007-04-14 01:49:11 +04:00
<code type="php">
$dbh = new PDO('dsn','username','pw');
$conn = Doctrine_Manager::getInstance()->openConnection($dbh);
$fields = array('id' => array(
'type' => 'integer',
'autoincrement' => true),
'name' => array(
'type' => 'string',
'fixed' => true,
'length' => 8)
);
// the following option is mysql specific and
// skipped by other drivers
$options = array('type' => 'MYISAM');
$conn->export->createTable('mytable', $fields);
// on mysql this executes query:
// CREATE TABLE mytable (id INT AUTO_INCREMENT PRIMARY KEY,
// name CHAR(8));
</code>