From ebb7482714606e96435691c0af2bc98023b0563e Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.afi-sa.local>
Date: Wed, 17 Aug 2016 09:30:19 +0200
Subject: [PATCH] hotline #46627 upgrade libelle field size in sql to 255

---
 cosmogramme/sql/patch/patch_304.php | 2 +-
 tests/db/UpgradeDBTest.php          | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/cosmogramme/sql/patch/patch_304.php b/cosmogramme/sql/patch/patch_304.php
index 658c7cbb069..73b9f7e3a50 100644
--- a/cosmogramme/sql/patch/patch_304.php
+++ b/cosmogramme/sql/patch/patch_304.php
@@ -2,5 +2,5 @@
 $adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
 
 try {
-  $adapter->query('ALTER TABLE notices_paniers DROP INDEX user_panier, DROP COLUMN id_panier');
+  $adapter->query('ALTER TABLE notices_paniers DROP INDEX user_panier, DROP COLUMN id_panier, MODIFY libelle VARCHAR(255)');
 } catch(Exception $e) {}
diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php
index 5c0dcaca962..43f4325512a 100644
--- a/tests/db/UpgradeDBTest.php
+++ b/tests/db/UpgradeDBTest.php
@@ -866,6 +866,7 @@ class UpgradeDB_304_Test extends UpgradeDBTestCase {
       $this->query('ALTER TABLE notices_paniers ADD COLUMN id_panier int(11) NOT NULL');
       $this->query('UPDATE notices_paniers SET id_panier = id');
       $this->query('ALTER TABLE notices_paniers ADD CONSTRAINT user_panier UNIQUE (id_user, id_panier)');
+      $this->query('ALTER TABLE notices_paniers MODIFY libelle VARCHAR(50)');
     } catch(Exception $e) {
     }
   }
@@ -881,4 +882,10 @@ class UpgradeDB_304_Test extends UpgradeDBTestCase {
   public function uniqueIndexUserPanierShouldNotExist() {
     $this->assertNotIndex('notices_paniers', 'user_panier');
   }
+
+
+  /** @test */
+  public function libelleShouldBeVarChar255() {
+    $this->assertFieldType('notices_paniers','libelle', 'varchar(255)');
+  }
 }
\ No newline at end of file
-- 
GitLab