dolibarr/mysql/Makefile

86 lines
2.7 KiB
Makefile
Raw Normal View History

2003-06-19 12:15:19 +02:00
# Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2002-04-29 22:54:57 +02:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
2003-06-19 12:15:19 +02:00
# $Id$
# $Source$
#
2002-05-06 21:10:48 +02:00
# General Makefile for Mysql database
#
2002-04-29 22:54:57 +02:00
MYSQL=mysql
BASE=dolibarr
2002-12-19 14:59:58 +01:00
OPTIONS=
2002-04-29 22:54:57 +02:00
TABLES=$(shell find tables/ -name "*sql")
2002-04-29 22:54:57 +02:00
all:
cat README
2002-04-29 22:54:57 +02:00
show:
cd tables \
&& make show BASE=$(BASE) OPTIONS=$(OPTIONS)
2002-04-29 22:54:57 +02:00
table:
cd tables \
&& make create BASE=$(BASE) OPTIONS=$(OPTIONS)
2002-04-29 22:54:57 +02:00
2002-04-30 12:44:42 +02:00
dev:
2002-05-09 17:32:46 +02:00
cd data \
&& make dev BASE=$(BASE) OPTIONS=$(OPTIONS)
2002-05-09 17:32:46 +02:00
2002-04-30 12:44:42 +02:00
fulldev: drop table load dev
2002-05-03 23:57:30 +02:00
drop:
$(MYSQL) $(OPTIONS) $(BASE) < drop.sql
2002-04-29 22:54:57 +02:00
load:
2002-12-19 14:59:58 +01:00
$(MYSQL) $(OPTIONS) $(BASE) < data/data.sql
2002-04-29 22:54:57 +02:00
dropall: dropdb droppriv
2002-04-29 22:54:57 +02:00
droppriv:
$(MYSQL) $(OPTIONS) mysql -e "delete from db where Db='$(BASE)' ; "
2002-04-29 22:54:57 +02:00
dropdb:
$(MYSQL) $(OPTIONS) mysql -f -e "drop database if exists $(BASE) ; "
2002-04-29 22:54:57 +02:00
create: drop createdb createpriv
createdb:
$(MYSQL) $(OPTIONS) mysql -e "create database $(BASE) ; "
2002-04-29 22:54:57 +02:00
createpriv:
$(MYSQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set select_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set insert_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set update_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set delete_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set create_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set drop_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set grant_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set references_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set index_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "update db set alter_priv = 'Y' where db='$(BASE)' ; "
$(MYSQL) $(OPTIONS) mysql -e "flush privileges ; "
mysql.sql: $(TABLES) data/data.sql
find tables/ -name "*sql" | xargs cat | grep -v ^-- | cut -d "-" -f 1 > mysql.sql
cat data/data.sql | grep -v ^-- >> mysql.sql
cvs commit mysql.sql