One of the uses of this package is to handle db migrations. Sometimes a migration might need to have more than one statement. The migrations are created as a .sql file, then when ran the code reads in the sql file and does a db.query(sqlFileContents). Most of the time this works as the sql file is just a single statement, however, I often have migrations that need more than that. My work around so far is just to split up all the statements. My problem now is creating stored procs.
But if there is a way to do this all in one or if there is some setting to allow multiple statements (despite security reasons) I would love to know. Thank you.
Turns out the DELIMITER change is not needed and the db.query(sqlFileContents) will work without it. I will just update the scripts and continue on. Thanks.
One of the uses of this package is to handle db migrations. Sometimes a migration might need to have more than one statement. The migrations are created as a .sql file, then when ran the code reads in the sql file and does a
db.query(sqlFileContents)
. Most of the time this works as the sql file is just a single statement, however, I often have migrations that need more than that. My work around so far is just to split up all the statements. My problem now is creating stored procs.How do I handle setting the DELIMITER when only 1 statement is allowed?
My thinking is to do something like:
But if there is a way to do this all in one or if there is some setting to allow multiple statements (despite security reasons) I would love to know. Thank you.