#!/bin/sh
#
# create-sql-dump.sh - dump data from transaction database
#
# Developed by Lubomir Host 'rajo' <rajo AT platon.sk>
# Copyright (c) 2004 Platon SDG, http://platon.sk/
# Licensed under terms of GNU General Public License.
# All rights reserved.
#
# Changelog:
# 08/04/2004 - created
#
# $Platon: web-apps/finance-manager/sql/create-sql-dump.sh,v 1.1 2004/04/09 09:18:58 rajo Exp $
#
# Database tables for finanace-manager needs to be dumped in special order.
# This script tries fix this issue.
#
OUTPUT="finance.sql"
SQL_USER="finance"
SQL_HOST="localhost"
SQL_DATABASE="finance"
SQL_PASSWD=""
cat > $OUTPUT <<SQL
--
-- These lines are needed, because there is an TRANSACTION database !
--
DROP TABLE IF EXISTS Transaction;
DROP TABLE IF EXISTS Event;
DROP TABLE IF EXISTS Source;
DROP TABLE IF EXISTS event_type;
SQL
mysqldump --add-drop-table -u "$SQL_USER" -h "$SQL_HOST" "--password=$SQL_PASSWD" "$SQL_DATABASE" \
--tables Source event_type Event Transaction SourceLog EventLog \
>> "$OUTPUT"
Platon Group <platon@platon.sk> http://platon.sk/
|