Add polished answer notifications (#1)
Sends a branded Resend email when a question receives its first answer, records accepted and failed sends, and adds collapsed answer editing with cancel behavior. Co-authored-by: codegirl-007 <s.raide@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -21,6 +21,20 @@ func migrateUserProfileColumns(ctx context.Context, exec execContext) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// migrateUserEmail adds email and a partial unique index on lower(email).
|
||||
func migrateUserEmail(ctx context.Context, exec execContext) error {
|
||||
if _, err := exec.ExecContext(ctx, `ALTER TABLE users ADD COLUMN IF NOT EXISTS email TEXT NOT NULL DEFAULT ''`); err != nil {
|
||||
return fmt.Errorf("add column email: %w", err)
|
||||
}
|
||||
if _, err := exec.ExecContext(ctx, `
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS users_email_lower_uidx
|
||||
ON users (lower(email))
|
||||
WHERE email <> ''`); err != nil {
|
||||
return fmt.Errorf("users_email_lower_uidx: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type execContext interface {
|
||||
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
|
||||
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
|
||||
@@ -66,6 +80,7 @@ CREATE TABLE IF NOT EXISTS schema_migrations (
|
||||
return applySchema(ctx, exec, schemaSQL)
|
||||
}},
|
||||
{"002_user_profile_columns", migrateUserProfileColumns},
|
||||
{"003_user_email", migrateUserEmail},
|
||||
}
|
||||
for _, m := range migrations {
|
||||
if applied[m.version] {
|
||||
|
||||
Reference in New Issue
Block a user