mirror of
https://github.com/ent/ent.git
synced 2026-05-01 07:00:57 +03:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user