mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
11 Commits
v0.7.35-be
...
revert-982
Author | SHA1 | Date | |
---|---|---|---|
e6983d205e | |||
d93ae90373 | |||
86f50521d0 | |||
c966cc4266 | |||
85e516dec0 | |||
|
0b07ee1a87 | ||
|
838810981c | ||
|
b3cf20101b | ||
6c9792f512 | |||
994aa69fd0 | |||
8f84892f07 |
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.
|
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)
|
### [0.7.35-beta.0](https://github.com/antares-sql/antares/compare/v0.7.34...v0.7.35-beta.0) (2025-04-04)
|
||||||
|
|
||||||
|
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "antares",
|
"name": "antares",
|
||||||
"version": "0.7.35-beta.0",
|
"version": "0.7.35-beta.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "antares",
|
"name": "antares",
|
||||||
"version": "0.7.35-beta.0",
|
"version": "0.7.35-beta.1",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "antares",
|
"name": "antares",
|
||||||
"productName": "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.",
|
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "https://github.com/antares-sql/antares.git",
|
"repository": "https://github.com/antares-sql/antares.git",
|
||||||
|
@@ -135,7 +135,7 @@ export default (connections: Record<string, antares.Client>) => {
|
|||||||
try { // TODO: move to client classes
|
try { // TODO: move to client classes
|
||||||
let escapedParam;
|
let escapedParam;
|
||||||
let reload = false;
|
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))
|
if ([...NUMBER, ...FLOAT].includes(params.type))
|
||||||
escapedParam = params.content;
|
escapedParam = params.content;
|
||||||
@@ -221,7 +221,7 @@ export default (connections: Record<string, antares.Client>) => {
|
|||||||
.update({ [params.field]: `= ${escapedParam}` })
|
.update({ [params.field]: `= ${escapedParam}` })
|
||||||
.schema(params.schema)
|
.schema(params.schema)
|
||||||
.from(params.table)
|
.from(params.table)
|
||||||
.where({ [params.primary]: `= ${sqlEscaper(id)}` })
|
.where({ [params.primary]: `= ${id}` })
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
@@ -696,7 +696,12 @@ export class MySQLClient extends BaseClient {
|
|||||||
return rows.length ? rows[0].count : 0;
|
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(`
|
const { rows } = await this.raw(`
|
||||||
SELECT
|
SELECT
|
||||||
CONSTRAINT_NAME as name,
|
CONSTRAINT_NAME as name,
|
||||||
|
@@ -73,7 +73,7 @@
|
|||||||
<span>{{ t('database.foreignKeys') }}</span>
|
<span>{{ t('database.foreignKeys') }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="workspace.customizations.tableCheck"
|
v-if="workspace.customizations.tableCheck && originalTableChecks !== false"
|
||||||
class="btn btn-dark btn-sm ml-2 mr-0"
|
class="btn btn-dark btn-sm ml-2 mr-0"
|
||||||
:disabled="isSaving"
|
:disabled="isSaving"
|
||||||
:title="t('database.manageTableChecks')"
|
:title="t('database.manageTableChecks')"
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
/>
|
/>
|
||||||
<WorkspaceTabPropsTableChecksModal
|
<WorkspaceTabPropsTableChecksModal
|
||||||
v-if="isTableChecksModal"
|
v-if="isTableChecksModal"
|
||||||
:local-checks="localTableChecks"
|
:local-checks="localTableChecks || []"
|
||||||
:table="table"
|
:table="table"
|
||||||
:workspace="workspace"
|
:workspace="workspace"
|
||||||
@hide="hideTableChecksModal"
|
@hide="hideTableChecksModal"
|
||||||
@@ -305,8 +305,8 @@ const originalKeyUsage: Ref<TableForeign[]> = ref([]);
|
|||||||
const localKeyUsage: Ref<TableForeign[]> = ref([]);
|
const localKeyUsage: Ref<TableForeign[]> = ref([]);
|
||||||
const originalIndexes: Ref<TableIndex[]> = ref([]);
|
const originalIndexes: Ref<TableIndex[]> = ref([]);
|
||||||
const localIndexes: Ref<TableIndex[]> = ref([]);
|
const localIndexes: Ref<TableIndex[]> = ref([]);
|
||||||
const originalTableChecks: Ref<TableCheck[]> = ref([]);
|
const originalTableChecks: Ref<TableCheck[] | false> = ref([]);
|
||||||
const localTableChecks: Ref<TableCheck[]> = ref([]);
|
const localTableChecks: Ref<TableCheck[] | false> = ref(false);
|
||||||
const tableOptions: Ref<TableOptions> = ref(null);
|
const tableOptions: Ref<TableOptions> = ref(null);
|
||||||
const localOptions: Ref<TableOptions> = ref({} as TableOptions);
|
const localOptions: Ref<TableOptions> = ref({} as TableOptions);
|
||||||
const lastTable = ref(null);
|
const lastTable = ref(null);
|
||||||
@@ -465,13 +465,19 @@ const getFieldsData = async () => {
|
|||||||
const { status, response } = await Tables.getTableChecks(params);
|
const { status, response } = await Tables.getTableChecks(params);
|
||||||
|
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
originalTableChecks.value = response.map((check: TableCheck) => {
|
if (response === false) {
|
||||||
return {
|
originalTableChecks.value = false;
|
||||||
_antares_id: uidGen(),
|
localTableChecks.value = false;
|
||||||
...check
|
}
|
||||||
};
|
else {
|
||||||
});
|
originalTableChecks.value = response.map((check: TableCheck) => {
|
||||||
localTableChecks.value = JSON.parse(JSON.stringify(originalTableChecks.value));
|
return {
|
||||||
|
_antares_id: uidGen(),
|
||||||
|
...check
|
||||||
|
};
|
||||||
|
});
|
||||||
|
localTableChecks.value = JSON.parse(JSON.stringify(originalTableChecks.value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addNotification({ status: 'error', message: response });
|
addNotification({ status: 'error', message: response });
|
||||||
@@ -576,32 +582,68 @@ const saveChanges = async () => {
|
|||||||
// Foreigns Deletions
|
// Foreigns Deletions
|
||||||
foreignChanges.deletions = originalKeyUsage.value.filter(foreign => !localForeignIDs.includes(foreign._antares_id));
|
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
|
// CHECKS
|
||||||
const checkChanges = {
|
const checkChanges = {
|
||||||
additions: [] as TableCheck[],
|
additions: [] as TableCheck[],
|
||||||
changes: [] as TableCheck[],
|
changes: [] as TableCheck[],
|
||||||
deletions: [] 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
|
if (originalTableChecks.value !== false && localTableChecks.value !== false) {
|
||||||
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
|
const originalCheckIDs = originalTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||||
|
const localCheckIDs = localTableChecks.value.reduce((acc, curr) => [...acc, curr._antares_id], []);
|
||||||
|
|
||||||
// Check Changes
|
// Check Additions
|
||||||
originalTableChecks.value.forEach(originalCheck => {
|
checkChanges.additions = localTableChecks.value.filter(check => !originalCheckIDs.includes(check._antares_id));
|
||||||
const lI = localTableChecks.value.findIndex(localCheck => localCheck._antares_id === originalCheck._antares_id);
|
|
||||||
if (JSON.stringify(originalCheck) !== JSON.stringify(localTableChecks.value[lI])) {
|
// Check Changes
|
||||||
if (localTableChecks.value[lI]) {
|
originalTableChecks.value.forEach(originalCheck => {
|
||||||
checkChanges.changes.push({
|
const lI = Array.isArray(localTableChecks.value)
|
||||||
...localTableChecks.value[lI]
|
? 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
|
// Check Deletions
|
||||||
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
|
checkChanges.deletions = originalTableChecks.value.filter(check => !localCheckIDs.includes(check._antares_id));
|
||||||
|
}
|
||||||
|
|
||||||
// ALTER
|
// ALTER
|
||||||
const params = {
|
const params = {
|
||||||
|
Reference in New Issue
Block a user