Upgrade Guide
This document provides detailed guidance for upgrading between different versions of SQLRooms packages. Each section outlines breaking changes, required code modifications, and implementation examples to ensure a smooth upgrade process.
When upgrading, please follow the version-specific instructions below that apply to your project. If you encounter any issues during the upgrade process, please refer to our GitHub issues or contact support.
0.9.0
@sqlrooms/project-builder
createProjectSlice
renamed intocreateProjectBuilderSlice
createProjectStore
renamed intocreateProjectBuilderStore
ProjectState
renamed intoProjectBuilderState
ProjectState
renamed intoProjectBuilderState
projectId
andsetProjectId
removed: add custom state if necessaryINITIAL_BASE_PROJECT_STATE
renamed intoINITIAL_PROJECT_BUILDER_STATE
A number of project store props amnd moved from
.project
to.db
:.tables
.addTable
.getTable
.getTables
.getTableRowCount
.getTableSchema
.getTableSchemas
.checkTableExists
.dropTable
.createTableFromQuery
.setTableRowCount
.findTableByName
.refreshTableSchemas
useBaseProjectStore
was renamed intouseBaseProjectBuilderStore
, but it's better to useuseProjectStore
returned bycreateProjectBuilderStore
insteadprocessDroppedFile()
is removed: UseProjectStore.addProjectFile
directly.ProjectStore.replaceProjectFile
is removed: UseProjectStore.addProjectFile
instead.ProjectStore.addProjectFile
parameter changes: The function now takes a File or a pathname instead of the result ofprocessDroppedFile()
.ProjectStore.addProjectFile
behavior changes: The function will no longer attempt to create unique table names, but will overwrite the created table.ProjectStore.areViewsReadyToRender
andonDataUpdated
were removedProjectStore.setTables
removed: usestate.db.refreshTableSchemas()
instead.ProjectStore.isReadOnly
was removed: passisReadOnly
as a prop to respective components instead
@sqlrooms/duckdb
useDuckDb()
now returns an instance ofDuckDbConnector
to enable support for external DuckDBgetDuckDb
was removed: UseuseDuckDb()
insteadgetDuckTableSchemas
was removed: useconst getTableSchemas = useProjectStore(state => state.db.getTableSchemas)
exportToCsv
was removed: UseuseExportToCsv
instead
@sqlrooms/mosaic
getMosaicConnector
removed: UseuseMosaic
instead
@sqlrooms/ai
TOOLS
is not exported anymore: useuseProjectStore(state => state.ai.tools)
instead
0.8.0
@sqlrooms/project-builder
project.config
moved to top level ofProjectStore
This was done to simplify persistence. To migrate you need to pull it up in your slice creation code.
Before:
const {projectStore, useProjectStore} = createProjectStore<
AppConfig,
AppState
>(
(set, get, store) => ({
...createProjectSlice<AppConfig>({
project: {
config: {
...
},
...
}
})
})
);
After:
const {projectStore, useProjectStore} = createProjectStore<
AppConfig,
AppState
>(
(set, get, store) => ({
...createProjectSlice<AppConfig>({
config: {
...
},
project: {
...
}
})
})
);
Check the AI example store code.
@sqlrooms/ai
- Model provider in
getApiKey
getApiKey
property of createAiSlice
now takes modelProvider
:
...createAiSlice({
getApiKey: (modelProvider: string) => {
return get()?.apiKeys[modelProvider] || '';
},
})(set, get, store),
- Combining
useScrollToBottom
anduseScrollToBottomButton
useScrollToBottom
is now combined with useScrollToBottomButton
. useScrollToBottom
now takes dataToObserve
, containerRef
, endRef
. When the data changes, the hook will scroll to the bottom of the container.
- Vega Chart Tool is now a custom tool
The Vega Chart Tool is no longer included by default and must be explicitly provided as a custom tool to createAiSlice
. You need to import it from @sqlrooms/vega
and add it to the customTools
object:
import {createVegaChartTool} from '@sqlrooms/vega';
...createAiSlice({
getApiKey: (modelProvider: string) => {
return get()?.apiKeys[modelProvider] || '';
},
// Add custom tools
customTools: {
// Add the VegaChart tool from the vega package
chart: createVegaChartTool(),
// Other custom tools...
},
})(set, get, store),
This change allows for more flexibility in configuring the chart tool and reduces bundle size for applications that don't need chart functionality.