cc-2279 : Upgrade script
start of doctrine upgrade script for 1.9 music dirs change.
This commit is contained in:
parent
c300b8f36d
commit
8d8e2a02b6
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
//CC-2279 Upgrade script for converting stor directory to new format
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration,
|
use Doctrine\DBAL\Migrations\AbstractMigration,
|
||||||
|
@ -9,11 +11,27 @@ class Version20110629143017 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema)
|
||||||
{
|
{
|
||||||
|
//create cc_music_dirs table
|
||||||
|
$cc_music_dirs = $schema->createTable('cc_music_dirs');
|
||||||
|
|
||||||
|
$cc_music_dirs->addColumn('id', 'integer', array('unsigned' => true, 'autoincrement' => true));
|
||||||
|
$cc_music_dirs->addColumn('type', 'string', array('length' => 255));
|
||||||
|
$cc_music_dirs->addColumn('directory', 'text', array('unique' => true));
|
||||||
|
|
||||||
|
$cc_music_dirs->setPrimaryKey(array('id'));
|
||||||
|
//end create cc_music_dirs table
|
||||||
|
|
||||||
|
|
||||||
|
//start cc_files modifications
|
||||||
|
$cc_files = $schema->getTable('cc_files');
|
||||||
|
$cc_files->addColumn('directory', 'integer');
|
||||||
|
|
||||||
|
$cc_files->addNamedForeignKeyConstraint('cc_music_dirs_folder_fkey', $cc_music_dirs, array('directory'), array('id'), array('onDelete' => 'CASCADE'));
|
||||||
|
//end cc_files modifications
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,34 @@ AirtimeInstall::CreateZendPhpLogFile();
|
||||||
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
||||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||||
|
|
||||||
|
function BypassMigrations($version)
|
||||||
|
{
|
||||||
|
$appDir = __DIR__."/../../airtime_mvc";
|
||||||
|
$dir = __DIR__;
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction --add migrations:version $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
function MigrateTablesToVersion($version)
|
||||||
|
{
|
||||||
|
$appDir = __DIR__."/../../airtime_mvc";
|
||||||
|
$dir = __DIR__;
|
||||||
|
$command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||||
|
"--configuration=$dir/../../DoctrineMigrations/migrations.xml ".
|
||||||
|
"--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ".
|
||||||
|
"--no-interaction migrations:migrate $version";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
|
|
||||||
function InstallPhpCode($phpDir)
|
function InstallPhpCode($phpDir)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
|
$AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc');
|
||||||
|
|
||||||
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
echo "* Installing PHP code to ".$phpDir.PHP_EOL;
|
||||||
exec("mkdir -p ".$phpDir);
|
exec("mkdir -p ".$phpDir);
|
||||||
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir);
|
||||||
|
@ -30,7 +52,7 @@ function InstallPhpCode($phpDir)
|
||||||
function InstallBinaries()
|
function InstallBinaries()
|
||||||
{
|
{
|
||||||
$utilsSrc = __DIR__."/../../../utils";
|
$utilsSrc = __DIR__."/../../../utils";
|
||||||
|
|
||||||
echo "* Installing binaries to ".CONF_DIR_BINARIES.PHP_EOL;
|
echo "* Installing binaries to ".CONF_DIR_BINARIES.PHP_EOL;
|
||||||
exec("mkdir -p ".CONF_DIR_BINARIES);
|
exec("mkdir -p ".CONF_DIR_BINARIES);
|
||||||
exec("cp -R ".$utilsSrc." ".CONF_DIR_BINARIES);
|
exec("cp -R ".$utilsSrc." ".CONF_DIR_BINARIES);
|
||||||
|
|
Loading…
Reference in New Issue