Hi, I use a Factory (design pattern) to decide which database API to use, such as MySql, Postgre and SQLite for example 🙂
The Factory decided based on a configuration variable DB_TYPE. This will solve the API issue for you, as for actual scripting I would suggest that you could use HEREDOC to create your database specific SQL ?
That way you do not actually need to alter the script, just the HEREDOCs, which can be in their own file which you just include as required 🙂