Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/containers/Tenant/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"actions.manageColumns": "Manage columns...",
"actions.manageAutoPartitioning": "Manage auto partitioning...",
"actions.manageReadReplicas": "Add read-only replicas...",
"actions.manageTTL": "Manage TTL...",
"actions.enableTTL": "Enable TTL...",
"actions.manageTTL": "Disable TTL...",
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated
"actions.addTableIndex": "Add index...",
"actions.addVectorIndex": "Add vector index...",
"actions.addFulltextIndex": "Add fulltext index...",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {enableTTLTemplate, manageTTLTemplate} from '../schemaQueryTemplates';

describe('schemaQueryTemplates', () => {
describe('enableTTLTemplate', () => {
test('does not suggest disabling TTL with a zero interval', () => {
const template = enableTTLTemplate({path: '/local/table', relativePath: 'table'});

expect(template).toContain('ALTER TABLE `table` SET');
expect(template).toContain('TTL = Interval("PT24H")');
expect(template).not.toContain('To disable TTL');
expect(template).not.toContain('PT0S');
});
});

describe('manageTTLTemplate', () => {
test('resets TTL for the selected table', () => {
const template = manageTTLTemplate({path: '/local/table', relativePath: 'table'});

expect(template).toContain('https://ydb.tech/docs/en/yql/reference/recipes/ttl');
expect(template).toContain('ALTER TABLE `table` RESET (TTL);');
});
});
});
9 changes: 8 additions & 1 deletion src/containers/Tenant/utils/schemaActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
dropTopicTemplate,
dropTransferTemplate,
dropViewTemplate,
enableTTLTemplate,
manageAutoPartitioningTemplate,
manageReadReplicasTemplate,
manageTTLTemplate,
Expand Down Expand Up @@ -192,6 +193,7 @@ const bindActions = (
manageReadReplicasTemplate,
stripEllipsis(i18n('actions.manageReadReplicas')),
),
enableTTL: inputQuery(enableTTLTemplate, stripEllipsis(i18n('actions.enableTTL'))),
manageTTL: inputQuery(manageTTLTemplate, stripEllipsis(i18n('actions.manageTTL'))),
selectQuery: inputQuery(selectQueryTemplate, stripEllipsis(i18n('actions.selectQuery'))),
showCreateTable: inputQuery(
Expand Down Expand Up @@ -344,6 +346,10 @@ export const getActions =
text: i18n('actions.manageReadReplicas'),
action: actions.manageReadReplicas,
};
const enableTTLItem = {
text: i18n('actions.enableTTL'),
action: actions.enableTTL,
};
const manageTTLItem = {
text: i18n('actions.manageTTL'),
action: actions.manageTTL,
Expand All @@ -355,12 +361,13 @@ export const getActions =
manageColumnsItem,
manageAutoPartitioningItem,
manageReadReplicasItem,
enableTTLItem,
manageTTLItem,
],
};
const alterColumnTableGroupItem = {
text: i18n('actions.alterTable'),
items: [manageColumnsItem, manageAutoPartitioningItem, manageTTLItem],
items: [manageColumnsItem, manageAutoPartitioningItem, enableTTLItem],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include disable TTL entry in column table actions

The column-table Alter table menu now only exposes enableTTLItem, while the new disable template (manageTTLTemplate) is not reachable there. This means users working with column-oriented tables can no longer disable TTL from the built-in schema actions (the previous manageTTL action was removed from this group), which is a functional regression in the UI workflow for existing TTL-enabled column tables.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep disable TTL action for column tables

Removing manageTTLItem from the column-table Alter table menu creates a regression for TTL-enabled column tables: users can still enable TTL via enableTTLItem, but they no longer have a built-in action to generate the corresponding ALTER TABLE ... RESET (TTL) query and must craft it manually. Since this commit introduces a dedicated disable template and row tables still expose it, column tables should expose the same disable action to preserve the previous workflow.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add disable TTL action to column table alter menu

Column-table actions now omit disableTTLItem, so users with TTL-enabled column tables no longer have a built-in way to generate ALTER TABLE ... RESET (TTL) from the UI. This commit also removed the old zero-interval disable hint from the enable template, so the previous in-menu disable path is gone entirely for column tables while row tables still have it, creating a functional regression in the column-table workflow.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@copilot add disable action here

Comment thread
Raubzeug marked this conversation as resolved.
};

let DB_SET: ActionsSet = [[copyItem, connectToDBItem], createEntitiesSet];
Expand Down
15 changes: 12 additions & 3 deletions src/containers/Tenant/utils/schemaQueryTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const manageReadReplicasTemplate = (params?: SchemaQueryParams) => {
)`;
};

export const manageTTLTemplate = (params?: SchemaQueryParams) => {
export const enableTTLTemplate = (params?: SchemaQueryParams) => {
const path = params?.relativePath
? `\`${normalizeParameter(params.relativePath)}\``
: '${1:<my_table>}';
Expand All @@ -169,11 +169,20 @@ ALTER TABLE ${path} SET (
-- Examples:
-- TTL = Interval("PT1H") ON created_at -- Delete rows 1 hour after created_at
-- TTL = Interval("P7D") ON expire_at -- Delete rows 7 days after expire_at
-- To disable TTL:
-- TTL = Interval("PT0S") ON column_name -- Set interval to 0 to disable TTL
)`;
};

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

return `-- Disable Time to Live (TTL) for automatic row deletion, see docs for more information
-- https://ydb.tech/docs/en/yql/reference/recipes/ttl?version=main#disable
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated

ALTER TABLE ${path} RESET (TTL);`;
};

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