mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
d93ae90373 | |||
86f50521d0 | |||
c966cc4266 | |||
85e516dec0 | |||
|
0b07ee1a87 | ||
|
838810981c | ||
|
b3cf20101b | ||
994aa69fd0 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -2,6 +2,16 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.7.35-beta.1](https://github.com/antares-sql/antares/compare/v0.7.35-beta.0...v0.7.35-beta.1) (2025-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* handle id type correctly in update-table-cell where clause, fixes [#974](https://github.com/antares-sql/antares/issues/974) ([8f84892](https://github.com/antares-sql/antares/commit/8f84892f079e5eb56c69170eb4f7bbbebd1fda72))
|
||||
* if webcontents with id 1 not found use first webcontents ([b3cf201](https://github.com/antares-sql/antares/commit/b3cf20101b938a4b47c454c7a94b32b3820bce8e))
|
||||
* improve SQL parameter escaping in update-table-cell, ensuring correct handling of id types ([994aa69](https://github.com/antares-sql/antares/commit/994aa69fd00afc7e24e593b1a6c6667535e090c2))
|
||||
* **MySQL:** handle absence of CHECK_CONSTRAINTS table, fixes [#981](https://github.com/antares-sql/antares/issues/981) ([86f5052](https://github.com/antares-sql/antares/commit/86f50521d05da0afdc9506d74e6ab007e2ae0a84))
|
||||
|
||||
### [0.7.35-beta.0](https://github.com/antares-sql/antares/compare/v0.7.34...v0.7.35-beta.0) (2025-04-04)
|
||||
|
||||
|
||||
|
1965
package-lock.json
generated
1965
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "antares",
|
||||
"productName": "Antares",
|
||||
"version": "0.7.35-beta.0",
|
||||
"version": "0.7.35-beta.1",
|
||||
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/antares-sql/antares.git",
|
||||
@@ -214,5 +214,8 @@
|
||||
"vue-eslint-parser": "~8.3.0",
|
||||
"webpack-dev-server": "~4.11.1",
|
||||
"xvfb-maybe": "~0.2.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"dmg-license": "~1.0.11"
|
||||
}
|
||||
}
|
||||
|
@@ -135,7 +135,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
try { // TODO: move to client classes
|
||||
let escapedParam;
|
||||
let reload = false;
|
||||
const id = typeof params.id === 'number' ? params.id : `${sw}${params.id}${sw}`;
|
||||
const id = typeof params.id === 'number' ? params.id : `${sw}${sqlEscaper(params.id)}${sw}`;
|
||||
|
||||
if ([...NUMBER, ...FLOAT].includes(params.type))
|
||||
escapedParam = params.content;
|
||||
@@ -221,7 +221,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
.update({ [params.field]: `= ${escapedParam}` })
|
||||
.schema(params.schema)
|
||||
.from(params.table)
|
||||
.where({ [params.primary]: `= ${typeof id === 'string' ? sqlEscaper(id) : id}` })
|
||||
.where({ [params.primary]: `= ${id}` })
|
||||
.limit(1)
|
||||
.run();
|
||||
}
|
||||
|
@@ -696,7 +696,12 @@ export class MySQLClient extends BaseClient {
|
||||
return rows.length ? rows[0].count : 0;
|
||||
}
|
||||
|
||||
async getTableChecks ({ schema, table }: { schema: string; table: string }): Promise<antares.TableCheck[]> {
|
||||
async getTableChecks ({ schema, table }: { schema: string; table: string }): Promise<antares.TableCheck[] | false> {
|
||||
const { rows: checkTableExists } = await this.raw('SELECT table_name FROM information_schema.tables WHERE table_schema = "information_schema" AND table_name = "CHECK_CONSTRAINTS"');
|
||||
|
||||
if (!checkTableExists.length)// check if CHECK_CONSTRAINTS table exists
|
||||
return false;
|
||||
|
||||
const { rows } = await this.raw(`
|
||||
SELECT
|
||||
CONSTRAINT_NAME as name,
|
||||
|
@@ -3,7 +3,13 @@ export type LoggerLevel = 'query' | 'error'
|
||||
export const ipcLogger = ({ content, cUid, level }: {content: string; cUid: string; level: LoggerLevel}) => {
|
||||
if (level === 'error') {
|
||||
if (process.type !== undefined) {
|
||||
const mainWindow = require('electron').webContents.fromId(1);
|
||||
const contents = require('electron').webContents.getAllWebContents();
|
||||
let mainWindow = require('electron').webContents.fromId(1);
|
||||
contents.forEach(content => {
|
||||
if (content.send && mainWindow === undefined) {
|
||||
mainWindow = content;
|
||||
}
|
||||
});
|
||||
mainWindow.send('non-blocking-exception', { cUid, message: content, date: new Date() });
|
||||
}
|
||||
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(content);
|
||||
@@ -12,7 +18,13 @@ export const ipcLogger = ({ content, cUid, level }: {content: string; cUid: stri
|
||||
// Remove comments, newlines and multiple spaces
|
||||
const escapedSql = content.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
|
||||
if (process.type !== undefined) {
|
||||
const mainWindow = require('electron').webContents.fromId(1);
|
||||
const contents = require('electron').webContents.getAllWebContents();
|
||||
let mainWindow = require('electron').webContents.fromId(1);
|
||||
contents.forEach(content => {
|
||||
if (content.send && mainWindow === undefined) {
|
||||
mainWindow = content;
|
||||
}
|
||||
});
|
||||
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
|
||||
}
|
||||
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(escapedSql);
|
||||
|
@@ -73,7 +73,7 @@
|
||||
<span>{{ t('database.foreignKeys') }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="workspace.customizations.tableCheck"
|
||||
v-if="workspace.customizations.tableCheck && originalTableChecks !== false"
|
||||
class="btn btn-dark btn-sm ml-2 mr-0"
|
||||
:disabled="isSaving"
|
||||
:title="t('database.manageTableChecks')"
|
||||
@@ -234,7 +234,7 @@
|
||||
/>
|
||||
<WorkspaceTabPropsTableChecksModal
|
||||
v-if="isTableChecksModal"
|
||||
:local-checks="localTableChecks"
|
||||
:local-checks="localTableChecks || []"
|
||||
:table="table"
|
||||
:workspace="workspace"
|
||||
@hide="hideTableChecksModal"
|
||||
@@ -305,8 +305,8 @@ const originalKeyUsage: Ref<TableForeign[]> = ref([]);
|
||||
const localKeyUsage: Ref<TableForeign[]> = ref([]);
|
||||
const originalIndexes: Ref<TableIndex[]> = ref([]);
|
||||
const localIndexes: Ref<TableIndex[]> = ref([]);
|
||||
const originalTableChecks: Ref<TableCheck[]> = ref([]);
|
||||
const localTableChecks: Ref<TableCheck[]> = ref([]);
|
||||
const originalTableChecks: Ref<TableCheck[] | false> = ref([]);
|
||||
const localTableChecks: Ref<TableCheck[] | false> = ref(false);
|
||||
const tableOptions: Ref<TableOptions> = ref(null);
|
||||
const localOptions: Ref<TableOptions> = ref({} as TableOptions);
|
||||
const lastTable = ref(null);
|
||||
@@ -465,13 +465,19 @@ const getFieldsData = async () => {
|
||||
const { status, response } = await Tables.getTableChecks(params);
|
||||
|
||||
if (status === 'success') {
|
||||
originalTableChecks.value = response.map((check: TableCheck) => {
|
||||
return {
|
||||
_antares_id: uidGen(),
|
||||
...check
|
||||
};
|
||||
});
|
||||
localTableChecks.value = JSON.parse(JSON.stringify(originalTableChecks.value));
|
||||
if (response === false) {
|
||||
originalTableChecks.value = false;
|
||||
localTableChecks.value = false;
|
||||
}
|
||||
else {
|
||||
originalTableChecks.value = response.map((check: TableCheck) => {
|
||||
return {
|
||||
_antares_id: uidGen(),
|
||||
...check
|
||||
};
|
||||
});
|
||||
localTableChecks.value = JSON.parse(JSON.stringify(originalTableChecks.value));
|
||||
}
|
||||
}
|
||||
else
|
||||
addNotification({ status: 'error', message: response });
|
||||
@@ -576,32 +582,68 @@ const saveChanges = async () => {
|
||||
// Foreigns Deletions
|
||||
foreignChanges.deletions = originalKeyUsage.value.filter(foreign => !localForeignIDs.includes(foreign._antares_id));
|
||||
|
||||
// CHECKS
|
||||
if (originalTableChecks.value !== false && localTableChecks.value !== false) {
|
||||
const checkChanges = {
|
||||
additions: [] as TableCheck[],
|
||||
changes: [] as TableCheck[],
|
||||
deletions: [] as TableCheck[]
|
||||
};
|
||||
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||
|
||||
// Check Additions
|
||||
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
|
||||
|
||||
// Check Changes
|
||||
originalTableChecks.value.forEach(originalCheck => {
|
||||
const lI = Array.isArray(localTableChecks.value)
|
||||
? localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id)
|
||||
: -1;
|
||||
if (Array.isArray(localTableChecks.value) && JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
|
||||
if (localTableChecks.value[lI]) {
|
||||
checkChanges.changes.push({
|
||||
...localTableChecks.value[lI]
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Check Deletions
|
||||
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
|
||||
}
|
||||
|
||||
// CHECKS
|
||||
const checkChanges = {
|
||||
additions: [] as TableCheck[],
|
||||
changes: [] as TableCheck[],
|
||||
deletions: [] as TableCheck[]
|
||||
};
|
||||
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||
|
||||
// Check Additions
|
||||
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
|
||||
if (originalTableChecks.value !== false && localTableChecks.value !== false) {
|
||||
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||
|
||||
// Check Changes
|
||||
originalTableChecks.value.forEach(originalCheck => {
|
||||
const lI = localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id);
|
||||
if (JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
|
||||
if (localTableChecks.value[lI]) {
|
||||
checkChanges.changes.push({
|
||||
...localTableChecks.value[lI]
|
||||
});
|
||||
// Check Additions
|
||||
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
|
||||
|
||||
// Check Changes
|
||||
originalTableChecks.value.forEach(originalCheck => {
|
||||
const lI = Array.isArray(localTableChecks.value)
|
||||
? localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id)
|
||||
: -1;
|
||||
if (Array.isArray(localTableChecks.value) && JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
|
||||
if (localTableChecks.value[lI]) {
|
||||
checkChanges.changes.push({
|
||||
...localTableChecks.value[lI]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Check Deletions
|
||||
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
|
||||
// Check Deletions
|
||||
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
|
||||
}
|
||||
|
||||
// ALTER
|
||||
const params = {
|
||||
|
Reference in New Issue
Block a user