mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
7a46a119d8 | |||
f1636f1528 | |||
f839d5cd3c | |||
8f4f1d393c | |||
ab17c6d4bf | |||
b4b2f3d0cf | |||
7a766f04e6 | |||
f6b77d1243 | |||
840241c3cc | |||
0f10c9e824 | |||
1e37f2a96f | |||
0d6137195d | |||
d26f168250 |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -2,6 +2,27 @@
|
||||
|
||||
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.1.9](https://github.com/Fabio286/antares/compare/v0.1.8...v0.1.9) (2021-05-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **MySQL:** can't access tables having UNIQUE KEY, closes [#69](https://github.com/Fabio286/antares/issues/69) ([f1636f1](https://github.com/Fabio286/antares/commit/f1636f1528b5765423535f84027fdc853c58ce80))
|
||||
|
||||
### [0.1.8](https://github.com/Fabio286/antares/compare/v0.1.7...v0.1.8) (2021-05-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* internal id not removed before row update ([0f10c9e](https://github.com/Fabio286/antares/commit/0f10c9e824b679cfebd8a31085236da3d38a7953))
|
||||
* unable to add new ENUM fields ([1e37f2a](https://github.com/Fabio286/antares/commit/1e37f2a96f660a36f2739fea57ca298059e9c31a))
|
||||
* unable to delete table rows ([0d61371](https://github.com/Fabio286/antares/commit/0d6137195da9e0e9afe68f6d3ebcd50e913a888e))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* improved the way how field default value are handled ([7a766f0](https://github.com/Fabio286/antares/commit/7a766f04e668868e8844aac1d7d445bc2da21558))
|
||||
|
||||
### [0.1.7](https://github.com/Fabio286/antares/compare/v0.1.6...v0.1.7) (2021-05-16)
|
||||
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
# Antares SQL Client
|
||||
|
||||
   [](https://snapcraft.io/antares) [](https://snapcraft.io/antares) [](https://www.treedom.net/en/user/fabio-di-stasio/event/antares-for-the-planet)
|
||||
 [](https://actions-badge.atrox.dev/fabio286/antares/goto)   [](https://snapcraft.io/antares) [](https://snapcraft.io/antares) [](https://twitter.com/AntaresSQL) [](https://www.treedom.net/en/user/fabio-di-stasio/event/antares-for-the-planet)
|
||||
|
||||
Antares is an SQL client based on [Electron.js](https://github.com/electron/electron) and [Vue.js](https://github.com/vuejs/vue) that aims to become a useful tool, especially for developers.
|
||||
My target is to support as many databases as possible, and all major operating systems, including the ARM versions.
|
||||
@@ -84,7 +84,7 @@ This is a roadmap with major features will come in near future.
|
||||
|
||||
- [ ] Windows
|
||||
- [x] Linux
|
||||
- [x] MacOS
|
||||
- [ ] MacOS
|
||||
|
||||
## Translations
|
||||
|
||||
|
21
package.json
21
package.json
@@ -1,15 +1,16 @@
|
||||
{
|
||||
"name": "antares",
|
||||
"productName": "Antares",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.9",
|
||||
"description": "A cross-platform easy to use SQL client.",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/Fabio286/antares.git",
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development electron-webpack dev",
|
||||
"compile": "electron-webpack",
|
||||
"build": "cross-env NODE_ENV=production npm run compile && electron-builder",
|
||||
"build:appx": "npm run build -- --win appx",
|
||||
"build": "cross-env NODE_ENV=production npm run compile",
|
||||
"build:local": "npm run build && electron-builder",
|
||||
"build:appx": "npm run build:local -- --win appx",
|
||||
"release": "standard-version",
|
||||
"release:pre": "npm run release -- --prerelease alpha",
|
||||
"test": "npm run lint",
|
||||
@@ -31,8 +32,7 @@
|
||||
"target": {
|
||||
"target": "default",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -46,7 +46,8 @@
|
||||
"target": "AppImage",
|
||||
"arch": [
|
||||
"x64",
|
||||
"armv7l"
|
||||
"armv7l",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -92,7 +93,7 @@
|
||||
"electron-log": "^4.3.5",
|
||||
"electron-store": "^8.0.0",
|
||||
"electron-updater": "^4.3.9",
|
||||
"faker": "^5.3.1",
|
||||
"faker": "^5.5.3",
|
||||
"marked": "^2.0.2",
|
||||
"moment": "^2.29.1",
|
||||
"mysql2": "^2.2.5",
|
||||
@@ -104,12 +105,12 @@
|
||||
"v-mask": "^2.2.4",
|
||||
"vue-i18n": "^8.24.4",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuex": "^3.6.0"
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.13.14",
|
||||
"@babel/eslint-parser": "^7.14.3",
|
||||
"cross-env": "^7.0.2",
|
||||
"electron": "^12.0.7",
|
||||
"electron": "^12.0.9",
|
||||
"electron-builder": "22.10.5",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-webpack": "^2.8.2",
|
||||
|
@@ -309,6 +309,48 @@ export class MySQLClient extends AntaresCore {
|
||||
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
||||
.run();
|
||||
|
||||
const { rows: fields } = await this.raw(`SHOW CREATE TABLE ${schema}.${table}`);
|
||||
|
||||
const remappedFields = fields.map(row => {
|
||||
let n = 0;
|
||||
return row['Create Table']
|
||||
.split('')
|
||||
.reduce((acc, curr) => {
|
||||
if (curr === ')') n--;
|
||||
if (n !== 0) acc += curr;
|
||||
if (curr === '(') n++;
|
||||
return acc;
|
||||
}, '')
|
||||
.replaceAll('\n', '')
|
||||
.split(',')
|
||||
.map(f => {
|
||||
try {
|
||||
const fieldArr = f.trim().split(' ');
|
||||
const nameAndType = fieldArr.slice(0, 2);
|
||||
if (nameAndType[0].charAt(0) !== '`') return false;
|
||||
|
||||
const details = fieldArr.slice(2).join(' ');
|
||||
const defaultValue = details.includes('DEFAULT') ? details.match(/(?<=DEFAULT ).*?$/gs)[0] : null;
|
||||
const typeAndLength = nameAndType[1].replace(')', '').split('(');
|
||||
|
||||
return {
|
||||
name: nameAndType[0].replaceAll('`', ''),
|
||||
type: typeAndLength[0].toUpperCase(),
|
||||
length: typeAndLength[1] ? typeAndLength[1] : null,
|
||||
default: defaultValue
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
.reduce((acc, curr) => {
|
||||
acc[curr.name] = curr;
|
||||
return acc;
|
||||
}, {});
|
||||
})[0];
|
||||
|
||||
return rows.map(field => {
|
||||
let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/);
|
||||
numLength = numLength ? +numLength.pop() : null;
|
||||
@@ -319,7 +361,7 @@ export class MySQLClient extends AntaresCore {
|
||||
return {
|
||||
name: field.COLUMN_NAME,
|
||||
key: field.COLUMN_KEY.toLowerCase(),
|
||||
type: field.DATA_TYPE.toUpperCase(),
|
||||
type: remappedFields[field.COLUMN_NAME].type,
|
||||
schema: field.TABLE_SCHEMA,
|
||||
table: field.TABLE_NAME,
|
||||
numPrecision: field.NUMERIC_PRECISION,
|
||||
@@ -331,7 +373,7 @@ export class MySQLClient extends AntaresCore {
|
||||
unsigned: field.COLUMN_TYPE.includes('unsigned'),
|
||||
zerofill: field.COLUMN_TYPE.includes('zerofill'),
|
||||
order: field.ORDINAL_POSITION,
|
||||
default: field.COLUMN_DEFAULT, // TODO: get from show create table
|
||||
default: remappedFields[field.COLUMN_NAME].default,
|
||||
charset: field.CHARACTER_SET_NAME,
|
||||
collation: field.COLLATION_NAME,
|
||||
autoIncrement: field.EXTRA.includes('auto_increment'),
|
||||
@@ -1084,7 +1126,7 @@ export class MySQLClient extends AntaresCore {
|
||||
// ADD FIELDS
|
||||
additions.forEach(addition => {
|
||||
const typeInfo = this._getTypeInfo(addition.type);
|
||||
const length = typeInfo.length ? addition.numLength || addition.charLength || addition.datePrecision : false;
|
||||
const length = typeInfo.length ? addition.enumValues || addition.numLength || addition.charLength || addition.datePrecision : false;
|
||||
|
||||
alterColumns.push(`ADD COLUMN \`${addition.name}\`
|
||||
${addition.type.toUpperCase()}${length ? `(${length})` : ''}
|
||||
|
@@ -51,7 +51,8 @@ export default {
|
||||
}),
|
||||
isValidDefault () {
|
||||
if (!this.foreignList.length) return true;
|
||||
return this.value === null || this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString());
|
||||
if (this.value === null) return false;
|
||||
return this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString());
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
@@ -65,7 +66,7 @@ export default {
|
||||
try { // Field data
|
||||
const { status, response } = await Tables.getTableColumns(params);
|
||||
if (status === 'success') {
|
||||
const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type));
|
||||
const textField = response.find(field => [...TEXT, ...LONG_TEXT].includes(field.type) && field.name !== this.keyUsage.refField);
|
||||
foreignDesc = textField ? textField.name : false;
|
||||
}
|
||||
else
|
||||
|
@@ -250,10 +250,15 @@ export default {
|
||||
if (field.default === 'NULL') fieldDefault = null;
|
||||
else {
|
||||
if ([...NUMBER, ...FLOAT].includes(field.type))
|
||||
fieldDefault = +field.default;
|
||||
fieldDefault = Number.isNaN(+field.default) ? null : +field.default;
|
||||
|
||||
if ([...TEXT, ...LONG_TEXT].includes(field.type))
|
||||
fieldDefault = field.default ? field.default.substring(1, field.default.length - 1) : '';
|
||||
if ([...TEXT, ...LONG_TEXT].includes(field.type)) {
|
||||
fieldDefault = field.default
|
||||
? field.default.includes('\'')
|
||||
? field.default.split('\'')[1]
|
||||
: field.default
|
||||
: '';
|
||||
}
|
||||
|
||||
if ([...TIME, ...DATE].includes(field.type))
|
||||
fieldDefault = field.default;
|
||||
|
@@ -227,7 +227,7 @@
|
||||
<h4>{{ appName }}</h4>
|
||||
<p>
|
||||
{{ $t('word.version') }} {{ appVersion }}<br>
|
||||
<a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares')">GitHub</a> | <a class="c-hand" @click="openOutside('https://antares-sql.app/')">Website</a><br>
|
||||
<a class="c-hand" @click="openOutside('https://github.com/Fabio286/antares')"><i class="mdi mdi-github d-inline" /> GitHub</a> • <a class="c-hand" @click="openOutside('https://twitter.com/AntaresSQL')"><i class="mdi mdi-twitter d-inline" /> Twitter</a> • <a class="c-hand" @click="openOutside('https://antares-sql.app/')"><i class="mdi mdi-web d-inline" /> Website</a><br>
|
||||
<small>{{ $t('word.author') }} <a class="c-hand" @click="openOutside('https://github.com/Fabio286')">Fabio Di Stasio</a></small><br>
|
||||
<small>{{ $t('message.madeWithJS') }}</small>
|
||||
</p>
|
||||
|
@@ -96,7 +96,12 @@
|
||||
class="cell-content"
|
||||
@dblclick="editON($event, localLength, 'length')"
|
||||
>
|
||||
{{ localLength }}
|
||||
<span v-if="localRow.enumValues">
|
||||
{{ localRow.enumValues }}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ localLength }}
|
||||
</span>
|
||||
</span>
|
||||
<input
|
||||
v-else-if="localRow.enumValues"
|
||||
@@ -361,7 +366,7 @@ export default {
|
||||
getWorkspace: 'workspaces/getWorkspace'
|
||||
}),
|
||||
localLength () {
|
||||
return this.localRow.enumValues || this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
|
||||
return this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
|
||||
},
|
||||
fieldType () {
|
||||
const fieldType = this.dataTypes.reduce((acc, group) => [...acc, ...group.types], []).filter(type =>
|
||||
@@ -445,8 +450,13 @@ export default {
|
||||
|
||||
this.defaultValue.onUpdate = this.localRow.onUpdate;
|
||||
this.defaultValue.type = this.localRow.defaultType;
|
||||
if (this.defaultValue.type === 'custom')
|
||||
this.defaultValue.custom = this.localRow.default;
|
||||
if (this.defaultValue.type === 'custom') {
|
||||
this.defaultValue.custom = this.localRow.default
|
||||
? this.localRow.default.includes('\'')
|
||||
? this.localRow.default.split('\'')[1]
|
||||
: this.localRow.default
|
||||
: '';
|
||||
}
|
||||
if (this.defaultValue.type === 'expression')
|
||||
this.defaultValue.expression = this.localRow.default;
|
||||
},
|
||||
@@ -525,7 +535,7 @@ export default {
|
||||
break;
|
||||
case 'custom':
|
||||
this.localRow.autoIncrement = false;
|
||||
this.localRow.default = this.defaultValue.custom;
|
||||
this.localRow.default = Number.isNaN(+this.defaultValue.custom) ? `'${this.defaultValue.custom}'` : this.defaultValue.custom;
|
||||
break;
|
||||
case 'expression':
|
||||
this.localRow.autoIncrement = false;
|
||||
|
@@ -19,12 +19,11 @@ export default class {
|
||||
}
|
||||
|
||||
static updateTableCell (params) {
|
||||
delete params.row._id;
|
||||
return ipcRenderer.invoke('update-table-cell', params);
|
||||
}
|
||||
|
||||
static deleteTableRows (params) {
|
||||
delete params.row._id;
|
||||
delete params.orgRow._id;
|
||||
return ipcRenderer.invoke('delete-table-rows', params);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user