当前位置: 首页>>代码示例>>PHP>>正文


PHP Migration::get方法代码示例

本文整理汇总了PHP中Migration::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Migration::get方法的具体用法?PHP Migration::get怎么用?PHP Migration::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Migration的用法示例。


在下文中一共展示了Migration::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $marketplace_types = array('Private Cloud');
         $factory = new MarketplaceFactory();
         $service = new MarketplaceTypeManager(new SapphireMarketPlaceTypeRepository(), new SapphireSecurityGroupRepository(), SapphireTransactionManager::getInstance());
         foreach ($marketplace_types as $marketplace_type) {
             try {
                 $service->store($factory->buildMarketplaceType($marketplace_type));
             } catch (Exception $ex) {
             }
         }
         DB::query("INSERT INTO CloudServiceOffered_PricingSchemas (CloudServiceOfferedID, PricingSchemaTypeID) SELECT PublicCloudServiceOfferedID, PricingSchemaTypeID FROM PublicCloudServiceOffered_PricingSchemas;");
         DB::query("UPDATE OpenStackImplementationApiCoverage SET ClassName='CloudServiceOffered'\nWHERE ImplementationID IN (SELECT ID FROM CompanyService where ClassName='PublicCloudService');");
         DB::query("UPDATE DataCenterRegion SET CloudServiceID = PublicCloudID;");
         DB::query("ALTER TABLE `CloudServiceOffered_PricingSchemas`\n\t\t\tADD UNIQUE INDEX `CloudServiceOffered_PricingSchemaType` (`CloudServiceOfferedID` ASC, `PricingSchemaTypeID` ASC);");
         DB::query("ALTER TABLE `DataCenterRegion` DROP INDEX `Name_PublicCloud`;");
         DB::query("ALTER TABLE `DataCenterRegion`\n\t\t\tADD UNIQUE INDEX `Name_CloudService` (`Name` ASC, `CloudServiceID` ASC);");
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
     }
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:28,代码来源:NewMarketplaceTypePrivateCloudSeedTask.php

示例2: up

    function up()
    {
        echo "Starting Migration Proc ...<BR>";
        //check if migration already had ran ...
        $migration = Migration::get()->filter('Name', $this->title)->first();
        if (!$migration) {
            $presentation_type = SummitEventType::get("SummitEventType", "Type = 'Presentation' AND SummitID = 5")->first();
            if ($presentation_type) {
                $presentation_type_id = $presentation_type->ID;
            } else {
                $presentation_type = new SummitEventType();
                $presentation_type->Type = 'Presentation';
                $presentation_type->SummitID = 5;
                $presentation_type->Color = '#D0A9F5';
                $presentation_type_id = $presentation_type->Write();
            }
            $SQL = <<<SQL
                UPDATE SummitEvent SET TypeID = {$presentation_type_id} WHERE ClassName = 'Presentation' AND SummitID = 5;
SQL;
            DB::query($SQL);
            $migration = new Migration();
            $migration->Name = $this->title;
            $migration->Description = $this->description;
            $migration->Write();
        }
        echo "Ending  Migration Proc ...<BR>";
    }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:27,代码来源:SetPresentationEventType.php

示例3: up

    function up()
    {
        echo "Starting Migration Proc ...<BR>";
        //check if migration already had ran ...
        $migration = Migration::get()->filter('Name', $this->title)->first();
        if (!$migration) {
            $SQL = <<<SQL
INSERT INTO `VideoPresentation`
(
`ClassName`,
`Created`,
`LastEdited`,
`Name`,
`DisplayOnSite`,
`Featured`,
`City`,
`Country`,
`Description`,
`YouTubeID`,
`URLSegment`,
`StartTime`,
`EndTime`,
`Location`,
`Type`,
`Day`,
`Speakers`,
`SlidesLink`,
`event_key`,
`IsKeynote`,
`PresentationCategoryPageID`,
`SummitID`,
`MemberID`)
SELECT 'VideoPresentation', NOW(),NOW(),Name, `DisplayOnSite`,
`Featured`,
`City`,
`Country`,
`Description`,
`YouTubeID`,
`URLSegment`,
`StartTime`,
`EndTime`,
`Location`,
`Type`,
`Day`,
`Speakers`,
`SlidesLink`,
`event_key`,
`IsKeynote`,
`PresentationCategoryPageID`,
`SummitID`,
`MemberID` FROM Presentation;
SQL;
            DB::query($SQL);
            $migration = new Migration();
            $migration->Name = $this->title;
            $migration->Description = $this->description;
            $migration->Write();
        }
        echo "Ending  Migration Proc ...<BR>";
    }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:60,代码来源:FixVideoPageTask.php

