Skip to content
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

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Conversation

ice-myles
Copy link
Contributor

@ice-myles ice-myles commented Jul 1, 2024

Telegram notifications + replies.

Depends on ice-blockchain/wintr#48

@ice-myles ice-myles added the enhancement New feature or request label Jul 1, 2024
@ice-myles ice-myles self-assigned this Jul 1, 2024
@ice-myles ice-myles requested a review from a team as a code owner July 1, 2024 11:53
@ice-myles ice-myles enabled auto-merge (squash) July 1, 2024 11:54
Comment on lines 23 to 24
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;
Copy link
Contributor

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.

  1. Add nullable column if not exists
  2. Update column, set value = user_id
  3. Alter table make column not null

U have examples in eskimo/santa/husky how to do that

Copy link
Contributor

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

Copy link
Contributor

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

@@ -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);
Copy link
Contributor

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

@ice-ares ice-ares merged commit cae1737 into master Jul 2, 2024
20 checks passed
@ice-ares ice-ares deleted the feature/telegram-notifications branch July 2, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants