Making table names unique as well.

This commit is contained in:
Vitor Pamplona 2024-04-09 18:21:40 -04:00
parent 8782f982eb
commit 360cc3cce2

10
41.md
View File

@ -6,20 +6,20 @@ Relational Database
`draft` `optional` `draft` `optional`
This NIP offers a plug-and-play method to export/sync information from existing systems using relational databases into Nostr. It is an application specific type where interoperability with other Nostr apps is not expected. 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. 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. 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 encrypted to the user. Values can be public or [NIP-44](44.md) encrypted to the user and placed in the `.content` field.
```js ```js
{ {
"kind": 31200, "kind": 31200,
"tags": [ "tags": [
["d", "<database-name:table-name:row-primary-key>"], ["d", "<database-name:table-name:row-primary-key>"],
["n", "<table-name>"], ["n", "<database-name:table-name>"],
["u", "<database-name>"], ["u", "<database-name>"],
["<column-name>", "<column-row-value>"], ["<column-name>", "<column-row-value>"],
["<foreign-key-column-name or single-letter-alias>", "<database-name:table-name:column-row-value>"] ["<foreign-key-column-name or single-letter-alias>", "<database-name:table-name:column-row-value>"]
@ -41,4 +41,4 @@ Since column names are arbitraryly defined by the data source, such data source
Inserts and updates are supported via Nostr's regular signing operations and deletions via [NIP-09](09.md). Inserts and updates are supported via Nostr's regular signing operations and deletions via [NIP-09](09.md).
The pubkey MAY be own by the system and represent several users from that system. The event's `pubkey` MAY be own by the system itself and represent several users from that system.