diff --git a/core/lib/Thelia/Model/ModuleQuery.php b/core/lib/Thelia/Model/ModuleQuery.php
index dfe9b1b3c..c1f9394dd 100644
--- a/core/lib/Thelia/Model/ModuleQuery.php
+++ b/core/lib/Thelia/Model/ModuleQuery.php
@@ -25,6 +25,7 @@ class ModuleQuery extends BaseModuleQuery
if (null === self::$activated) {
self::$activated = self::create()
->filterByActivate(1)
+ ->orderByPosition()
->find();
}
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 52a0b4319..76691e422 100644
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -728,6 +728,9 @@
+
+
+
diff --git a/setup/thelia.sql b/setup/thelia.sql
index 71c5c0e48..02177f0f1 100644
--- a/setup/thelia.sql
+++ b/setup/thelia.sql
@@ -866,7 +866,8 @@ CREATE TABLE `module`
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
- UNIQUE INDEX `code_UNIQUE` (`code`)
+ UNIQUE INDEX `code_UNIQUE` (`code`),
+ INDEX `idx_module_position` (`position`)
) ENGINE=InnoDB CHARACTER SET='utf8';
-- ---------------------------------------------------------------------
diff --git a/setup/update/2.0.1.sql b/setup/update/2.0.1.sql
new file mode 100644
index 000000000..8e3192226
--- /dev/null
+++ b/setup/update/2.0.1.sql
@@ -0,0 +1,12 @@
+# This is a fix for InnoDB in MySQL >= 4.1.x
+# It "suspends judgement" for fkey relationships until are tables are set.
+SET FOREIGN_KEY_CHECKS = 0;
+
+UPDATE `config` SET `value`='2.0.1' WHERE `name`='thelia_version';
+UPDATE `config` SET `value`='' WHERE `name`='thelia_extra_version';
+
+
+ALTER TABLE `module` ADD INDEX `idx_module_position` (`position`);
+
+
+SET FOREIGN_KEY_CHECKS = 1;