More progress on db schema setup and migrations, tricky stuff
This commit is contained in:
1 parent
38f237efcb
commit
68a77c4051
9 files changed
+146
-40
No files matched your search
@@ -8,11 +8,24 @@ type Dialect interface {
|
||||
type Sqlite3 struct {
|
||||
}
|
||||
|
||||
type Mysql struct {
|
||||
}
|
||||
|
||||
func (db *Sqlite3) DBType() string {
|
||||
return "sqlite3"
|
||||
}
|
||||
|
||||
func (db *Mysql) DBType() string {
|
||||
return "mysql"
|
||||
}
|
||||
|
||||
func (db *Sqlite3) TableCheckSql(tableName string) (string, []interface{}) {
|
||||
args := []interface{}{tableName}
|
||||
return "SELECT name FROM sqlite_master WHERE type='table' and name = ?", args
|
||||
}
|
||||
|
||||
func (db *Mysql) TableCheckSql(tableName string) (string, []interface{}) {
|
||||
args := []interface{}{"grafana", tableName}
|
||||
sql := "SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=?"
|
||||
return sql, args
|
||||
}
|
||||
Reference in new issue
Block a user