Python's sqlite3.executescript() has a bug where trailing newlines after the final semicolon create empty statements. When APSW's log_sqlite() is enabled (via apswutils, imported by fastmigrate), these cause visible "API called with NULL prepared statement" errors during interpreter shutdown. - Strip trailing newlines from all 9 existing migration files - Update migration template to end with semicolon, no trailing newline - Document the requirement in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
15 lines
564 B
SQL
15 lines
564 B
SQL
-- ABOUTME: Migration to create tag_suggestions table.
|
|
-- ABOUTME: Tracks tag usage for autocomplete in the UI.
|
|
|
|
-- Tag suggestions for autocomplete
|
|
-- Updated synchronously during tagging operations
|
|
CREATE TABLE tag_suggestions (
|
|
tag TEXT PRIMARY KEY,
|
|
total_assignments INTEGER NOT NULL DEFAULT 0,
|
|
active_animals INTEGER NOT NULL DEFAULT 0,
|
|
last_used_utc INTEGER,
|
|
updated_at_utc INTEGER NOT NULL
|
|
);
|
|
|
|
-- Index for sorting by popularity
|
|
CREATE INDEX idx_tag_suggestions_popularity ON tag_suggestions(active_animals DESC, total_assignments DESC); |