diff --git a/VERSIONS_HOTLINE/160807 b/VERSIONS_HOTLINE/160807 new file mode 100644 index 0000000000000000000000000000000000000000..8950df74ebe8c1714011a0737d725ae290492431 --- /dev/null +++ b/VERSIONS_HOTLINE/160807 @@ -0,0 +1 @@ + - correctif #160807 : Cosmogramme : taille maximum des indices Dewey élargie à 255 caractères \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_436.php b/cosmogramme/sql/patch/patch_436.php new file mode 100644 index 0000000000000000000000000000000000000000..7efde9f875b946afbd01003ad4025756abf248b8 --- /dev/null +++ b/cosmogramme/sql/patch/patch_436.php @@ -0,0 +1,10 @@ +<?php +$adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); +try { + $adapter->query('alter table codif_dewey drop primary key'); +} catch(Exception $e) {} + +try { + $adapter->query('alter table codif_dewey modify id_dewey varchar(255)'); + $adapter->query('alter table codif_dewey add primary key (id_dewey)'); +} catch(Exception $e) {} diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php index 82e123f310c5532905e360524564891edea11b59..5686a10b78deb32d318d343eeab29a405cd94ead 100644 --- a/tests/db/UpgradeDBTest.php +++ b/tests/db/UpgradeDBTest.php @@ -4699,3 +4699,25 @@ class UpgradeDB_435_Test extends UpgradeDBTestCase { $this->assertFieldType('records_identifiers', $field, $type); } } + + + + +class UpgradeDB_436_Test extends UpgradeDBTestCase { + public function prepare() { + $this->silentQuery('alter table codif_dewey modify id_dewey varchar(30)'); + } + + + /** @test */ + public function tableCodifDeweyShouldHaveColumnIdDeweyWithTypeVarchar255() { + $this->assertFieldType('codif_dewey', 'id_dewey', 'varchar(255)'); + } + + + /** @test */ + public function tableCodifDeweyShouldHaveIdDeweyAsPrimary() { + $columns = $this->query("show columns from codif_dewey where field='id_dewey'")->fetch(); + $this->assertEquals('PRI', $columns['Key']); + } +}