CREATE TABLE IF NOT EXISTS `subscribers` (
  `subscriber_id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  `user_id` INTEGER NOT NULL,
  `kind` VARCHAR(16) NOT NULL,
  `arguments` JSON NOT NULL DEFAULT '{}',
  FOREIGN KEY(`user_id`)
    REFERENCES users(user_id)
      ON DELETE CASCADE
);

CREATE UNIQUE INDEX IF NOT EXISTS subscribers_kind_user_id
  ON subscribers (`kind`, `user_id`);
