本文整理汇总了PHP中Doctrine_Migration::setTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Migration::setTableName方法的具体用法?PHP Doctrine_Migration::setTableName怎么用?PHP Doctrine_Migration::setTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Migration
的用法示例。
在下文中一共展示了Doctrine_Migration::setTableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PDO
}
$db = new PDO($dsn[0], $user, $pass);
$conn = Doctrine_Manager::connection($db);
$dbtable = $conn->fetchOne("SELECT schema_name FROM information_schema.schemata WHERE schema_name='" . $dbname . "'");
if (!$dbtable) {
$sql = "CREATE DATABASE `" . $dbname . "` CHARACTER SET utf8;\n CREATE USER '" . $config['db.user'] . "'@'localhost' IDENTIFIED BY '" . $config['db.pass'] . "';\n GRANT ALL PRIVILEGES ON " . $dbname . ".* TO '" . $config['db.user'] . "'@'%' WITH GRANT OPTION;\n ";
$db->exec($sql);
}
$conn->close();
$db = new PDO($config['db.dsn'], $config['db.user'], $config['db.pass']);
$conn = Doctrine_Manager::connection($db);
if (isset($google_user)) {
echo 'user: ' . $google_user->getNickname() . '<br>';
}
$migration = new Doctrine_Migration(__DIR__ . '/classes', $conn);
$migration->setTableName('doctrine_migration_version');
if (isset($_REQUEST['ver']) && (!isset($google_user) || $google_user->getNickname() == 'piotr.podstawski@gammanet.pl')) {
$version = 0 + intval($_REQUEST['ver']);
} else {
$classesKeys = array_keys($migration->getMigrationClasses());
$version = 0 + array_pop($classesKeys);
}
if (isset($_SERVER['HTTP_HOST'])) {
echo '<h1>';
}
if ($migration->getCurrentVersion() == $version) {
echo 'Database at version ' . $version . PHP_EOL;
} else {
$migration->migrate($version);
echo 'Migrated succesfully to version ' . $migration->getCurrentVersion() . PHP_EOL;
}