From 9e4f632d9920acb16bd16cf9e9808c73a91a4d8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Tue, 9 Feb 2010 13:20:15 +0000
Subject: [PATCH]  - experimental support to create database for site

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32356 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 buildout/development.cfg            | 4 +++-
 buildout/zope-instance/buildout.cfg | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/buildout/development.cfg b/buildout/development.cfg
index d1735c5a6e4..b9b6d814f8c 100644
--- a/buildout/development.cfg
+++ b/buildout/development.cfg
@@ -27,7 +27,9 @@ products += ${products-development:location}
 # Format:
 #     database[@host[:port]] [user [password [unix_socket]]]
 #   e.g "erp5db erp5user somepassword" or "erp5db erp5user"
-erp5_sql_connection_string =  test@${configuration:mysql_host}:${configuration:mysql_port} root
+mysql_database_name = development_site
+
+erp5_sql_connection_string = ${:mysql_database_name}@${configuration:mysql_host}:${configuration:mysql_port} root
 bt5 =
    erp5_base
    erp5_forge
diff --git a/buildout/zope-instance/buildout.cfg b/buildout/zope-instance/buildout.cfg
index 4fe565d31a4..67c90f96e89 100644
--- a/buildout/zope-instance/buildout.cfg
+++ b/buildout/zope-instance/buildout.cfg
@@ -36,7 +36,14 @@ products =
   ${products-erp5:location}
   ${products-other:location}
 
+[create_mysql_database]
+# XXX: This have to be converted into recipe
+recipe = plone.recipe.command
+command =
+  echo "CREATE DATABASE IF NOT EXISTS ${create_erp5_site:mysql_database_name}" | ${buildout:bin-directory}/mysql -u root
+
 [create_erp5_site]
+depends = ${create_mysql_database:command}
 recipe = erp5.recipe.createsite
 portal_id = erp5
 control-script = ${zope-instance:control-script}
-- 
2.30.9