本文整理汇总了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`');
}
示例2: testExistsIndex
public function testExistsIndex()
{
$this->assertSame(true, CM_Db_Db::existsIndex('test', 'foo'));
$this->assertSame(false, CM_Db_Db::existsIndex('test', 'test'));
}
示例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`');
}
}
示例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');
}
示例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`');
}
示例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`)');
}
示例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()));
}
示例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`');
}