function doUp() { global $database; if (DBSchema::existsTable($database, 'Presentation_Tags')) { DB::query("INSERT INTO SummitEvent_Tags (SummitEventID, TagID) select PresentationID, TagID from Presentation_Tags;"); DB::query("DROP TABLE Presentation_Tags;"); DB::query("UPDATE SummitEvent INNER JOIN Presentation ON Presentation.ID = SummitEvent.ID SET SummitEvent.ShortDescription = Presentation.ShortDescription;"); DB::query("ALTER TABLE Presentation DROP COLUMN ShortDescription;"); } }
function doUp() { global $database; if (DBSchema::existsTable($database, '_obsolete_SummitLocationMap')) { $res = DB::query("SELECT * FROM _obsolete_SummitLocationMap;"); foreach ($res as $row) { $new_location = SummitLocationMap::create(); $new_location->Name = trim($row['Name']); $new_location->Description = trim($row['Description']); $new_location->PictureID = intval($row['MapID']); $new_location->LocationID = intval($row['LocationID']); $new_location->Created = trim($row['Created']); $new_location->LastEdited = trim($row['LastEdited']); $new_location->Order = intval($row['Order']); $new_location->write(); } DB::query("DROP TABLE _obsolete_SummitLocationMap;"); } }
function doUp() { global $database; if (DBSchema::existsTable($database, "JobPage")) { $res = DB::query("SELECT * FROM JobPage;"); foreach ($res as $record) { $new_job = new Job(); $new_job->ID = (int) $record['ID']; $new_job->Title = $record['Title']; $new_job->Description = $record['Content']; $new_job->Created = $record['Created']; $new_job->LastEdited = $record['LastEdited']; $new_job->PostedDate = $record['JobPostedDate']; $new_job->ExpirationDate = $record['ExpirationDate']; // company name logic $company_name = $record['JobCompany']; $company = Company::get()->filter('Name', $company_name)->first(); $new_job->CompanyID = is_null($company) ? 0 : $company->ID; if ($new_job->CompanyID == 0) { $new_job->CompanyName = $company_name; } $new_job->MoreInfoLink = $record['JobMoreInfoLink']; $new_job->Location = $record['JobLocation']; $new_job->IsFoundationJob = $record['FoundationJob']; $new_job->IsActive = $record['Active']; $new_job->Instructions2Apply = $record['JobInstructions2Apply']; $new_job->LocationType = $record['LocationType']; $new_job->IsCOANeeded = 0; $new_job->TypeID = 0; //registration request $registration_request = JobRegistrationRequest::get()->filter('Title', $new_job->Title)->first(); if (!is_null($registration_request)) { $new_job->RegistrationRequestID = $registration_request->ID; } $new_job->write(); } DBSchema::dropTable($database, "JobPage"); } }