diff --git a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
new file mode 100644
index 000000000..113e3288f
--- /dev/null
+++ b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php
@@ -0,0 +1,77 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Command;
+
+
+use Propel\Generator\Command\SqlBuildCommand;
+use Symfony\Component\Console\Input\ArrayInput;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Output\StreamOutput;
+use Symfony\Component\Filesystem\Filesystem;
+
+class ModuleGenerateSqlCommand extends BaseModuleGenerate {
+
+ public function configure()
+ {
+ $this
+ ->setName("module:generate:sql")
+ ->setDescription("Generate the sql from schema.xml file")
+ ->addArgument(
+ "name",
+ InputArgument::REQUIRED,
+ "Module name"
+ )
+ ;
+ }
+
+ public function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->module = $this->formatModuleName($input->getArgument("name"));
+ $this->moduleDirectory = THELIA_MODULE_DIR . DS . $this->module;
+
+ $fs = new Filesystem();
+
+ if ($fs->exists($this->moduleDirectory) === false) {
+ throw new \RuntimeException(sprintf("%s module does not exists"));
+ }
+
+ if ($fs->exists($this->moduleDirectory . DS . "Config" . DS . "schema.xml") === false) {
+ throw new \RuntimeException("schema.xml not found in Config directory. Needed file for generating model");
+ }
+
+ $sqlBuild = new SqlBuildCommand();
+ $sqlBuild->setApplication($this->getApplication());
+
+ $sqlBuild->run(
+ new ArrayInput(array(
+ "command" => $sqlBuild->getName(),
+ "--output-dir" => $this->moduleDirectory . DS ."Config",
+ "--input-dir" => $this->moduleDirectory . DS ."Config"
+ )),
+ new StreamOutput(fopen('php://memory', 'w', false))
+ );
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml
index c3efac45d..2ef8585ef 100755
--- a/core/lib/Thelia/Config/Resources/config.xml
+++ b/core/lib/Thelia/Config/Resources/config.xml
@@ -36,6 +36,7 @@
+