File tree Expand file tree Collapse file tree 7 files changed +30
-0
lines changed Expand file tree Collapse file tree 7 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ export function NewSQL() {
5858 text : i18n ( 'action.drop-external-table' ) ,
5959 action : actions . dropExternalTable ,
6060 } ,
61+ {
62+ text : i18n ( 'action.add-index' ) ,
63+ action : actions . addTableIndex ,
64+ } ,
65+ {
66+ text : i18n ( 'action.drop-index' ) ,
67+ action : actions . dropTableIndex ,
68+ } ,
6169 ] ,
6270 } ,
6371 {
Original file line number Diff line number Diff line change 1010 "action.select-from-external-table" : " Select from external table" ,
1111 "action.delete-rows" : " Delete rows" ,
1212 "action.drop-table" : " Drop table" ,
13+ "action.add-index" : " Add index" ,
14+ "action.drop-index" : " Drop index" ,
1315 "action.drop-external-table" : " Drop external table" ,
1416 "menu.tables" : " Tables" ,
1517 "menu.topics" : " Topics" ,
Original file line number Diff line number Diff line change 3636 "actions.dropTopic" : " Drop topic..." ,
3737 "actions.dropView" : " Drop view..." ,
3838 "actions.alterTable" : " Alter table..." ,
39+ "actions.addTableIndex" : " Add index..." ,
3940 "actions.alterTopic" : " Alter topic..." ,
4041 "actions.selectQuery" : " Select query..." ,
4142 "actions.upsertQuery" : " Upsert query..." ,
Original file line number Diff line number Diff line change 11import { changeUserInput } from '../../../store/reducers/executeQuery' ;
22
33import {
4+ addTableIndex ,
45 alterAsyncReplicationTemplate ,
56 alterTableTemplate ,
67 alterTopicTemplate ,
@@ -17,6 +18,7 @@ import {
1718 dropAsyncReplicationTemplate ,
1819 dropExternalTableTemplate ,
1920 dropGroupTemplate ,
21+ dropTableIndex ,
2022 dropTableTemplate ,
2123 dropTopicTemplate ,
2224 dropUserTemplate ,
@@ -58,5 +60,7 @@ export const bindActions = (dispatch: React.Dispatch<any>) => {
5860 revokePrivilege : inputQuery ( revokePrivilegeTemplate ) ,
5961 dropUser : inputQuery ( dropUserTemplate ) ,
6062 dropGroup : inputQuery ( dropGroupTemplate ) ,
63+ addTableIndex : inputQuery ( addTableIndex ) ,
64+ dropTableIndex : inputQuery ( dropTableIndex ) ,
6165 } ;
6266} ;
Original file line number Diff line number Diff line change @@ -248,3 +248,11 @@ export const dropAsyncReplicationTemplate = () => {
248248export const alterAsyncReplicationTemplate = ( ) => {
249249 return `ALTER ASYNC REPLICATION \`$path\` SET (STATE=\`$state\`, FAILOVER_MODE=\`$failoverMode\`);` ;
250250} ;
251+
252+ export const addTableIndex = ( ) => {
253+ return `ALTER TABLE \`$path\` ADD INDEX \`$indexName\` GLOBAL ON (\`$columnName\`);` ;
254+ } ;
255+
256+ export const dropTableIndex = ( ) => {
257+ return `ALTER TABLE \`$path\` DROP INDEX \`$indexName\`;` ;
258+ } ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {transformPath} from '../ObjectSummary/transformPath';
1010import i18n from '../i18n' ;
1111
1212import {
13+ addTableIndex ,
1314 alterAsyncReplicationTemplate ,
1415 alterTableTemplate ,
1516 alterTopicTemplate ,
@@ -74,6 +75,7 @@ const bindActions = (
7475 dropTopic : inputQuery ( dropTopicTemplate , 'script' ) ,
7576 createView : inputQuery ( createViewTemplate , 'script' ) ,
7677 dropView : inputQuery ( dropViewTemplate , 'script' ) ,
78+ addTableIndex : inputQuery ( addTableIndex , 'script' ) ,
7779 copyPath : ( ) => {
7880 try {
7981 copy ( relativePath ) ;
@@ -126,6 +128,7 @@ export const getActions =
126128 { text : i18n ( 'actions.alterTable' ) , action : actions . alterTable } ,
127129 { text : i18n ( 'actions.selectQuery' ) , action : actions . selectQuery } ,
128130 { text : i18n ( 'actions.upsertQuery' ) , action : actions . upsertQuery } ,
131+ { text : i18n ( 'actions.addTableIndex' ) , action : actions . addTableIndex } ,
129132 ] ,
130133 ] ;
131134
Original file line number Diff line number Diff line change @@ -153,3 +153,7 @@ export const dropAsyncReplicationTemplate = (path: string) => {
153153export const alterAsyncReplicationTemplate = ( path : string ) => {
154154 return `ALTER ASYNC REPLICATION \`${ path } \` SET (STATE = "DONE", FAILOVER_MODE = "FORCE");` ;
155155} ;
156+
157+ export const addTableIndex = ( path : string ) => {
158+ return `ALTER TABLE \`${ path } \` ADD INDEX \`$indexName\` GLOBAL ON (\`$columnName\`);` ;
159+ } ;
You can’t perform that action at this time.
0 commit comments