diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 642a8fd6..f72f122c 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -1280,7 +1280,7 @@ export class MySQLClient extends AntaresCore { * @memberof MySQLClient */ async duplicateTable (params) { - const sql = `CREATE TABLE \`${this._schema}\`.\`${params.table}_copy\` LIKE \`${this._schema}\`.\`${params.table}\``; + const sql = `CREATE TABLE \`${params.schema}\`.\`${params.table}_copy\` LIKE \`${params.schema}\`.\`${params.table}\``; return await this.raw(sql); } @@ -1291,7 +1291,7 @@ export class MySQLClient extends AntaresCore { * @memberof MySQLClient */ async truncateTable (params) { - const sql = `TRUNCATE TABLE \`${this._schema}\`.\`${params.table}\``; + const sql = `TRUNCATE TABLE \`${params.schema}\`.\`${params.table}\``; return await this.raw(sql); } @@ -1302,7 +1302,7 @@ export class MySQLClient extends AntaresCore { * @memberof MySQLClient */ async dropTable (params) { - const sql = `DROP TABLE \`${this._schema}\`.\`${params.table}\``; + const sql = `DROP TABLE \`${params.schema}\`.\`${params.table}\``; return await this.raw(sql); } diff --git a/src/main/libs/clients/PostgreSQLClient.js b/src/main/libs/clients/PostgreSQLClient.js index ba0b18d1..6ea3e427 100644 --- a/src/main/libs/clients/PostgreSQLClient.js +++ b/src/main/libs/clients/PostgreSQLClient.js @@ -1157,7 +1157,7 @@ export class PostgreSQLClient extends AntaresCore { * @memberof PostgreSQLClient */ async duplicateTable (params) { - const sql = `CREATE TABLE ${this._schema}.${params.table}_copy (LIKE ${this._schema}.${params.table} INCLUDING ALL)`; + const sql = `CREATE TABLE ${params.schema}.${params.table}_copy (LIKE ${params.schema}.${params.table} INCLUDING ALL)`; return await this.raw(sql); } @@ -1168,7 +1168,7 @@ export class PostgreSQLClient extends AntaresCore { * @memberof PostgreSQLClient */ async truncateTable (params) { - const sql = `TRUNCATE TABLE ${this._schema}.${params.table}`; + const sql = `TRUNCATE TABLE ${params.schema}.${params.table}`; return await this.raw(sql); } @@ -1179,7 +1179,7 @@ export class PostgreSQLClient extends AntaresCore { * @memberof PostgreSQLClient */ async dropTable (params) { - const sql = `DROP TABLE ${this._schema}.${params.table}`; + const sql = `DROP TABLE ${params.schema}.${params.table}`; return await this.raw(sql); } diff --git a/src/renderer/components/ModalEditSchema.vue b/src/renderer/components/ModalEditSchema.vue index 36ece081..d047439e 100644 --- a/src/renderer/components/ModalEditSchema.vue +++ b/src/renderer/components/ModalEditSchema.vue @@ -72,7 +72,7 @@ import Schema from '@/ipc-api/Schema'; export default { name: 'ModalEditSchema', props: { - selectedDatabase: String + selectedSchema: String }, data () { return { @@ -99,7 +99,7 @@ export default { async created () { let actualCollation; try { - const { status, response } = await Schema.getDatabaseCollation({ uid: this.selectedWorkspace, database: this.selectedDatabase }); + const { status, response } = await Schema.getDatabaseCollation({ uid: this.selectedWorkspace, database: this.selectedSchema }); if (status === 'success') actualCollation = response; @@ -112,8 +112,8 @@ export default { } this.database = { - name: this.selectedDatabase, - prevName: this.selectedDatabase, + name: this.selectedSchema, + prevName: this.selectedSchema, collation: actualCollation || this.defaultCollation, prevCollation: actualCollation || this.defaultCollation }; diff --git a/src/renderer/components/WorkspaceExploreBar.vue b/src/renderer/components/WorkspaceExploreBar.vue index f7424f99..149cff80 100644 --- a/src/renderer/components/WorkspaceExploreBar.vue +++ b/src/renderer/components/WorkspaceExploreBar.vue @@ -100,7 +100,7 @@ /> - {{ $t('message.deleteCorfirm') }} "{{ selectedDatabase }}"? + {{ $t('message.deleteCorfirm') }} "{{ selectedSchema }}"? @@ -110,7 +110,7 @@ export default { }, props: { contextEvent: MouseEvent, - selectedDatabase: String + selectedSchema: String }, data () { return { @@ -173,11 +173,11 @@ export default { try { const { status, response } = await Schema.deleteSchema({ uid: this.selectedWorkspace, - database: this.selectedDatabase + database: this.selectedSchema }); if (status === 'success') { - if (this.selectedDatabase === this.workspace.breadcrumbs.schema) + if (this.selectedSchema === this.workspace.breadcrumbs.schema) this.changeBreadcrumbs({ schema: null }); this.closeContext(); diff --git a/src/renderer/components/WorkspaceExploreBarTableContext.vue b/src/renderer/components/WorkspaceExploreBarTableContext.vue index 3efd1022..dd6c6e62 100644 --- a/src/renderer/components/WorkspaceExploreBarTableContext.vue +++ b/src/renderer/components/WorkspaceExploreBarTableContext.vue @@ -72,7 +72,8 @@ export default { }, props: { contextEvent: MouseEvent, - selectedTable: Object + selectedTable: Object, + selectedSchema: String }, data () { return { @@ -116,7 +117,8 @@ export default { try { const { status, response } = await Tables.duplicateTable({ uid: this.selectedWorkspace, - table: this.selectedTable.name + table: this.selectedTable.name, + schema: this.selectedSchema }); if (status === 'success') { @@ -134,7 +136,8 @@ export default { try { const { status, response } = await Tables.truncateTable({ uid: this.selectedWorkspace, - table: this.selectedTable.name + table: this.selectedTable.name, + schema: this.selectedSchema }); if (status === 'success') { @@ -155,13 +158,15 @@ export default { if (this.selectedTable.type === 'table') { res = await Tables.dropTable({ uid: this.selectedWorkspace, - table: this.selectedTable.name + table: this.selectedTable.name, + schema: this.selectedSchema }); } else if (this.selectedTable.type === 'view') { res = await Views.dropView({ uid: this.selectedWorkspace, - view: this.selectedTable.name + view: this.selectedTable.name, + schema: this.selectedSchema }); }