This project has been migrated from using SQLite (tardigrade.db) to PostgreSQL for better scalability and performance.
github.com/lib/pq- PostgreSQL driver for Gogithub.com/joho/godotenv- Environment variable loader
database.go- PostgreSQL database connection and query functions
go.mod- Added new dependenciessearch.go- Updated to use PostgreSQL instead of tardigrade-modsavecmd.go- Updated to use PostgreSQL instead of tardigrade-modserver.go- Updated web interface to use PostgreSQL
The application reads database configuration from the .env file:
# PostgreSQL Database Configuration
DB_HOST=192.168.1.4
DB_PORT=5432
DB_USER=user_name
DB_PASS=password
DB_NAME=database_name
TB_NAME=scmd
# Embedding Configuration (for future use)
EMBEDDING_MODEL=all-MiniLM-L6-v2
EMBEDDING_DIM=1536Your PostgreSQL table should have the following structure:
CREATE TABLE scmd (
id SERIAL PRIMARY KEY,
key TEXT NOT NULL,
data TEXT NOT NULL
);
-- Optional: Add indexes for better search performance
CREATE INDEX idx_scmd_key ON scmd USING gin(to_tsvector('english', key));
CREATE INDEX idx_scmd_data ON scmd USING gin(to_tsvector('english', data));All existing commands work the same way:
scmd.exe --search "docker,kubernetes"scmd.exe --save "docker ps -a" "List all containers"scmd.exe --web
scmd.exe --web -port 8080
scmd.exe --web -port 8080 -block- Database Connection: The application now connects to PostgreSQL on startup
- Search Functionality: Uses PostgreSQL's ILIKE for case-insensitive pattern matching
- Duplicate Detection: Checks for exact command matches before inserting
- Error Handling: Improved error handling with proper logging
The old tardigrade.db file is no longer used. All data should be imported into PostgreSQL using the CLI tools in the cli/ directory.
- Ensure PostgreSQL is running and accessible
- Verify
.envfile has correct database credentials - Test CLI search:
scmd.exe --search "test" - Test CLI save:
scmd.exe --save "test command" "test description" - Test web interface:
scmd.exe --web
- Verify PostgreSQL is running
- Check firewall settings
- Verify database credentials in
.env - Test connection:
psql -h DB_HOST -p DB_PORT -U DB_USER -d DB_NAME
- Ensure data was imported from tardigrade.db to PostgreSQL
- Check table name matches TB_NAME in
.env - Verify table structure matches expected schema