Skip to content

Commit 697921a

Browse files
fix: query templates modification (#1579)
1 parent b229301 commit 697921a

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

src/containers/Tenant/Query/NewSQL/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"action.create-topic": "Create Topic",
2222
"action.drop-topic": "Drop Topic",
2323
"action.alter-topic": "Alter Topic",
24-
"action.create-cdc-stream": "Create CDC Stream",
24+
"action.create-cdc-stream": "Create changefeed",
2525
"action.create-async-replication": "Create async replication",
2626
"action.create-user": "Create user",
2727
"action.create-group": "Create group",

src/containers/Tenant/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"actions.dropView": "Drop view...",
3939
"actions.alterTable": "Alter table...",
4040
"actions.addTableIndex": "Add index...",
41+
"actions.createCdcStream": "Create changefeed...",
4142
"actions.alterTopic": "Alter topic...",
4243
"actions.selectQuery": "Select query...",
4344
"actions.upsertQuery": "Upsert query...",

src/containers/Tenant/utils/schemaActions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
alterTableTemplate,
2121
alterTopicTemplate,
2222
createAsyncReplicationTemplate,
23+
createCdcStreamTemplate,
2324
createColumnTableTemplate,
2425
createExternalTableTemplate,
2526
createTableTemplate,
@@ -28,6 +29,7 @@ import {
2829
dropAsyncReplicationTemplate,
2930
dropExternalTableTemplate,
3031
dropTableIndex,
32+
dropTableTemplate,
3133
dropTopicTemplate,
3234
dropViewTemplate,
3335
selectQueryTemplate,
@@ -100,6 +102,7 @@ const bindActions = (
100102
alterAsyncReplication: inputQuery(alterAsyncReplicationTemplate, 'script'),
101103
dropAsyncReplication: inputQuery(dropAsyncReplicationTemplate, 'script'),
102104
alterTable: inputQuery(alterTableTemplate, 'script'),
105+
dropTable: inputQuery(dropTableTemplate, 'script'),
103106
selectQuery: inputQuery(selectQueryTemplate),
104107
upsertQuery: inputQuery(upsertQueryTemplate),
105108
createExternalTable: inputQuery(createExternalTableTemplate, 'script'),
@@ -112,6 +115,7 @@ const bindActions = (
112115
dropView: inputQuery(dropViewTemplate, 'script'),
113116
dropIndex: inputQuery(dropTableIndex, 'script'),
114117
addTableIndex: inputQuery(addTableIndex, 'script'),
118+
createCdcStream: inputQuery(createCdcStreamTemplate, 'script'),
115119
copyPath: () => {
116120
try {
117121
copy(params.relativePath);
@@ -166,9 +170,11 @@ export const getActions =
166170
[copyItem],
167171
[
168172
{text: i18n('actions.alterTable'), action: actions.alterTable},
173+
{text: i18n('actions.dropTable'), action: actions.dropTable},
169174
{text: i18n('actions.selectQuery'), action: actions.selectQuery},
170175
{text: i18n('actions.upsertQuery'), action: actions.upsertQuery},
171176
{text: i18n('actions.addTableIndex'), action: actions.addTableIndex},
177+
{text: i18n('actions.createCdcStream'), action: actions.createCdcStream},
172178
],
173179
];
174180

src/containers/Tenant/utils/schemaQueryTemplates.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ WITH (
6868
);`;
6969
};
7070
export const alterTableTemplate = (params?: SchemaQueryParams) => {
71-
return `ALTER TABLE \`${params?.relativePath || '$path'}\`
71+
return `-- docs: https://ydb.tech/docs/en/yql/reference/syntax/alter_table/
72+
73+
ALTER TABLE \`${params?.relativePath || '$path'}\`
74+
-- RENAME TO new_table_name
75+
-- DROP COLUMN some_existing_column
7276
ADD COLUMN numeric_column Int32;`;
7377
};
7478
export const selectQueryTemplate = (params?: SchemaQueryParams) => {

0 commit comments

Comments
 (0)