(ctx context.Context, conn dialect.ExecQuerier, name string)
| 53 | } |
| 54 | |
| 55 | func (d *MySQL) tableExist(ctx context.Context, conn dialect.ExecQuerier, name string) (bool, error) { |
| 56 | query, args := sql.Select(sql.Count("*")).From(sql.Table("TABLES").Schema("INFORMATION_SCHEMA")). |
| 57 | Where(sql.And( |
| 58 | d.matchSchema(), |
| 59 | sql.EQ("TABLE_NAME", name), |
| 60 | )).Query() |
| 61 | return exist(ctx, conn, query, args...) |
| 62 | } |
| 63 | |
| 64 | // matchSchema returns the predicate for matching table schema. |
| 65 | func (d *MySQL) matchSchema(columns ...string) *sql.Predicate { |