fix schema for postgres
This commit is contained in:
parent
0177c08cee
commit
cb67f794ce
|
@ -149,7 +149,8 @@ func (db *Base) SupportDropIfExists() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Base) DropTableSql(tableName string) string {
|
func (db *Base) DropTableSql(tableName string) string {
|
||||||
return fmt.Sprintf("DROP TABLE IF EXISTS `%s`", tableName)
|
quote := db.dialect.Quote
|
||||||
|
return fmt.Sprintf("DROP TABLE IF EXISTS %s", quote(tableName))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *Base) HasRecords(query string, args ...interface{}) (bool, error) {
|
func (db *Base) HasRecords(query string, args ...interface{}) (bool, error) {
|
||||||
|
|
2
index.go
2
index.go
|
@ -22,6 +22,8 @@ type Index struct {
|
||||||
func (index *Index) XName(tableName string) string {
|
func (index *Index) XName(tableName string) string {
|
||||||
if !strings.HasPrefix(index.Name, "UQE_") &&
|
if !strings.HasPrefix(index.Name, "UQE_") &&
|
||||||
!strings.HasPrefix(index.Name, "IDX_") {
|
!strings.HasPrefix(index.Name, "IDX_") {
|
||||||
|
tableName = strings.Replace(tableName, `"`, "", -1)
|
||||||
|
tableName = strings.Replace(tableName, `.`, "_", -1)
|
||||||
if index.Type == UniqueType {
|
if index.Type == UniqueType {
|
||||||
return fmt.Sprintf("UQE_%v_%v", tableName, index.Name)
|
return fmt.Sprintf("UQE_%v_%v", tableName, index.Name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue