28 function addBooleanColumnTo($dbManager, $tableName, $columnName =
'is_enabled')
30 echo
"Migrate: Add and setup column=$columnName to table=$tableName\n";
31 if (! $dbManager->existsColumn($tableName, $columnName))
33 $dbManager->queryOnce(
"ALTER TABLE $tableName 34 ADD COLUMN $columnName BOOLEAN;");
37 $dbManager->queryOnce(
"UPDATE $tableName 38 SET $columnName = " . $tableName .
"_pk IN 39 (SELECT MAX(" . $tableName .
"_pk) AS enabled_pk 41 GROUP BY pfile_fk);");
42 $dbManager->queryOnce(
"ALTER TABLE $tableName 43 ALTER COLUMN $columnName 45 $dbManager->queryOnce(
"ALTER TABLE $tableName 46 ALTER COLUMN $columnName 50 foreach (array(
'copyright',
'ecc') as $name)
53 addBooleanColumnTo($dbManager, $name.
'_decision');