{{{#!box important This page was a draft. See [wiki:TracDev/DatabaseSchema/NotificationSystem] page now. Table `notify_watch` is still in draft state. The [#OpenQuestions Open questions] section might still contain unimplemented ideas. }}} [[PageOutline(2)]] = Trac Database Schema: Notification The TracNotification module stores notification event subscriptions in the database. == Table `notify_subscription` ||'''Table'''||'''Key'''|| ||''notify_subscription''||''id''|| ||'''Columns'''||'''Type'''||'''Notes'''|| ||''id''||`auto_increment`|| || ||''time''||`int64`|| || ||''changetime''||`int64`|| || ||''class''|| || The name of the Python class that stored this subscription. || ||''sid''|| || The [wiki:TracDev/DatabaseSchema/Common#Tablesession session] ID of the subscriber. || ||''authenticated''||`int`|| `1` for authenticated session IDs, `0` for anonymous session IDs || ||''distributor''|| || Identifies the distributor to used for this subscription (e.g. `email`) || ||''format''|| || Identifies the MIME type to be used for this subscription (e.g. `text/plain` or `text/html`) || ||''priority''||`int`||Precedence level of this subscription. E.g. `1` overrules `2`. || ||''adverb''|| ||`always` or `never`|| ||'''Indices'''|| ||''sid'', ''authenticated''|| ||''class''|| Stores if a subscription rule always/never applies for a certain user, at what priority and using what distribution method/format. Use the `trac.notification.model.Subscription` model class to access this table. Note that this table does not store an (email) address, but the commonly used subscription tuple has an additional item `addr`. Usually such tuples that correspond to entries in this DB table contain a `addr` of `None`. Other tuples may contain an (email) address (e.g. retrieved from a ticket CC field) but are missing the `sid` item instead. See [browser:psuter/trac/notification/model.py@advanced-notification-subscriptions.2#/ trac.notification.model.Subscription] == Table `notify_watch` ||'''Table'''||'''Key'''|| ||''notify_watch''||''id''|| ||'''Columns'''||'''Type'''||'''Notes'''|| ||''id''||`auto_increment`|| || ||''sid''|| || The session ID of the subscriber. || ||''authenticated''||`int`|| `1` for authenticated session IDs, `0` for anonymous session IDs || ||''class''|| || The name of the Python class that stored this watch. || ||''realm''|| || The realm of this subscription (e.g. `ticket`). || ||''target''|| || The target of this subscription (e.g. a ticket id). || ||'''Indices'''|| ||''sid'', ''authenticated'', ''class''|| ||''class'', ''realm'', ''target''|| Stores watches to identify the target resource(s) of a subscription (e.g. a watched ticket's id, wiki page filters, joined groups, etc.) Use the `trac.notification.model.Watch` model class to access this table. See [browser:psuter/trac/notification/model.py@advanced-notification-dbtable-notify_watch#/ trac.notification.model.Watch] == Open Questions === Rename `class` column? Something like `rule` might be more appropriate. See also [wiki:TracDev/Proposals/AdvancedNotification/INotificationSubscriber#Removeclassname INotificationSubscriber]. === Rename `distributor` column? `transport` might be more consistent. === Rename tables? The current table names are taken from the th:AnnouncerPlugin. Would this cause problems for users that already used that plugin? DONE Renamed `subscription` to `notify_subscription`. DONE Renamed `subscription_attribute` to `notify_watch`. === Remove `time` and `changetime` columns? These are not really needed.