-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4106 - Remove ColType multiselect. Refactor Multiselect->Select isMul…
…ti (#4107) * 4106 - migrate multiselect->select isMulti * 4106 - remove colType multiselect
- Loading branch information
Showing
11 changed files
with
84 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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 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
45 changes: 0 additions & 45 deletions
45
src/client/pages/Section/DataTable/Table/Row/RowData/Cell/Multiselect/Multiselect.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/client/pages/Section/DataTable/Table/Row/RowData/Cell/Multiselect/index.ts
This file was deleted.
Oops, something went wrong.
18 changes: 11 additions & 7 deletions
18
src/client/pages/Section/DataTable/Table/Row/RowData/Cell/Select/Select.tsx
This file contains 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 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 @@ | ||
export type Value = string | Array<string> |
This file contains 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 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 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 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
38 changes: 38 additions & 0 deletions
38
src/test/migrations/steps/20241112123550-step-remove-coltype-multiselect.ts
This file contains 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,38 @@ | ||
import { ColType } from 'meta/assessment' | ||
|
||
import { AssessmentController } from 'server/controller/assessment' | ||
import { BaseProtocol, Schemas } from 'server/db' | ||
|
||
export default async (client: BaseProtocol) => { | ||
const assessments = await AssessmentController.getAll({}, client) | ||
|
||
await Promise.all( | ||
assessments.map(async (assessment) => { | ||
const schemaAssessment = Schemas.getName(assessment) | ||
|
||
await client.query(` | ||
with col_props_disagg as | ||
(select c.id | ||
, jsonb_object_keys(c.props -> 'select') as cycle_uuid | ||
, (c.props -> 'select' -> jsonb_object_keys(c.props -> 'select')) || | ||
jsonb_build_object('isMulti', true) as select_props | ||
from ${schemaAssessment}.col c | ||
left join ${schemaAssessment}.row r on r.id = c.row_id | ||
left join ${schemaAssessment}."table" t on t.id = r.table_id | ||
where c.props ->> 'colType' = 'multiselect') | ||
, col_props as | ||
(select cp.id | ||
, jsonb_object_agg(cp.cycle_uuid, cp.select_props) as select_props | ||
from col_props_disagg cp | ||
group by cp.id) | ||
update ${schemaAssessment}.col c | ||
set props = props || jsonb_build_object('colType', '${ColType.select}') || jsonb_build_object('select', cp.select_props) | ||
from col_props cp | ||
where c.id = cp.id | ||
; | ||
`) | ||
|
||
await AssessmentController.generateMetadataCache({ assessment }, client) | ||
}) | ||
) | ||
} |