-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telegram notifications + replies. #53
Conversation
notifications/DDL.sql
Outdated
ALTER TABLE users ADD COLUMN IF NOT EXISTS telegram_user_id text NOT NULL; | ||
ALTER TABLE users ADD COLUMN IF NOT EXISTS telegram_bot_id text NOT NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not gonna work. U need a func that sets it atomically.
- Add nullable column if not exists
- Update column, set value = user_id
- Alter table make column not null
U have examples in eskimo/santa/husky how to do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or atleast tell me the exact sql to run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, lets make both columns nullable. And just handle the select with a coalesce
notifications/DDL.sql
Outdated
@@ -45,7 +49,7 @@ CREATE TABLE IF NOT EXISTS scheduled_notifications ( | |||
notification_channel_value TEXT NOT NULL, | |||
primary key(user_id,uniqueness,notification_type,notification_channel,notification_channel_value)); | |||
CREATE UNIQUE INDEX IF NOT EXISTS scheduled_notifications_i_ix ON scheduled_notifications (i); | |||
CREATE INDEX IF NOT EXISTS scheduled_notifications_mod_i_ix ON scheduled_notifications (MOD(i, %[1]v), scheduled_for ASC); | |||
CREATE INDEX IF NOT EXISTS scheduled_notifications_mod_i_ix ON scheduled_notifications (MOD(i, %[1]v), scheduled_for, notification_channel ASC); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not gonna do anything. U need to replace the index
Telegram notifications + replies.
Depends on ice-blockchain/wintr#48