Skip to content

Commit

Permalink
Merge pull request #208 from antares-sql/feat/postgre-import-export
Browse files Browse the repository at this point in the history
feat(PostgreSQL): import/export
  • Loading branch information
Fabio286 authored Apr 7, 2022
2 parents d92facf + 6086ca4 commit 40828cb
Show file tree
Hide file tree
Showing 15 changed files with 779 additions and 39 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"moment": "^2.29.1",
"mysql2": "^2.3.2",
"pg": "^8.7.1",
"pg-query-stream": "^4.2.3",
"pgsql-ast-parser": "^7.2.1",
"source-map-support": "^0.5.20",
"spectre.css": "^0.5.9",
Expand Down
1 change: 1 addition & 0 deletions src/common/customizations/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
schemaEdit: false,
schemaDrop: false,
schemaExport: false,
exportByChunks: false,
schemaImport: false,
tableSettings: false,
tableOptions: false,
Expand Down
1 change: 1 addition & 0 deletions src/common/customizations/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
schemaEdit: true,
schemaDrop: true,
schemaExport: true,
exportByChunks: true,
schemaImport: true,
tableSettings: true,
viewSettings: true,
Expand Down
4 changes: 2 additions & 2 deletions src/common/customizations/postgresql.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ module.exports = {
routineAdd: true,
functionAdd: true,
schemaDrop: true,
schemaExport: true,
schemaImport: true,
databaseEdit: false,
schemaExport: false,
schemaImport: false,
tableSettings: true,
viewSettings: true,
triggerSettings: true,
Expand Down
2 changes: 1 addition & 1 deletion src/main/libs/clients/PostgreSQLClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ export class PostgreSQLClient extends AntaresCore {
* @memberof MySQLClient
*/
async dropSchema (params) {
return await this.raw(`DROP SCHEMA "${params.database}"`);
return await this.raw(`DROP SCHEMA "${params.database}" CASCADE`);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/main/libs/exporters/sql/MysqlExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import moment from 'moment';
import { lineString, point, polygon } from '@turf/helpers';

export default class MysqlExporter extends SqlExporter {
constructor (...args) {
super(...args);

this._commentChar = '#';
}

async getSqlHeader () {
let dump = await super.getSqlHeader();
dump += `
Expand Down
Loading

0 comments on commit 40828cb

Please sign in to comment.