diff --git a/db/migrations/controller.go b/db/migrations/controller.go index 8218b0a..22444fb 100644 --- a/db/migrations/controller.go +++ b/db/migrations/controller.go @@ -22,6 +22,7 @@ func Migrate(db *sql.DB) { migrationWrapper(v9, 9)(db) migrationWrapper(v10, 10)(db) migrationWrapper(v11, 11)(db) + migrationWrapper(v12, 12)(db) helpers.LogLocalf(helpers.INFO, nil, "Migrations ran through. Schema version: %d", schema(db)) } diff --git a/db/migrations/v12.go b/db/migrations/v12.go new file mode 100644 index 0000000..4505f52 --- /dev/null +++ b/db/migrations/v12.go @@ -0,0 +1,21 @@ +package migrations + +import ( + "database/sql" + "log" +) + +func v12(db *sql.Tx) { + v12AddLeadingSlashSetting(db) +} + +func v12AddLeadingSlashSetting(db *sql.Tx) { + sqlStatement := ` + INSERT INTO "bot::userSettingTypes" ("setting", "description") VALUES + ('user.omitCommandSlash', 'make leading slash for commands optional'); + ` + _, err := db.Exec(sqlStatement) + if err != nil { + log.Fatal(err) + } +} diff --git a/scenarioTests/features/config.feature b/scenarioTests/features/config.feature new file mode 100644 index 0000000..5e6dc05 --- /dev/null +++ b/scenarioTests/features/config.feature @@ -0,0 +1,7 @@ +Feature: config user settings + + Scenario: test config command handling + Given I have a bot + When I send the message "/config omit_slash on" + Then 1 messages should be sent back + And the response should include the message "has successfully been turned on"