Ejemplo n.º 1
0
    public function testDescribeColumnThrowsException()
    {
        CM_Db_Db::exec('
			CREATE TABLE `test2` (
				`id` int(12) unsigned NOT NULL AUTO_INCREMENT,
				PRIMARY KEY (`id`)
			)');
        try {
            CM_Db_Db::describeColumn('test2', 'id');
            CM_Db_Db::describeColumn('test2', 'id1');
            $this->fail('Column doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertContains('`id1`', $e->getMessage());
        }
        try {
            CM_Db_Db::describeColumn('test_', 'id');
            $this->fail('Table doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertContains('`id`', $e->getMessage());
        }
        CM_Db_Db::exec('DROP TABLE `test2`');
    }
Ejemplo n.º 2
0
    public function testDescribeColumnThrowsException()
    {
        CM_Db_Db::exec('
			CREATE TABLE `test2` (
				`id` INT(12) UNSIGNED NOT NULL AUTO_INCREMENT,
				PRIMARY KEY (`id`)
			)');
        try {
            CM_Db_Db::describeColumn('test2', 'id');
            CM_Db_Db::describeColumn('test2', 'id1');
            $this->fail('Column doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertSame('Column not found', $e->getMessage());
            $this->assertSame(['column' => 'id1'], $e->getMetaInfo());
        }
        try {
            CM_Db_Db::describeColumn('test_', 'id');
            $this->fail('Table doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertContains('`id`', $e->getMetaInfo()['query']);
        }
        CM_Db_Db::exec('DROP TABLE `test2`');
    }
Ejemplo n.º 3
0
Archivo: 39.php Proyecto: cargomedia/cm
<?php

if ('1.00' === CM_Db_Db::describeColumn('cm_splittestVariation_fixture', 'conversionWeight')->getDefaultValue()) {
    CM_Db_Db::exec('ALTER TABLE cm_splittestVariation_fixture
      MODIFY COLUMN conversionWeight decimal(10,2) NOT NULL DEFAULT 0');
    CM_Db_Db::update('cm_splittestVariation_fixture', array('conversionWeight' => 0), array('conversionStamp' => null));
}
Ejemplo n.º 4
0
Archivo: 42.php Proyecto: cargomedia/cm
<?php

// To be run in prod beforehand:
// pt-online-schema-change --execute --charset=utf8 --user=root --ask-pass --database=skadate t=cm_user --alter='CHANGE `site` `site` int(10) unsigned DEFAULT NULL'
if ('INT' !== CM_Db_Db::describeColumn('cm_user', 'site')->getType()) {
    CM_Db_Db::exec("ALTER TABLE `cm_user` CHANGE `site` `site` int(10) unsigned DEFAULT NULL;");
}
Ejemplo n.º 5
0
Archivo: 64.php Proyecto: cargomedia/cm
<?php

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 DEFAULT NULL");
}
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 DEFAULT NULL");
}
Ejemplo n.º 6
0
Archivo: 17.php Proyecto: cargomedia/cm
<?php

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 NOT 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 NOT NULL');
}
Ejemplo n.º 7
0
Archivo: 19.php Proyecto: cargomedia/cm
<?php

if (!CM_Db_Db::describeColumn('cm_streamChannelArchive_video', 'userId')->getAllowNull()) {
    CM_Db_Db::exec('ALTER TABLE  `cm_streamChannelArchive_video` CHANGE  `userId`  `userId` INT( 10 ) UNSIGNED NULL ;');
}