示例4: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $requests = JobRegistrationRequest::get();
         foreach ($requests as $request) {
             if (!empty($request->City)) {
                 //create locations
                 $location = new JobLocation();
                 $location->City = $request->City;
                 $location->State = $request->State;
                 $location->Country = $request->Country;
                 $location->RequestID = $request->ID;
                 $location->Write();
                 $request->LocationType = 'Various';
                 $request->Write();
             }
         }
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
     }
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:27,代码来源:JobUpdateLocations.php

示例5: down

 function down()
 {
     SapphireTransactionManager::getInstance()->transaction(function () {
         echo sprintf("downgrading migration # %s ...", $this->title) . PHP_EOL;
         Migration::get()->filter('Name', $this->title)->removeAll();
         $this->doDown();
     });
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:8,代码来源:AbstractDBMigrationTask.php

示例6: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     $promo_code_type = isset($_REQUEST['promo_code_type']) ? intval($_REQUEST['promo_code_type']) : null;
     $promo_code_file = isset($_REQUEST['promo_code_file']) ? $_REQUEST['promo_code_file'] : null;
     if (is_null($promo_code_type)) {
         echo 'ERROR - promo_code_type param missing!';
         exit;
     }
     if (is_null($promo_code_file)) {
         echo 'ERROR - promo_code_file param missing!';
         exit;
     }
     $base_path = ASSETS_PATH;
     $file_path = $base_path . '/' . $promo_code_file;
     $type = explode(".", $file_path);
     if (!strtolower(end($type)) == 'csv') {
         echo 'ERROR - file hast not a csv extension!';
         exit;
     }
     if (!file_exists($file_path)) {
         echo sprintf('ERROR - %s file does not exists!', $file_path);
         exit;
     }
     $reader = new CSVReader($file_path);
     $row = 0;
     do {
         $line = $reader->getLine();
         if ($line) {
             ++$row;
             if ($row === 1) {
                 continue;
             }
             // skip header ...
             switch ($promo_code_type) {
                 case 1:
                     $type = 'ACCEPTED';
                     break;
                 case 2:
                     $type = 'ALTERNATE';
                     break;
             }
             $code = new SpeakerSummitRegistrationPromoCode();
             $code->Code = $line[0];
             $code->Type = $type;
             $code->SummitID = Summit::get_active()->ID;
             try {
                 $code->write();
             } catch (Exception $ex) {
                 SS_Log::log($ex->getMessage(), SS_Log::ERR);
             }
         }
     } while ($line);
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:57,代码来源:SummitPromoRegistrationCodesLoaderTask.php

示例7: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         DB::query("UPDATE Member SET ShowDupesOnProfile = 1 ;");
     }
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:10,代码来源:ShowDupesOnProfileUpdateTask.php

示例8: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         DB::query("update JobPage set active =1;");
         DB::query("update JobPage set ExpirationDate = DATE_ADD(JobPostedDate, INTERVAL 2 MONTH)\nwhere JobPage.JobPostedDate IS NOT NULL;");
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
     }
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:15,代码来源:JobUpdateTask.php

示例9: up

 function up()
 {
     echo sprintf("starting migration # %s ...", $this->title) . PHP_EOL;
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $this->doUp();
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
         echo sprintf("ending migration # %s ...", $this->title) . PHP_EOL;
     } else {
         echo sprintf("migration # %s already ran !...", $this->title) . PHP_EOL;
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:16,代码来源:AbstractDBMigrationTask.php

示例10: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
         //run migration
         $query = "UPDATE Deployment, (\n                SELECT Org.ID AS OrgID, Deployment.ID AS DepID\n                FROM Org, Deployment, DeploymentSurvey, Member\n                WHERE\n                Member.ID = DeploymentSurvey.MemberID AND\n                Org.ID = Member.OrgID AND\n                Deployment.DeploymentSurveyID = DeploymentSurvey.ID\n            ) AS t1\n            SET Deployment.OrgID = t1.OrgID\n            WHERE t1.DepID = Deployment.ID";
         DB::query($query);
     } else {
         echo "Migration Already Ran! <BR>";
     }
     echo "Migration Done <BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:17,代码来源:UpdateDeploymentsOrgTask.php

