docs: overhaul project documentation and contributing guide (Task #190)
This commit is contained in:
43
docs/data-model.md
Normal file
43
docs/data-model.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 📊 Data Model
|
||||
|
||||
Plexus uses **DuckDB** for fast, analytical, and serverless-friendly data storage.
|
||||
|
||||
## 🗄 Tables
|
||||
|
||||
### `users`
|
||||
Stores user identity and profile information.
|
||||
- `wallet_address` (VARCHAR, PK): Unique Solana wallet address.
|
||||
- `username` (VARCHAR, UNIQUE): Display name.
|
||||
- `bio` (VARCHAR): User biography.
|
||||
- `banner_color` (VARCHAR): Hex code for profile banner.
|
||||
- `last_seen` (TIMESTAMP): Last activity time.
|
||||
|
||||
### `messages`
|
||||
Stores chat history.
|
||||
- `id` (INTEGER, PK): Unique message ID (from `seq_msg_id`).
|
||||
- `channel_id` (VARCHAR): ID of the channel.
|
||||
- `wallet_address` (VARCHAR, FK): Sender's wallet.
|
||||
- `content` (VARCHAR): Message text.
|
||||
- `timestamp` (TIMESTAMP): Time sent.
|
||||
- `tx_id` (VARCHAR): Simulated transaction ID.
|
||||
|
||||
### `reactions`
|
||||
Stores message reactions.
|
||||
- `message_id` (INTEGER, FK): ID of the message.
|
||||
- `wallet_address` (VARCHAR, FK): User who reacted.
|
||||
- `emoji` (VARCHAR): The emoji character.
|
||||
- *Composite PK*: `(message_id, wallet_address, emoji)`.
|
||||
|
||||
### `posts`
|
||||
Stores social wall posts.
|
||||
- `id` (INTEGER, PK): Unique post ID (from `seq_post_id`).
|
||||
- `wallet_address` (VARCHAR, FK): Owner of the wall.
|
||||
- `content` (VARCHAR): Post text.
|
||||
- `timestamp` (TIMESTAMP): Time posted.
|
||||
|
||||
## 🔢 Sequences
|
||||
- `seq_msg_id`: Increments for each new message.
|
||||
- `seq_post_id`: Increments for each new wall post.
|
||||
|
||||
## 🔄 Migrations
|
||||
The `server/db.js` file handles automatic schema initialization and migrations (e.g., adding `tx_id` or `bio` columns if they are missing from an existing database).
|
||||
Reference in New Issue
Block a user