NIP-41 ====== Relational Database ------------------- `draft` `optional` This NIP offers a plug-and-play method to sync information from existing systems using relational databases into Nostr. It is an application-specific NIP where interoperability with other Nostr apps is not expected. Event kind `31200` represents a row in a database. Each value of the row is added as a tag whose name is the column's name. The `d` tag is used for the row's primary key, the `n` tag places the row into an unbound list to represent the table and the `u` tag references a database name. Clients MAY choose their app-name as a database name to improve the likelyhood of unique table names. Values can be public or [NIP-44](44.md) encrypted to the user and placed in the `.content` field. ```js { "kind": 31200, "tags": [ ["d", ""], ["n", ""], ["u", ""], ["", ""], ["", ""] // other public columns ], "content": nip44Encrypt(JSON.stringify(( [ ["", ""] // other private columns ] )), // .. other fields } ``` Foreign key values should be adjusted to match the corresponding `d`-tag they point to. Since column names are arbitraryly defined by the data source, such data source might also decide to map certain names to single letters to enable indexing by that column when on Nostr. Inserts and updates are supported via Nostr's regular signing operations and deletions via [NIP-09](09.md). The event's `pubkey` MAY be own by the system itself and represent several users from that system.