-
Notifications
You must be signed in to change notification settings - Fork 23
feat: persist at version automation support in DB #1582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stalgiag
wants to merge
8
commits into
development
Choose a base branch
from
pinned-automation-support
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
419bd7e
Spike on DB automation supporting AT version
stalgiag d3b84fc
Cleanup, update snaps
stalgiag bc1df1b
Undo accidental delete, banner in snapshots
stalgiag 0a11289
Fix quoting mistake in schema
stalgiag 53d00ba
AtAndBrowserDetailsModal prettier bug
stalgiag 538829e
Add tests
stalgiag 088b9e4
Update documentation
stalgiag 3f6a7a0
Remove deprecated const
stalgiag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
server/migrations/20251014111422-add-atversion-automation-flags.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| 'use strict'; | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| module.exports = { | ||
| async up(queryInterface, Sequelize) { | ||
| const table = await queryInterface.describeTable('AtVersion'); | ||
| if (!table.supportedByAutomation) { | ||
| await queryInterface.addColumn('AtVersion', 'supportedByAutomation', { | ||
| type: Sequelize.BOOLEAN, | ||
| allowNull: false, | ||
| defaultValue: false | ||
| }); | ||
| } | ||
| if (!table.latestAutomationSupporting) { | ||
| await queryInterface.addColumn( | ||
| 'AtVersion', | ||
| 'latestAutomationSupporting', | ||
| { | ||
| type: Sequelize.BOOLEAN, | ||
| allowNull: false, | ||
| defaultValue: false | ||
| } | ||
| ); | ||
| } | ||
| }, | ||
|
|
||
| async down(queryInterface) { | ||
| try { | ||
| await queryInterface.removeColumn( | ||
| 'AtVersion', | ||
| 'latestAutomationSupporting' | ||
| ); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } | ||
| try { | ||
| await queryInterface.removeColumn('AtVersion', 'supportedByAutomation'); | ||
| } catch (e) { | ||
| console.error(e); | ||
| } | ||
| } | ||
| }; |
61 changes: 61 additions & 0 deletions
61
server/migrations/20251015111617-backfill-atversion-automation-flags.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| 'use strict'; | ||
|
|
||
| /** @type {import('sequelize-cli').Migration} */ | ||
| module.exports = { | ||
| async up(queryInterface) { | ||
| const transaction = await queryInterface.sequelize.transaction(); | ||
| try { | ||
| const [ats] = await queryInterface.sequelize.query( | ||
| 'select id, name from "At"', | ||
| { transaction } | ||
| ); | ||
|
|
||
| const supported = { | ||
| 'VoiceOver for macOS': ['13.0', '14.0', '15.0'], | ||
| NVDA: ['2025.2', '2024.4.1', '2024.1', '2023.3.3', '2023.3'], | ||
| JAWS: ['2025.2508.120'] | ||
| }; | ||
|
|
||
| for (const at of ats) { | ||
| const names = supported[at.name] || []; | ||
| if (!names.length) continue; | ||
| await queryInterface.sequelize.query( | ||
| `update "AtVersion" | ||
| set "supportedByAutomation" = true | ||
| where "atId" = :atId and name in (:names)`, | ||
| { replacements: { atId: at.id, names }, transaction } | ||
| ); | ||
|
|
||
| // latestAutomationSupporting should be the most recent supported version by releasedAt | ||
| const [rows] = await queryInterface.sequelize.query( | ||
| `select id from "AtVersion" | ||
| where "atId" = :atId and "supportedByAutomation" = true | ||
| order by "releasedAt" desc`, | ||
| { replacements: { atId: at.id }, transaction } | ||
| ); | ||
| if (rows.length) { | ||
| const latestId = rows[0].id; | ||
| await queryInterface.sequelize.query( | ||
| `update "AtVersion" set "latestAutomationSupporting" = false where "atId" = :atId`, | ||
| { replacements: { atId: at.id }, transaction } | ||
| ); | ||
| await queryInterface.sequelize.query( | ||
| `update "AtVersion" set "latestAutomationSupporting" = true where id = :id`, | ||
| { replacements: { id: latestId }, transaction } | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| await transaction.commit(); | ||
| } catch (e) { | ||
| await transaction.rollback(); | ||
| throw e; | ||
| } | ||
| }, | ||
|
|
||
| async down(queryInterface) { | ||
| await queryInterface.sequelize.query( | ||
| 'update "AtVersion" set "supportedByAutomation" = false, "latestAutomationSupporting" = false' | ||
| ); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally deleted these quotes then thought it was easier to see in my IDE with the descriptor in place