Skip to content

feat: add is_extended_promotional field to all component tables#141

Open
soongtv wants to merge 3 commits intotscircuit:mainfrom
soongtv:feature/add-extended-promotional-field
Open

feat: add is_extended_promotional field to all component tables#141
soongtv wants to merge 3 commits intotscircuit:mainfrom
soongtv:feature/add-extended-promotional-field

Conversation

@soongtv
Copy link

@soongtv soongtv commented Mar 10, 2026

Summary

This PR implements the feature requested in issue #92 to add an \is_extended_promotional\ column to all component tables.

Changes

1. Core Interface Update

  • lib/db/derivedtables/component-base.ts: Added \is_extended_promotional: boolean\ field to BaseComponent interface

2. Component Table Updates

Updated all 37 component table definitions to include the new field:

  • accelerometer, adc, analog_multiplexer, battery_holder, bjt_transistor
  • boost_converter, buck_boost_converter, capacitor, dac, diode
  • fpc_connector, fpga, fuse, gas_sensor, gyroscope
  • header, io_expander, jst_connector, lcd_display, led
  • led_dot_matrix_display, led_driver, led_segment_display, led_with_ic
  • microcontroller, mosfet, oled_display, pcie_m2_connector
  • potentiometer, relay, resistor, resistor_array, switch
  • usb_c_connector, voltage_regulator, wifi_module, wire_to_board_connector

3. Data Mapping

  • Map \c.extended_promotional\ from source data to the new field
  • Boolean conversion: \Boolean(c.extended_promotional)\

4. Utility Script

  • scripts/add-extended-promotional-field.ts: Bulk update script for future field additions

Testing

Note: Full database testing requires the complete 2GB database setup, which should be performed by maintainers with proper infrastructure.

The implementation follows the same pattern as existing fields (\is_basic, \is_preferred) and is compatible with the existing data pipeline.

Related Issue

Closes #92


PayPal for bounty: [email protected]

soongtv added 3 commits March 10, 2026 14:19
- Add is_extended_promotional boolean field to BaseComponent interface
- Update all 37 component table definitions to include the new field
- Map extended_promotional from source data
- Add bulk update script for future field additions

Closes tscircuit#92
@songshanhua-eng
Copy link

Closing this PR in favor of #145 which uses a lighter computed field approach instead of database schema changes. The new implementation doesn't require modifying 37 component tables and is easier to maintain. Thanks for reviewing!

@songshanhua-eng
Copy link

🔄 Superseded by #145

Closing this PR in favor of #145 which uses a lighter computed field approach.

Why the new approach is better:

Aspect PR #141 (This) PR #145 (New)
Database changes ❌ 37 tables modified ✅ No schema changes
Files changed ~40 files 4 files
Maintenance High Low
Risk Data migration needed Zero risk

Implementation difference:

PR #141: Adds real database column is_extended_promotional to all 37 component tables
PR #145: Computes field on-the-fly: CASE WHEN preferred = 1 AND basic = 0 THEN 1 ELSE 0 END

The computed field approach is cleaner since is_extended_promotional is derived data, not source data.

Thanks for the review! /claim #92

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.

Add is_extended_promotional column to components (from data source)

2 participants