Skip to content

Commit

Permalink
Merge pull request #44 from tmc/ddl_not_exists
Browse files Browse the repository at this point in the history
add CreateTablesIfNotExistsSql
  • Loading branch information
jmoiron committed Apr 17, 2016
2 parents ff76031 + e8f150a commit 99654d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dbmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ func (m *DbMap) CreateTablesSql() (map[string]string, error) {
return m.createTables(false, false)
}

// CreateTablesIfNotExistsSql returns create table SQL as a map of table names to
// their associated CREATE TABLE IF NOT EXISTS statements.
func (m *DbMap) CreateTablesIfNotExistsSql() (map[string]string, error) {
return m.createTables(true, false)
}

// CreateTables iterates through TableMaps registered to this DbMap and
// executes "create table" statements against the database for each.
//
Expand Down

0 comments on commit 99654d0

Please sign in to comment.