示例11: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $g = new Group();
         $g->setTitle('CCLA Admin');
         $g->setDescription('Company CCLA Admin');
         $g->setSlug(ICLAMemberDecorator::CCLAGroupSlug);
         $g->write();
         Permission::grant($g->getIdentifier(), ICLAMemberDecorator::CCLAPermissionSlug);
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
     }
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:19,代码来源:CLAICLAGroupsCreationTask.php

示例12: up

 function up()
 {
     echo "Starting  Proc ...<BR>";
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
         //run migration
         $surveys = DeploymentSurvey::get();
         foreach ($surveys as $survey) {
             $survey->SendDigest = 1;
             $survey->write();
         }
     } else {
         echo "Migration Already Ran! <BR>";
     }
     echo "Migration Done <BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:20,代码来源:UpdateDeploymentSurveyDigest.php

示例13: up

    function up()
    {
        echo "Starting Migration Proc ...<BR>";
        $migration = Migration::get()->filter('Name', $this->title)->first();
        if (!$migration) {
            //run migration
            $query = <<<SQL
update SiteTree_Live
SET ClassName='AnniversaryPage'
where ID = 891;
SQL;
            DB::query($query);
            $migration = new Migration();
            $migration->Name = $this->title;
            $migration->Description = $this->description;
            $migration->Write();
        } else {
            echo "Migration Already Ran! <BR>";
        }
        echo "Migration Done <BR>";
    }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:21,代码来源:UpdateAnniversaryPage.php

示例14: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     //check if migration already had ran ...
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $programs = DB::query('SELECT P.*,C.CompanyID from TrainingProgram P INNER JOIN Contract C on C.ID = P.TrainingContractID;');
         $service = new TrainingManager(new SapphireTrainingServiceRepository(), new SapphireMarketPlaceTypeRepository(), new MarketPlaceTypeAddPolicyStub(), null, new CacheServiceStub(), new MarketplaceFactory(), SapphireTransactionManager::getInstance());
         $factory = new TrainingFactory();
         foreach ($programs as $program) {
             $company_id = (int) $program['CompanyID'];
             $company = Company::get()->byID($company_id);
             $program_id = (int) $program['ID'];
             $training = $factory->buildTraining($program['Name'], $program['Description'], true, $company);
             $training->CompanyID = $company_id;
             $training->write();
             //get former courses and associate it with new entity
             $courses = TrainingCourse::get()->filter('ProgramID', $program_id);
             if ($courses && count($courses) > 0) {
                 foreach ($courses as $course) {
                     $course->TrainingServiceID = $training->getIdentifier();
                     $course->write();
                 }
             }
         }
         //db alter
         DB::query('DROP TABLE Training;');
         DB::query('ALTER TABLE `TrainingCourse` DROP COLUMN ProgramID;');
         DB::query('DROP TABLE TrainingProgram;');
         $new_training_group_slug = ITraining::MarketPlaceGroupSlug;
         DB::query("\n\t\t\tUPDATE `Company_Administrators`\n\t\t\tSET GroupID = (SELECT ID FROM `Group` WHERE code='{$new_training_group_slug}' LIMIT 1 )\n\t\t\tWHERE ID IN (\n\t\t\t\tSELECT tmp.id FROM\n\t\t\t\t(\n\t\t\t\t\tSELECT ID FROM `Company_Administrators`\n\t\t\t\t\tWHERE GroupID IN ( SELECT ID FROM `Group` where code='training-admins')\n\t\t\t\t) as tmp\n\t\t\t);\n\t\t\t");
         DB::query("\n\t\t\tDELETE Permission\n\t\t\tFROM Permission\n\t\t\tWHERE Code='MANAGE_COMPANY_TRAINING';\n\t\t\t");
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
     }
     echo "Ending  Migration Proc ...<BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:39,代码来源:Training2MarketplaceMigrationTask.php

示例15: up

 function up()
 {
     echo "Starting Migration Proc ...<BR>";
     $migration = Migration::get()->filter('Name', $this->title)->first();
     if (!$migration) {
         $migration = new Migration();
         $migration->Name = $this->title;
         $migration->Description = $this->description;
         $migration->Write();
         DB::query("DROP TABLE IF EXISTS `Continent_Countries`;");
         DB::query("CREATE TABLE `Continent_Countries` (\n  `ContinentID` int(11) NOT NULL,\n  `CountryCode` varchar(4) NOT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         DB::query("LOCK TABLES `Continent_Countries` WRITE;");
         DB::query("INSERT INTO `Continent_Countries` VALUES (3,'AD'),(5,'AE'),(5,'AF'),(1,'AI'),(3,'AL'),(5,'AM'),(1,'AN'),(4,'AO'),(7,'AQ'),(2,'AR'),(1,'AS'),(3,'AT'),(6,'AU'),(3,'AX'),(5,'AZ'),(1,'BB'),(3,'BA'),(5,'BD'),(3,'BE'),(4,'BF'),(3,'BG'),(5,'BH'),(2,'BO'),(2,'BR'),(5,'BT'),(4,'BW'),(4,'ZW'),(4,'ZM'),(4,'ZA'),(5,'VN'),(2,'VE'),(2,'UY'),(1,'US'),(1,'UM'),(4,'UG'),(3,'UA'),(4,'TZ'),(5,'TW'),(1,'TT'),(3,'TR'),(5,'TR'),(4,'TN'),(5,'TH'),(7,'TF'),(1,'TC'),(5,'SY'),(1,'SV'),(4,'SN'),(3,'SK'),(3,'SI'),(5,'SG'),(3,'SE'),(4,'SD'),(8,'SB'),(5,'SA'),(4,'RW'),(3,'RU'),(3,'RS'),(3,'RO'),(5,'QA'),(2,'PY'),(3,'PT'),(1,'PR'),(3,'PL'),(5,'PK'),(5,'PH'),(8,'PG'),(8,'PF'),(2,'PE'),(1,'PA'),(8,'NZ'),(5,'NP'),(3,'NO'),(3,'NL'),(4,'NG'),(4,'NE'),(4,'NA'),(5,'MY'),(1,'MX'),(4,'MU'),(3,'MT'),(5,'MO'),(5,'MN'),(5,'MM'),(3,'MK'),(3,'ME'),(3,'MD'),(3,'MC'),(4,'MA'),(4,'LY'),(3,'LV'),(3,'LU'),(3,'LT'),(5,'LK'),(1,'LC'),(5,'LB'),(5,'KZ'),(1,'KY'),(5,'KW'),(5,'KR'),(5,'KP'),(5,'KH'),(4,'KE'),(5,'JP'),(5,'JO'),(1,'JM'),(3,'IT'),(3,'IS'),(5,'IR'),(4,'IO'),(5,'IN'),(5,'IL'),(3,'IE'),(5,'ID'),(3,'HU'),(3,'HR'),(1,'HN'),(5,'HK'),(1,'GT'),(3,'GR'),(1,'GP'),(3,'BY'),(1,'CA'),(4,'CM'),(1,'CR'),(3,'CY'),(3,'DK'),(2,'EC'),(3,'ES'),(3,'FR'),(3,'GE'),(3,'CH'),(4,'CI'),(2,'CL'),(5,'CN'),(2,'CO'),(1,'CU'),(3,'CZ'),(3,'DE'),(3,'FI'),(3,'FX'),(4,'GH'),(8,'CX'),(1,'DO'),(4,'DZ'),(3,'EE'),(4,'EG'),(3,'GB');");
         DB::query("UNLOCK TABLES;");
         DB::query("DROP TABLE IF EXISTS `Continent`;");
         DB::query("CREATE TABLE `Continent` (\n  `ID` int(11) NOT NULL AUTO_INCREMENT,\n  `Name` varchar(32) NOT NULL,\n  PRIMARY KEY (`ID`)\n) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;");
         DB::query("LOCK TABLES `Continent` WRITE;");
         DB::query("INSERT INTO `Continent` VALUES (1,'North America'),(2,'South America'),(3,'Europe'),(4,'Africa'),(5,'Asia'),(6,'Australia'),(7,'Antarctica'),(8,'Oceania');");
         DB::query("UNLOCK TABLES;");
     } else {
         echo "Migration Already Ran! <BR>";
     }
     echo "Migration Done <BR>";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:24,代码来源:CountriesContinentMigration.php


注:本文中的Migration::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。