Closed dhensby closed 8 years ago
Someone triple check the sed usage here is correct and we can merge it.
quick question, shouldn't the sspak decide which db to use, ie remove any create db or use db statement? I'm a bit uncertain what is expected here.
I think any CREATE DATABASE
or USE
statements aren't needed as all, @stojg. The snapshot restore scripts will choose the database that will be restored, not the SQL itself.
is there any case where one of those statements would be on a line with other statements, and sed might mangle the SQL?
@halkyon But if the SQL contains a USE mydatabase that will override the the SSPAK derived db?
Sorry, @halkyon just notified me about that it's not a replace Create with Update.. i need to learn how to read properly.
Looks good to me
well thank you for that :)
for clarity, what tends to happen is:
CREATE IF NOT EXISTS
for the existing DB name and then a USE
to select itthis fix removes those create and use statements so it's always imported into the DB defined for the SS site
This fixes an issue where a sql dump has a
USE
orCREATE
statement.sspak won't handle that well and will end up creating a new DB instead of importing into the target DB.
This change strips out lines starting with
USE
orCREATE
to ensure that the intended DB is used.