CodeIgniter Forums
DBForge create_database if not exists - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: DBForge create_database if not exists (/showthread.php?tid=66386)



DBForge create_database if not exists - AmitMY - 10-18-2016

Like `create_table`, the `create_database` method should have `$exists = false`
Such that:
`create_database("name", true)` will render a "CREATE DATABASE `name` IF NOT EXISTS"
and in case it returns an error, will NOT call "show_error" (which exists the page)

This is changing just a few lines of code, with not DB engine compatibility issue to my knowledge


RE: DBForge create_database if not exists - Narf - 10-19-2016

Well, there are databases that don't support this ... we have to go through the docs of all platforms and see which ones do and which ones don't.
Other than that, yes - I don't see a problem with this either.


RE: DBForge create_database if not exists - AmitMY - 10-19-2016

Thanks. Because there were no objections, I took the liberty to create a pull request