Skip to content

chore: Add migration script to backfill user actions - #1638

Draft
DrewAire wants to merge 4 commits into
mainfrom
chore/add-migration-script-to-backfill-user-actions
Draft

chore: Add migration script to backfill user actions#1638
DrewAire wants to merge 4 commits into
mainfrom
chore/add-migration-script-to-backfill-user-actions

Conversation

@DrewAire

Copy link
Copy Markdown
Collaborator

Record of script being run during release on 23rd July 2026. Added to a separate folder in DatabaseUpgrader so it's not run automatically, and fully commented out just in case.

@github-actions

Copy link
Copy Markdown
Contributor

SQL Risks Found

src/Dfe.PlanTech.DatabaseUpgrader/RunOnceMigrationScripts/20260723_GenerateUserActionsForPreExistingSubmissions.sql
+-------------------------------------------------+
|                   SQLCHECK                      |
+-------------------------------------------------+
> RISK LEVEL    :: ONLY MEDIUM AND HIGH RISK ANTI-PATTERNS
> SQL FILE NAME :: src/Dfe.PlanTech.DatabaseUpgrader/RunOnceMigrationScripts/20260723_GenerateUserActionsForPreExistingSubmissions.sql
> COLOR MODE    :: DISABLED
> VERBOSE MODE  :: DISABLED
> DELIMITER     :: ;
-------------------------------------------------
==================== Results ===================

-------------------------------------------------
SQL Statement at line 1: /* how to use this script ====================== - add "--" to the "/ *" under
block 1 to activate it (line 27) - run block 1 to generate submission data and
user actions - confirm data looks reasonable - tempdatacount should be ≤
realdatacount (we ignore submissions with no responses) -
creation/updateuseractioncount should equal tempdatacount -
completionuseractioncount will most likely be less if there are many submissions
in progres - mats and sats should not have any missing mat establishment ids.
schools are expected to have lots missing. - remove the "--" you added from the
start of block 1 - add "--" to the "/ *" under block 2 to activate it (line 276)
- run block 2 to add user actions to the database and associate them with
submissions - confirm the associated establishment names look right - change
"rollback tran" at the end of block 2 to "commit tran";
[src/Dfe.PlanTech.DatabaseUpgrader/RunOnceMigrationScripts/20260723_GenerateUserActionsForPreExistingSubmissions.sql]: (MEDIUM RISK) (PHYSICAL_DATABASE_DESIGN ANTI-PATTERN) Imprecise Data Type
[Matching Expression: real at line 8]


-------------------------------------------------
SQL Statement at line 116: select count(*) as realdatacount from dbo.submission;
[src/Dfe.PlanTech.DatabaseUpgrader/RunOnceMigrationScripts/20260723_GenerateUserActionsForPreExistingSubmissions.sql]: (MEDIUM RISK) (PHYSICAL_DATABASE_DESIGN ANTI-PATTERN) Imprecise Data Type
[Matching Expression: real at line 116]


==================== Summary ===================
All Anti-Patterns and Hints  :: 2
>  High Risk   :: 0
>  Medium Risk :: 2
>  Low Risk    :: 0
>  Hints       :: 0

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.

1 participant