Skip to content

Commit 8bc0cce

Browse files
committed
fix: update default values for visible_when column in macros table
1 parent f6e2fc1 commit 8bc0cce

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

internal/migrations/v0.6.0.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,10 @@ func V0_6_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
306306
// Add visible_when column to macros table if it doesn't exist
307307
_, err = db.Exec(`
308308
ALTER TABLE macros
309-
ADD COLUMN IF NOT EXISTS visible_when macro_visible_when[] NOT NULL DEFAULT ARRAY[]::macro_visible_when[];
309+
ADD COLUMN IF NOT EXISTS visible_when macro_visible_when[] NOT NULL DEFAULT ARRAY['replying', 'starting_conversation', 'adding_private_note']::macro_visible_when[];
310310
`)
311311
if err != nil {
312312
return err
313313
}
314-
315-
316314
return nil
317315
}

schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ CREATE TABLE macros (
292292
name TEXT NOT NULL,
293293
actions JSONB DEFAULT '{}'::jsonb NOT NULL,
294294
visibility macro_visibility NOT NULL,
295-
visible_when macro_visible_when[] NOT NULL DEFAULT ARRAY[]::macro_visible_when[],
295+
visible_when macro_visible_when[] NOT NULL DEFAULT ARRAY['replying', 'starting_conversation', 'adding_private_note']::macro_visible_when[],
296296
message_content TEXT NOT NULL,
297297
-- Cascade deletes when user is deleted.
298298
user_id BIGINT REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE,

0 commit comments

Comments
 (0)