Reputation: 26458
Sometimes I write comments in MySQL stored procedure, but after database recovery, all the comments are lost. How to prevent comments lost? Thanks!
Upvotes: 1
Views: 1735
Reputation: 8291
This is a common problem with the mysql CLI. By default, it strips out all the comments from the SQL restore file.
Use --comments on the command line to prevent mysql CLI from stripping out the comments. Works for me.
eg. mysql mydb -u root -ppassword --comments < /tmp/db_to_restore.sql
Upvotes: 3
Reputation: 1074138
Your database should not be where your source code for your stored procedures is stored. That should be in a source code control system so that you have access to previous revisions, modification history, etc., etc. (And, of course, that means you've stored the actual files you edit, and so the comments will remain intact.) The database is where the code is deployed, not where it's stored.
Upvotes: 2