Skip to content

Commit

Permalink
feat(PostgreSQL): export views
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Mar 22, 2022
1 parent bb02479 commit 86f011f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main/libs/exporters/sql/PostgreSQLExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ SET row_security = off;\n\n\n`;

async * getTableInsert (tableName) {
let rowCount = 0;
let sqlStr = '';
const sqlStr = '';

const countResults = await this._client.raw(`SELECT COUNT(1) as count FROM "${tableName}"`);
if (countResults.rows.length === 1) rowCount = countResults.rows[0].count;
Expand Down Expand Up @@ -266,8 +266,6 @@ SET row_security = off;\n\n\n`;
yield sqlInsertString;
}

sqlStr = ';\n\n';

yield sqlStr;
}
}
Expand Down Expand Up @@ -313,10 +311,8 @@ SET row_security = off;\n\n\n`;
let sqlString = '';

for (const view of views) {
sqlString += `DROP VIEW IF EXISTS '${view.viewname}';\n`;
const viewSyntax = await this.getCreateTable(view.viewname);
sqlString += viewSyntax.replaceAll('`' + this.schemaName + '`.', '');
sqlString += '\n';
sqlString += `\nDROP VIEW IF EXISTS '${view.viewname}';\n`;
sqlString += `\nCREATE VIEW "${view.viewname}" AS \n${view.definition}\n`;
}

return sqlString;
Expand Down

0 comments on commit 86f011f

Please sign in to comment.