dialect/sql/schema: add IndexBuilder.IfNotExists and use for Create() case. (#1666)

Append-only mode creates tables with the `IF NOT EXISTS` annotation.
Make indices case symmetric with this.
This commit is contained in:
bshihr
2021-06-29 23:09:48 -07:00
committed by GitHub
parent 7ffdce4cef
commit 4066255641
5 changed files with 25 additions and 7 deletions

View File

@@ -142,9 +142,9 @@ func (d *SQLite) addColumn(c *Column) *sql.ColumnBuilder {
return b
}
// addIndex returns the querying for adding an index to SQLite.
// addIndex returns the query for adding an index to SQLite.
func (d *SQLite) addIndex(i *Index, table string) *sql.IndexBuilder {
return i.Builder(table)
return i.Builder(table).IfNotExists()
}
// dropIndex drops a SQLite index.