-----BEGIN PGP SIGNED MESSAGE-----
Hi, all --
I'm working up the schema for my application and, as you can imagine,
starting over and reloading numerous times :-) In fact, I intend for the
script to be an install script, run on a new installation of the software
to set things up.
The script starts out
drop database if exist dbname ;
create database dbname ; use dbname ;
create table tablename
to set things up and then continues
insert into tablename (field,field,field)
( data , data , data ) ,
( data , data , data ) ;
to set up the predefined things (credit card types and so on).
To reload the database and try something new, all I have to do is
mysql -udroot -p < script.sql
and what was there goes away and is rebuilt fresh. That's mighty
convenient as I'm building up a table's design and trying it out.
Soooooo... When you experienced folks write software that's meant to be
installed from a script or such, do you lead off with a 'drop database'
command, or is that just too dangerous to put in a script and you make
your users clean up any old installation by hand? This will have to be
run by a root user, so we can figure that this user might have read the
docs and know that he's going to start [over] from scratch, but then,
again, users are users :-)
Meanwhile, is there if/then/else functionailty in SQL so that I can say
if exist dbname exit "some error" ;
create database dbname ;
and not try to create and populate a database on top of an existing one?
Or is there perhaps a "RENAME DATABASE" command (I saw RENAME TABLE) so
that I could rename the old one to get it out of the way but not toss it?
TIA & HAND
David T-G * There is too much animal courage in
(play) davidtg@stripped * society and not sufficient moral courage.
(work) davidtgwork@stripped -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
-----END PGP SIGNATURE-----