• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dcm31

dcm31

charBuildSuperapp

Unlisted
Like
charBuildSuperapp
Home
Code
11
assets
1
projects
24
public
5
shared
6
completed.txt
debug_files.js
debug_files2.js
H
http.tsx
priority_stack.js
priority_stack.txt
project_list.js
Branches
16
Pull requests
1
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
projects
/
ideaScore
/
schema.md
Code
/
projects
/
ideaScore
/
schema.md
Search
3/19/2025
Viewing readonly version of main branch: v199
View latest version
schema.md

IdeaScore Database Schema

This document outlines the database schema for the IdeaScore application. The schema will evolve through the project phases, with the initial focus being on the core functionality.

Phase 1: Core Schema

Ideas Table

CREATE TABLE IF NOT EXISTS ideas_v1 ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, description TEXT, effort_score INTEGER NOT NULL CHECK(effort_score BETWEEN 1 AND 10), payoff_score INTEGER NOT NULL CHECK(payoff_score BETWEEN 1 AND 10), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, user_email TEXT NOT NULL, is_deleted BOOLEAN DEFAULT 0 ); -- Index for faster querying by user CREATE INDEX IF NOT EXISTS idx_ideas_user_email ON ideas_v1(user_email);

Phase 3: Tag Support

Tags Table

CREATE TABLE IF NOT EXISTS tags_v1 ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, color TEXT DEFAULT '#808080', user_email TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, is_deleted BOOLEAN DEFAULT 0, UNIQUE(name, user_email) ); -- Index for faster querying by user CREATE INDEX IF NOT EXISTS idx_tags_user_email ON tags_v1(user_email);

Idea-Tag Relationships

CREATE TABLE IF NOT EXISTS idea_tags_v1 ( idea_id INTEGER NOT NULL, tag_id INTEGER NOT NULL, user_email TEXT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (idea_id, tag_id), FOREIGN KEY (idea_id) REFERENCES ideas_v1(id) ON DELETE CASCADE, FOREIGN KEY (tag_id) REFERENCES tags_v1(id) ON DELETE CASCADE ); -- Indexes for faster joins CREATE INDEX IF NOT EXISTS idx_idea_tags_idea_id ON idea_tags_v1(idea_id); CREATE INDEX IF NOT EXISTS idx_idea_tags_tag_id ON idea_tags_v1(tag_id); CREATE INDEX IF NOT EXISTS idx_idea_tags_user_email ON idea_tags_v1(user_email);

Phase 5: Status Tracking

Status Field Addition

-- Alter the ideas table to add status ALTER TABLE ideas_v1 ADD COLUMN status TEXT DEFAULT 'new' CHECK(status IN ('new', 'in_progress', 'completed', 'abandoned')); -- Add index for status-based queries CREATE INDEX IF NOT EXISTS idx_ideas_status ON ideas_v1(status);

Completion Data

CREATE TABLE IF NOT EXISTS completion_data_v1 ( idea_id INTEGER PRIMARY KEY, actual_effort_score INTEGER CHECK(actual_effort_score BETWEEN 1 AND 10), actual_payoff_score INTEGER CHECK(actual_payoff_score BETWEEN 1 AND 10), completed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, completion_notes TEXT, FOREIGN KEY (idea_id) REFERENCES ideas_v1(id) ON DELETE CASCADE );

Migration Strategy

As the schema evolves, we'll use the following approach:

  1. New tables will be created with version suffixes (e.g., _v1, _v2)
  2. Data migrations will be performed when upgrading between versions
  3. For simple additions, we'll use ALTER TABLE statements
  4. For complex changes, we'll create new tables and migrate data
  5. We'll maintain backward compatibility for older versions during transitions

Notes for Developers

  • Always use parameterized queries to prevent SQL injection
  • Include schema version in database requests
  • Include appropriate indexes for frequently queried fields
  • Validate all input data before insertion
  • Implement soft deletes (is_deleted flag) where appropriate
  • Always check for constraints before performing operations

This schema document will be updated as the project progresses through its development phases.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.