Skip to content

pa-db-touch

by rob

Data

Update last_accessed timestamp and increment access_count for message records in SQLite database

# pa-db-touch

Update last_accessed timestamp and increment access_count for message records in SQLite database

## Installation

This is a CmdForge tool. It accepts input via stdin and outputs results to stdout.

## Usage

The tool accepts message IDs via stdin (one per line or JSON array) and updates their access metadata in the database.

```bash
# Single message ID
echo "msg_123" | pa-db-touch --db-path ~/.pa2/data/pa2.db

# Multiple message IDs (newline-separated)
echo -e "msg_123\nmsg_456" | pa-db-touch --db-path ~/.pa2/data/pa2.db

# JSON array of message IDs
echo '["msg_123", "msg_456", "msg_789"]' | pa-db-touch --db-path ~/.pa2/data/pa2.db

# From another tool's output
pa-db-query --db-path ~/.pa2/data/pa2.db --query "SELECT id FROM messages WHERE source='cli'" | pa-db-touch --db-path ~/.pa2/data/pa2.db
```

## Arguments

| Flag | Default | Description |
|------|---------|-------------|
| `--db-path` | (required) | Path to SQLite database file |

## How It Works

1. **touch_messages** - Updates the `last_accessed` timestamp to the current time and increments the `access_count` field for each message ID provided via stdin. Returns a summary of updated records.

## Dependencies

None

No reviews yet.

Issues

No issues reported for this tool.