Schema v3: goals.close_at_target and alert_defs table (contract in docs)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-15 12:50:26 -08:00
1 parent f8d6bc2195
commit da1365f060
2 files changed
+30 -1

No files matched your search

+22 -1
View File
@@ -8,7 +8,7 @@ namespace StreamGoals\Core;
*/
final class Installer {
public const DB_VERSION = '2';
public const DB_VERSION = '3';
public static function activate(): void {
self::install_schema();
@@ -39,6 +39,7 @@ final class Installer {
starts_at DATETIME NULL,
ends_at DATETIME NULL,
counts_fees TINYINT(1) NOT NULL DEFAULT 0,
close_at_target TINYINT(1) NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
PRIMARY KEY (id)
) $c;" );
@@ -122,6 +123,26 @@ final class Installer {
KEY status_id (status,id)
) $c;" );
dbDelta( "CREATE TABLE {$p}alert_defs (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
goal_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
trigger_type VARCHAR(8) NOT NULL DEFAULT 'amount',
min_minor BIGINT UNSIGNED NOT NULL DEFAULT 0,
action_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
title VARCHAR(120) NOT NULL DEFAULT '',
visual_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
visual_type VARCHAR(6) NOT NULL DEFAULT '',
sound_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
volume TINYINT UNSIGNED NOT NULL DEFAULT 80,
duration_ms INT UNSIGNED NOT NULL DEFAULT 6000,
message VARCHAR(255) NOT NULL DEFAULT '',
enabled TINYINT(1) NOT NULL DEFAULT 1,
sort INT NOT NULL DEFAULT 0,
created_at DATETIME NOT NULL,
PRIMARY KEY (id),
KEY goal_enabled (goal_id,enabled)
) $c;" );
update_option( 'sg_db_version', self::DB_VERSION );
}
}