Skip to content
Snippets Groups Projects
Commit f7a4324d authored by npedot's avatar npedot
Browse files

adds if not exists to sql create table

parent 6c223d51
No related branches found
No related tags found
No related merge requests found
......@@ -69,10 +69,12 @@ class SQLizeCreateUseCase {
private fun createTableCommand(createTable: CreateTable): String {
var cols = " "
for (col in createTable.columns) {
cols+="${col.name} ${col.dbtype} ,"
var colType = col.dbtype
if (colType == null || colType.trim().isEmpty()) colType = "varchar(64)"
cols+="${col.name} ${colType} ,"
}
cols = cols.dropLast(2)
return "CREATE TABLE ${createTable.name} ($cols);"
return "CREATE TABLE IF NOT EXISTS ${createTable.name} ($cols);"
}
private fun createViewCommand(createView: CreateView):String {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment