-
Notifications
You must be signed in to change notification settings - Fork 0
Labels
libraryLibrary implementation and core features (Issues/PRs)Library implementation and core features (Issues/PRs)maintainerMaintainer expertise required (Issues/PRs)Maintainer expertise required (Issues/PRs)
Description
Overview
Add configurable PostgreSQL table and column names to Nuvex, enabling backwards compatibility with existing applications (such as the Telegram and Discord bots) and smoother migrations to the new standard. Default names should be strongly branded as nuvex_*.
Related PR: #6
Problem
Nuvex currently uses hardcoded table/column names (e. g., key and value), which may not match existing production databases for Telegram/Discord bot users. This blocks smooth migration and prevents seamless adoption.
Proposal
-
Default Schema (for new apps):
- Table:
nuvex_storage - Key Column:
nuvex_key - Data Column:
nuvex_data
CREATE TABLE nuvex_storage ( id SERIAL PRIMARY KEY, nuvex_key VARCHAR(255) UNIQUE NOT NULL, nuvex_data JSONB, expires_at TIMESTAMP, created_at TIMESTAMP DEFAULT NOW(), updated_at TIMESTAMP DEFAULT NOW() );
- Table:
-
Configurable for Existing Apps:
- Example for a bot using
storage_cache.key/storage_cache.value:const storage = new Nuvex({ postgres: { // ... schema: { tableName: 'storage_cache', columns: { key: 'key', value: 'value' } } } });
- Example for a bot using
storage_cache.cache_key/storage_cache.data:const storage = new Nuvex({ postgres: { // ... schema: { tableName: 'storage_cache', columns: { key: 'cache_key', value: 'data' } } } });
- Example for a bot using
Implementation Tasks
- Add
PostgresSchemaConfigtype tosrc/types/index.ts - Update
PostgresConfigto acceptschema?: PostgresSchemaConfig - Update
PostgresStoragelayer to use dynamic table/column names everywhere (get,set,delete,exists,clear) - Default values:
- Table:
nuvex_storage - Key Column:
nuvex_key - Data Column:
nuvex_data
- Table:
- Update/create database utility for initializing the table structure with correct names
- Ensure all core and relevant existing/future tests pass for default and custom schemas
- Add documentation/examples for schema configuration in the Nuvex README
Acceptance Criteria
- Nuvex should work out-of-the-box with default schema and configurable schema.
- Bots (or other existing apps) can specify columns and table for full compatibility.
- All new documentation and existing usage examples reflect this.
- Change is backward compatible for all users of PR Refactor to modular 3-layer storage with LRU, health checks, and L3-first writes #6.
Reference
| App | Table | Key Column | Data Column |
|---|---|---|---|
| Nuvex | nuvex_storage | nuvex_key | nuvex_data |
| Telegram Bot | storage_cache | key | value |
| Discord Bot | storage_cache | cache_key | data |
Reference: Discussion with @warengonzaga and PR #6
coderabbitai and Copilot
Metadata
Metadata
Assignees
Labels
libraryLibrary implementation and core features (Issues/PRs)Library implementation and core features (Issues/PRs)maintainerMaintainer expertise required (Issues/PRs)Maintainer expertise required (Issues/PRs)
Type
Projects
Status
Done