Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/containers/Tenant/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"actions.alterTable": "Alter table...",
"actions.manageColumns": "Manage columns...",
"actions.manageAutoPartitioning": "Manage auto partitioning...",
"actions.manageReadReplicas": "Add read-only replicas...",
"actions.addTableIndex": "Add index...",
"actions.addVectorIndex": "Add vector index...",
"actions.createCdcStream": "Create changefeed...",
Expand Down
30 changes: 20 additions & 10 deletions src/containers/Tenant/utils/schemaActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
dropTransferTemplate,
dropViewTemplate,
manageAutoPartitioningTemplate,
manageReadReplicasTemplate,
selectQueryTemplate,
showCreateTableTemplate,
upsertQueryTemplate,
Expand Down Expand Up @@ -137,6 +138,7 @@ const bindActions = (
alterTable: inputQuery(alterTableTemplate),
dropTable: inputQuery(dropTableTemplate),
manageAutoPartitioning: inputQuery(manageAutoPartitioningTemplate),
manageReadReplicas: inputQuery(manageReadReplicasTemplate),
selectQuery: inputQuery(selectQueryTemplate),
showCreateTable: inputQuery(showCreateTableTemplate),
upsertQuery: inputQuery(upsertQueryTemplate),
Expand Down Expand Up @@ -248,15 +250,23 @@ export const getActions =
{text: i18n('actions.createStreamingQuery'), action: actions.createStreamingQuery},
];

const alterTableGroupItem = {
const manageColumnsItem = {text: i18n('actions.manageColumns'), action: actions.alterTable};
const manageAutoPartitioningItem = {
text: i18n('actions.manageAutoPartitioning'),
action: actions.manageAutoPartitioning,
};
const manageReadReplicasItem = {
text: i18n('actions.manageReadReplicas'),
action: actions.manageReadReplicas,
};

const alterRowTableGroupItem = {
text: i18n('actions.alterTable'),
items: [
{text: i18n('actions.manageColumns'), action: actions.alterTable},
{
text: i18n('actions.manageAutoPartitioning'),
action: actions.manageAutoPartitioning,
},
],
items: [manageColumnsItem, manageAutoPartitioningItem, manageReadReplicasItem],
};
const alterColumnTableGroupItem = {
text: i18n('actions.alterTable'),
items: [manageColumnsItem, manageAutoPartitioningItem],
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states "Both row tables and column tables receive the new menu item under 'Alter table...' submenu," but the implementation only adds manageReadReplicasItem to alterRowTableGroupItem (line 265) and not to alterColumnTableGroupItem (line 269).

To match the description, line 269 should be:

items: [manageColumnsItem, manageAutoPartitioningItem, manageReadReplicasItem],
Suggested change
items: [manageColumnsItem, manageAutoPartitioningItem],
items: [manageColumnsItem, manageAutoPartitioningItem, manageReadReplicasItem],

Copilot uses AI. Check for mistakes.
};

let DB_SET: ActionsSet = [[copyItem, connectToDBItem], createEntitiesSet];
Expand Down Expand Up @@ -288,7 +298,7 @@ export const getActions =
const ROW_TABLE_SET: ActionsSet = [
[copyItem],
[
alterTableGroupItem,
alterRowTableGroupItem,
{text: i18n('actions.dropTable'), action: actions.dropTable},
getActionWithLoader({
text: i18n('actions.selectQuery'),
Expand All @@ -309,7 +319,7 @@ export const getActions =
const COLUMN_TABLE_SET: ActionsSet = [
[copyItem],
[
alterTableGroupItem,
alterColumnTableGroupItem,
{text: i18n('actions.dropTable'), action: actions.dropTable},
{text: i18n('actions.selectQuery'), action: actions.selectQuery},
{text: i18n('actions.upsertQuery'), action: actions.upsertQuery},
Expand Down
12 changes: 12 additions & 0 deletions src/containers/Tenant/utils/schemaQueryTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ ALTER TABLE ${path} SET
AUTO_PARTITIONING_MAX_PARTITIONS_COUNT = 100 -- Partitions are split only if their number doesn't exceed the value specified by this parameter.
)`;
};

export const manageReadReplicasTemplate = (params?: SchemaQueryParams) => {
const path = params?.relativePath
? `\`${normalizeParameter(params.relativePath)}\``
: '${1:<my_table>}';

return `ALTER TABLE ${path} SET
(
READ_REPLICAS_SETTINGS = 'PER_AZ:1' -- Enable read replicas for stale read, launch one replica in every availability zone. docs: https://clck.ru/3Qh8iQ
)`;
};

export const selectQueryTemplate = (params?: SchemaQueryParams) => {
const path = params?.relativePath
? `\`${normalizeParameter(params.relativePath)}\``
Expand Down
Loading