MCPcopy
hub / github.com/pocketbase/pocketbase / initMigrationsTable

Method initMigrationsTable

core/migrations_runner.go:246–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

244}
245
246func (r *MigrationsRunner) initMigrationsTable() error {
247 if r.inited {
248 return nil // already inited
249 }
250
251 rawQuery := fmt.Sprintf(
252 "CREATE TABLE IF NOT EXISTS {{%s}} (file VARCHAR(255) PRIMARY KEY NOT NULL, applied INTEGER NOT NULL)",
253 r.tableName,
254 )
255
256 _, err := r.app.DB().NewQuery(rawQuery).Execute()
257
258 if err == nil {
259 r.inited = true
260 }
261
262 return err
263}
264
265func (r *MigrationsRunner) isMigrationApplied(txApp App, file string) bool {
266 var exists int

Callers 3

RunMethod · 0.95
UpMethod · 0.95
DownMethod · 0.95

Calls 3

ExecuteMethod · 0.80
NewQueryMethod · 0.80
DBMethod · 0.65

Tested by

no test coverage detected