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


PHP Migration::getAllMigrationNames方法代码示例

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


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

示例1: handleApply

 public function handleApply($p)
 {
     if ($p[2] == 'migrations') {
         $type = 'migration';
     } else {
         if ($p[2] == 'seeds') {
             $type = 'seed';
         } else {
             trigger_error("invalid migration type: " . $p[2]);
         }
     }
     SqlBeginTransaction();
     //	make sure the migrations table exists
     Migration::initDB($type);
     //	have it scan the migrations directory for all available migrations
     $versions = Migration::getAllMigrationNames($type);
     //	query the db for applied migrations
     $applied = Migration::getAllAppiedMigrationNames($type);
     //	apply anything that hasn't been done yet, in the proper order
     $unapplied = array_diff($versions, $applied);
     foreach ($unapplied as $key => $needsApplied) {
         Migration::apply($key, $needsApplied, $type);
     }
     SqlCommitTransaction();
 }
开发者ID:rgigger,项目名称:zinc,代码行数:25,代码来源:CommandMigrations.php

示例2: subMigrations

 function subMigrations($p, $s)
 {
     SqlBeginTransaction();
     //	make sure the migrations table exists
     Migration::initDB();
     //	have it scan the migrations directory for all available migrations
     $versions = Migration::getAllMigrationNames();
     //	query the db for applied migrations
     $applied = Migration::getAllAppiedMigrationNames();
     //	apply anything that hasn't been done yet, in the proper order
     $unapplied = array_diff($versions, $applied);
     foreach ($unapplied as $key => $needsApplied) {
         Migration::apply($key, $needsApplied);
     }
     SqlCommitTransaction();
 }
开发者ID:laiello,项目名称:zoop,代码行数:16,代码来源:ZoneApply.php

示例3: subMigrations

 function subMigrations($p, $s)
 {
     SqlBeginTransaction();
     //	make sure the migrations table exists
     Migration::initDB();
     //	have it scan the migrations directory for all available migrations
     $versions = Migration::getAllMigrationNames();
     // print_r($versions);
     $flipped = array_flip($versions);
     //	query the db for applied migrations in reverse order
     $applied = Migration::getAllAppiedMigrationNames();
     // print_r($applied);
     print_r($versions);
     print_r($applied);
     //	undo all of the migrations
     foreach ($applied as $key => $migration) {
         Migration::undo($flipped[$migration], $migration);
     }
     //	now, reapply all of them
     foreach ($versions as $key => $migration) {
         Migration::apply($key, $migration);
     }
     SqlCommitTransaction();
     //	apply anything that hasn't been done yet, in the proper order
     // $unapplied = array_diff($versions, $applied);
     // print_r($unapplied);die();
     // foreach($unapplied as $key => $needsApplied)
     // {
     // 	Migration::apply($key, $needsApplied);
     // }
     /*
     //	make sure the migrations table exists
     $schema = SqlGetSchema();
     if(!$schema->tableExists('migrations'))
     {
     	SqlAlterSchema("create table migrations (
     				id serial primary key, 
     				name text not null,
     				applied int2 not null default 0)");
     }
     
     //	have it scan the migrations directory for all available migrations
     $filenames = ListDir(getcwd() . '/migrations', array('extentions' => array('php')));
     $versions = array();
     foreach($filenames as $thisFilename)
     {
     	$parts = explode('_', $thisFilename);
     	$version = $parts[0];
     	$versions[$thisFilename] = $version;
     }
     
     //	query the db for applied migrations
     $applied = SqlFetchColumn("select name from migrations where applied = 1", array());
     
     //	apply anything that hasn't been done yet, in the proper order
     $unapplied = array_diff($versions, $applied);
     print_r($unapplied);
     foreach($unapplied as $key => $needsApplied)
     {
     	//	apply the migration
     	include_once(getcwd() . '/migrations/' . $key);
     	$className = 'Migration_' . str_replace('.', '_', $needsApplied);
     	$migration = new $className();
     	$migration->up();
     	
     	//	mark it as applied
     	SqlUpsertRow('migrations', array('name' => $needsApplied), array('applied' => 1));
     	
     	print_r($migration);
     }
     */
 }
开发者ID:laiello,项目名称:zoop,代码行数:72,代码来源:ZoneRedo.php


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