Skip to content

Conversation

@alexplash
Copy link
Contributor

@alexplash alexplash commented Nov 5, 2025

Fixes #126

@alexplash alexplash linked an issue Nov 5, 2025 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR renames the database table model_pricing_history to model_history and adds new columns to track additional model metadata beyond just pricing. The migration includes schema changes and updates to database triggers, while the Rust code updates all SQL queries to reference the new table name.

  • Renamed model_pricing_history table to model_history to better reflect its expanded purpose
  • Added new columns (model_icon, verifiable, is_active, model_aliases) to the history table
  • Updated all SQL queries in the repository code to use the new table name

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/database/src/repositories/model.rs Updated all SQL queries to reference model_history instead of model_pricing_history
crates/database/src/migrations/sql/V0021__rename_model_pricing_history_to_model_history.sql New migration file that renames the table, adds new columns, and updates database triggers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

r#"
SELECT
id, model_id, input_cost_per_token, output_cost_per_token,
context_length, model_display_name, model_description,
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SELECT statement in get_pricing_history does not include the newly added columns (model_icon, verifiable, is_active, model_aliases) from the migration. While this may be intentional for backward compatibility, the ModelPricingHistory struct and the row_to_pricing_history method should be reviewed to ensure they align with the expanded schema. Consider whether these new fields should be included in the history queries.

Suggested change
context_length, model_display_name, model_description,
context_length, model_display_name, model_description,
model_icon, verifiable, is_active, model_aliases,

Copilot uses AI. Check for mistakes.
Comment on lines 362 to +365
id, model_id, input_cost_per_token, output_cost_per_token,
context_length, model_display_name, model_description,
effective_from, effective_until, changed_by, change_reason, created_at
FROM model_pricing_history
FROM model_history
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SELECT statement in get_pricing_at_time does not include the newly added columns (model_icon, verifiable, is_active, model_aliases) from the migration. Similar to get_pricing_history, consider whether the ModelPricingHistory struct should be updated to include these new fields for completeness.

Copilot uses AI. Check for mistakes.
SELECT
h.id, h.model_id, h.input_cost_per_token, h.output_cost_per_token,
h.context_length, h.model_display_name, h.model_description,
h.effective_from, h.effective_until, h.changed_by, h.change_reason, h.created_at
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SELECT statement in get_pricing_history_by_name does not include the newly added columns (model_icon, verifiable, is_active, model_aliases) from the migration. Consider whether these fields should be queried to provide complete historical information.

Suggested change
h.effective_from, h.effective_until, h.changed_by, h.change_reason, h.created_at
h.effective_from, h.effective_until, h.changed_by, h.change_reason, h.created_at,
h.model_icon, h.verifiable, h.is_active, h.model_aliases

Copilot uses AI. Check for mistakes.
@think-in-universe think-in-universe changed the title model history tracking feat: model history with more fields Nov 6, 2025
@think-in-universe
Copy link
Contributor

@alexplash could you please check the comments from Copilot?

@cursor
Copy link

cursor bot commented Nov 14, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 9.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@think-in-universe
Copy link
Contributor

The PR can be closed since @danielwpz is working on another fix for #94, #115 and #126

@danielwpz
Copy link
Contributor

now fixed in: #189

@danielwpz danielwpz closed this Nov 20, 2025
@danielwpz danielwpz deleted the model-history-tracking branch November 20, 2025 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: track model_icon in model_history

5 participants