diff --git a/src/containers/Tenant/Query/NewSQL/i18n/en.json b/src/containers/Tenant/Query/NewSQL/i18n/en.json index d08599580..3484a226a 100644 --- a/src/containers/Tenant/Query/NewSQL/i18n/en.json +++ b/src/containers/Tenant/Query/NewSQL/i18n/en.json @@ -21,7 +21,7 @@ "action.create-topic": "Create Topic", "action.drop-topic": "Drop Topic", "action.alter-topic": "Alter Topic", - "action.create-cdc-stream": "Create CDC Stream", + "action.create-cdc-stream": "Create changefeed", "action.create-async-replication": "Create async replication", "action.create-user": "Create user", "action.create-group": "Create group", diff --git a/src/containers/Tenant/i18n/en.json b/src/containers/Tenant/i18n/en.json index 3d5795d22..0cba4a7a9 100644 --- a/src/containers/Tenant/i18n/en.json +++ b/src/containers/Tenant/i18n/en.json @@ -38,6 +38,7 @@ "actions.dropView": "Drop view...", "actions.alterTable": "Alter table...", "actions.addTableIndex": "Add index...", + "actions.createCdcStream": "Create changefeed...", "actions.alterTopic": "Alter topic...", "actions.selectQuery": "Select query...", "actions.upsertQuery": "Upsert query...", diff --git a/src/containers/Tenant/utils/schemaActions.ts b/src/containers/Tenant/utils/schemaActions.ts index 04bed6ab4..b107e2a5f 100644 --- a/src/containers/Tenant/utils/schemaActions.ts +++ b/src/containers/Tenant/utils/schemaActions.ts @@ -20,6 +20,7 @@ import { alterTableTemplate, alterTopicTemplate, createAsyncReplicationTemplate, + createCdcStreamTemplate, createColumnTableTemplate, createExternalTableTemplate, createTableTemplate, @@ -28,6 +29,7 @@ import { dropAsyncReplicationTemplate, dropExternalTableTemplate, dropTableIndex, + dropTableTemplate, dropTopicTemplate, dropViewTemplate, selectQueryTemplate, @@ -100,6 +102,7 @@ const bindActions = ( alterAsyncReplication: inputQuery(alterAsyncReplicationTemplate, 'script'), dropAsyncReplication: inputQuery(dropAsyncReplicationTemplate, 'script'), alterTable: inputQuery(alterTableTemplate, 'script'), + dropTable: inputQuery(dropTableTemplate, 'script'), selectQuery: inputQuery(selectQueryTemplate), upsertQuery: inputQuery(upsertQueryTemplate), createExternalTable: inputQuery(createExternalTableTemplate, 'script'), @@ -112,6 +115,7 @@ const bindActions = ( dropView: inputQuery(dropViewTemplate, 'script'), dropIndex: inputQuery(dropTableIndex, 'script'), addTableIndex: inputQuery(addTableIndex, 'script'), + createCdcStream: inputQuery(createCdcStreamTemplate, 'script'), copyPath: () => { try { copy(params.relativePath); @@ -166,9 +170,11 @@ export const getActions = [copyItem], [ {text: i18n('actions.alterTable'), action: actions.alterTable}, + {text: i18n('actions.dropTable'), action: actions.dropTable}, {text: i18n('actions.selectQuery'), action: actions.selectQuery}, {text: i18n('actions.upsertQuery'), action: actions.upsertQuery}, {text: i18n('actions.addTableIndex'), action: actions.addTableIndex}, + {text: i18n('actions.createCdcStream'), action: actions.createCdcStream}, ], ]; diff --git a/src/containers/Tenant/utils/schemaQueryTemplates.ts b/src/containers/Tenant/utils/schemaQueryTemplates.ts index eb0f100a7..5a2159934 100644 --- a/src/containers/Tenant/utils/schemaQueryTemplates.ts +++ b/src/containers/Tenant/utils/schemaQueryTemplates.ts @@ -68,7 +68,11 @@ WITH ( );`; }; export const alterTableTemplate = (params?: SchemaQueryParams) => { - return `ALTER TABLE \`${params?.relativePath || '$path'}\` + return `-- docs: https://ydb.tech/docs/en/yql/reference/syntax/alter_table/ + +ALTER TABLE \`${params?.relativePath || '$path'}\` + -- RENAME TO new_table_name + -- DROP COLUMN some_existing_column ADD COLUMN numeric_column Int32;`; }; export const selectQueryTemplate = (params?: SchemaQueryParams) => {