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


PHP CM_Db_Db::existsIndex方法代码示例

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


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

示例1: int

<?php

if (!CM_Db_Db::existsColumn('cm_splittest', 'optimized')) {
    CM_Db_Db::exec('
        ALTER TABLE `cm_splittest` ADD COLUMN `optimized` int(1) unsigned NOT NULL AFTER `name`');
}
if (!CM_Db_Db::existsIndex('cm_splittestVariation_fixture', 'splittestVariationCreateStamp')) {
    CM_Db_Db::exec('
        ALTER TABLE `cm_splittestVariation_fixture`
          ADD INDEX `splittestVariationCreateStamp` (`splittestId`,`variationId`,`createStamp`),
          ADD INDEX `splittestVariationConversionStamp` (`splittestId`,`variationId`,`conversionStamp`),
          DROP INDEX `splittestId`,
          DROP INDEX `createStamp`,
          DROP INDEX `conversionStamp`');
}
开发者ID:cargomedia,项目名称:cm,代码行数:15,代码来源:46.php

示例2: testExistsIndex

 public function testExistsIndex()
 {
     $this->assertSame(true, CM_Db_Db::existsIndex('test', 'foo'));
     $this->assertSame(false, CM_Db_Db::existsIndex('test', 'test'));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:5,代码来源:DbTest.php

示例3: int

<?php

if (CM_Db_Db::existsTable('cm_model_location_city_ip') && !CM_Db_Db::existsTable('cm_model_location_ip')) {
    CM_Db_Db::exec('RENAME TABLE `cm_model_location_city_ip` TO `cm_model_location_ip`');
}
if (CM_Db_Db::existsTable('cm_model_location_ip')) {
    if (CM_Db_Db::existsIndex('cm_model_location_ip', 'cityId')) {
        CM_Db_Db::exec('DROP INDEX `cityId` ON `cm_model_location_ip`');
    }
    if (CM_Db_Db::existsColumn('cm_model_location_ip', 'cityId') && !CM_Db_Db::existsColumn('cm_model_location_ip', 'id')) {
        CM_Db_Db::exec('ALTER TABLE `cm_model_location_ip` CHANGE COLUMN `cityId` `id` int(10) unsigned NOT NULL ');
    }
    if (!CM_Db_Db::existsColumn('cm_model_location_ip', 'level')) {
        CM_Db_Db::exec('ALTER TABLE `cm_model_location_ip` ADD COLUMN `level` int(10) unsigned NOT NULL AFTER `id`');
    }
    if (CM_Db_Db::existsColumn('cm_model_location_ip', 'level')) {
        CM_Db_Db::update('cm_model_location_ip', array('level' => CM_Model_Location::LEVEL_CITY), array('level' => 0));
    }
    if (CM_Db_Db::existsTable('cm_model_location_country_ip')) {
        $result = CM_Db_Db::select('cm_model_location_country_ip', array('countryId', 'ipStart', 'ipEnd'));
        foreach ($result->fetchAll() as $row) {
            CM_Db_Db::insert('cm_model_location_ip', array('id' => $row['countryId'], 'level' => CM_Model_Location::LEVEL_COUNTRY, 'ipStart' => $row['ipStart'], 'ipEnd' => $row['ipEnd']));
        }
        CM_Db_Db::exec('DROP TABLE `cm_model_location_country_ip`');
    }
}
开发者ID:cargomedia,项目名称:cm,代码行数:26,代码来源:30.php

示例4: INT

<?php

if (!CM_Db_Db::existsIndex('cm_stream_subscribe', 'channelId-key')) {
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_subscribe` DROP INDEX `key`');
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_subscribe` DROP INDEX `channelId`');
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_subscribe` ADD UNIQUE `channelId-key` (`channelId`, `key`)');
}
if (!CM_Db_Db::existsIndex('cm_stream_publish', 'channelId-key')) {
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_publish` DROP INDEX `key`');
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_publish` DROP INDEX `channelId`');
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_publish` ADD UNIQUE `channelId-key` (`channelId`, `key`)');
}
if (!CM_Db_Db::describeColumn('cm_stream_publish', 'allowedUntil')->getAllowNull()) {
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_publish` CHANGE  `allowedUntil`  `allowedUntil` INT( 10 ) UNSIGNED NULL');
}
if (!CM_Db_Db::describeColumn('cm_stream_subscribe', 'allowedUntil')->getAllowNull()) {
    CM_Db_Db::exec('ALTER TABLE  `cm_stream_subscribe` CHANGE  `allowedUntil`  `allowedUntil` INT( 10 ) UNSIGNED NULL');
}
开发者ID:cargomedia,项目名称:cm,代码行数:18,代码来源:5.php

示例5:

<?php

if (CM_Db_Db::existsIndex('cm_streamChannel', 'key-adapterType')) {
    CM_Db_Db::exec('ALTER TABLE `cm_streamChannel` DROP INDEX `key-adapterType`');
    CM_Db_Db::exec('ALTER TABLE `cm_streamChannel` ADD UNIQUE `adapterType-key` (`adapterType`, `key`)');
}
if (CM_Db_Db::existsIndex('cm_streamChannel', 'key')) {
    CM_Db_Db::exec('ALTER TABLE `cm_streamChannel` DROP INDEX `key`');
}
开发者ID:cargomedia,项目名称:cm,代码行数:9,代码来源:6.php

示例6: INT

<?php

if (CM_Db_Db::existsIndex('cm_splittestVariation_fixture', 'fixtureId')) {
    CM_Db_Db::exec('
		ALTER TABLE cm_splittestVariation_fixture
			DROP INDEX fixtureId,
			DROP PRIMARY KEY');
}
if (CM_Db_Db::existsColumn('cm_splittestVariation_fixture', 'fixtureId')) {
    CM_Db_Db::exec('
		ALTER TABLE `cm_splittestVariation_fixture`
			CHANGE `fixtureId` `userId` INT(10) UNSIGNED NULL,
			ADD COLUMN `requestClientId` INT(10) UNSIGNED NULL AFTER `splittestId`');
}
if (!CM_Db_Db::existsIndex('cm_splittestVariation_fixture', 'userSplittest')) {
    CM_Db_Db::exec('
		ALTER TABLE cm_splittestVariation_fixture
			ADD UNIQUE `userSplittest` (`userId`, `splittestId`)');
}
if (!CM_Db_Db::existsIndex('cm_splittestVariation_fixture', 'requestClientSplittest')) {
    CM_Db_Db::exec('
		ALTER TABLE cm_splittestVariation_fixture
			ADD UNIQUE `requestClientSplittest` (`requestClientId`, `splittestId`)');
}
开发者ID:cargomedia,项目名称:cm,代码行数:24,代码来源:12.php

示例7: int

<?php

if (CM_Db_Db::existsIndex('cm_svm', 'trainingChanges')) {
    CM_Db_Db::exec('DROP INDEX `trainingChanges` on `cm_svm`');
}
if (CM_Db_Db::existsColumn('cm_svm', 'trainingChanges')) {
    CM_Db_Db::exec('
        ALTER TABLE `cm_svm`
          DROP COLUMN `trainingChanges`,
          ADD COLUMN `updateStamp` int(10) unsigned NOT NULL');
    CM_Db_Db::update('cm_svm', array('updateStamp' => time()));
}
开发者ID:cargomedia,项目名称:cm,代码行数:12,代码来源:27.php

示例8: KEY

<?php

if (CM_Db_Db::existsTable('cm_smileySet')) {
    CM_Db_Db::exec('DROP TABLE `cm_smileySet`;');
}
if (!CM_Db_Db::existsIndex('cm_smiley', 'code')) {
    CM_Db_Db::exec('ALTER TABLE `cm_smiley` ADD UNIQUE KEY (`code`);');
}
if (CM_Db_Db::existsColumn('cm_smiley', 'setId')) {
    CM_Db_Db::exec('ALTER TABLE `cm_smiley` DROP `setId`');
}
if (CM_Db_Db::existsTable('cm_smiley')) {
    CM_Db_Db::exec('RENAME TABLE `cm_smiley` TO `cm_emoticon`');
}
if (!CM_Db_Db::existsColumn('cm_emoticon', 'codeAdditional')) {
    CM_Db_Db::exec('ALTER TABLE `cm_emoticon` ADD `codeAdditional` varchar(50) AFTER `code`');
}
开发者ID:cargomedia,项目名称:cm,代码行数:17,代码来源:7.php


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