|
Posted by Lorenzo Bettini on 01/19/07 18:09
Carl Pearson wrote:
> Lorenzo Bettini wrote:
>> Carl Pearson wrote:
>> the generated php code I have in mind would be used, e.g., in an
>> installation procedure to generate (or, more interestingly, update)
>> the tables of the database.
>
> Ultimately it's just a bunch of calls to mysql_query().
>
> You could use phpMyAdmin to dump your existing structure into a file,
> incorporating it into your install script, using your text editor's
> search & replace capabilities to wrangle the dump into shape. A chore,
> but still you'd only have to do it once, and having a dump would save
> you from having to type all those table defs by hand.
>
> For updates, are you talking about the data, or the structure?
>
> If data, just create the appropriate queries and have your script turn
> the results into insert statements (don't run them on the same database,
> just use PHP to add the "INSERT INTO" & other code before it echo's or
> prints anything out...), saving that as a file. Am presuming here you'd
> run the queries on one machine and the resulting file on another.
>
> For structure, you really shouldn't be changing that too much once the
> database is up & running, so that would just be another bunch of
> statements that you'd design ahead of time, stuffing them all into a
> script similar to the structure generation method above.
>
I'm actually talking about updating the structure.
What I do now is change the structure from phpmyadmin, copy the sql code
that phpmyadmin writes into a an sql file and tell the users to update
the database with that file (using a mysql command line).
I was looking for a more friendly way (say a page update.php) that
automatically checks the difference between the current version of the
database structure and the new one (when a new release of the software
is shipped).
Possibly, I'd like to avoid writing these things manually, and have
these procedures generated automatically.
This way the update procedure comes with its own structure of the
database, checks it agains the current version (i.e., performs a kind of
diff) and then brings the old structure to the new one...
--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
[Back to original message]
|