mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
altered migration to set default github domain and url
This commit is contained in:
parent
cb042e1c1a
commit
a200c7a0a2
@ -14,6 +14,9 @@ func (r *Rev3) Up(op Operation) error {
|
||||
return err
|
||||
}
|
||||
_, err = op.AddColumn("settings", "github_apiurl VARCHAR(255)")
|
||||
|
||||
op.Exec("update settings set github_domain=?", "github.com")
|
||||
op.Exec("update settings set github_apiurl=?", "https://api.github.com")
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ func (m *Migration) All() *Migration {
|
||||
|
||||
// List all migrations here
|
||||
m.Add(RenamePrivelegedToPrivileged)
|
||||
m.Add(GitHubEnterpriseSupport)
|
||||
|
||||
// m.Add(...)
|
||||
// ...
|
||||
|
@ -64,6 +64,12 @@ type Operation interface {
|
||||
DropColumns(tableName string, columnsToDrop []string) (sql.Result, error)
|
||||
|
||||
RenameColumns(tableName string, columnChanges map[string]string) (sql.Result, error)
|
||||
|
||||
Exec(query string, args ...interface{}) (sql.Result, error)
|
||||
|
||||
Query(query string, args ...interface{}) (*sql.Rows, error)
|
||||
|
||||
QueryRow(query string, args ...interface{}) *sql.Row
|
||||
}
|
||||
|
||||
type Revision interface {
|
||||
|
@ -15,6 +15,18 @@ func SQLite(tx *sql.Tx) Operation {
|
||||
return &SQLiteDriver{Tx: tx}
|
||||
}
|
||||
|
||||
func (s *SQLiteDriver) Exec(query string, args ...interface{}) (sql.Result, error) {
|
||||
return s.Tx.Exec(query, args)
|
||||
}
|
||||
|
||||
func (s *SQLiteDriver) Query(query string, args ...interface{}) (*sql.Rows, error) {
|
||||
return s.Tx.Query(query, args)
|
||||
}
|
||||
|
||||
func (s *SQLiteDriver) QueryRow(query string, args ...interface{}) *sql.Row {
|
||||
return s.Tx.QueryRow(query, args)
|
||||
}
|
||||
|
||||
func (s *SQLiteDriver) CreateTable(tableName string, args []string) (sql.Result, error) {
|
||||
return s.Tx.Exec(fmt.Sprintf("CREATE TABLE %s (%s);", tableName, strings.Join(args, ", ")))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user