mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix(MySQL): can't access tables having UNIQUE KEY, closes #69
This commit is contained in:
@@ -324,10 +324,10 @@ export class MySQLClient extends AntaresCore {
|
|||||||
.replaceAll('\n', '')
|
.replaceAll('\n', '')
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(f => {
|
.map(f => {
|
||||||
|
try {
|
||||||
const fieldArr = f.trim().split(' ');
|
const fieldArr = f.trim().split(' ');
|
||||||
const nameAndType = fieldArr.slice(0, 2);
|
const nameAndType = fieldArr.slice(0, 2);
|
||||||
|
if (nameAndType[0].charAt(0) !== '`') return false;
|
||||||
if (!nameAndType[0].includes('`')) return false;
|
|
||||||
|
|
||||||
const details = fieldArr.slice(2).join(' ');
|
const details = fieldArr.slice(2).join(' ');
|
||||||
const defaultValue = details.includes('DEFAULT') ? details.match(/(?<=DEFAULT ).*?$/gs)[0] : null;
|
const defaultValue = details.includes('DEFAULT') ? details.match(/(?<=DEFAULT ).*?$/gs)[0] : null;
|
||||||
@@ -339,6 +339,10 @@ export class MySQLClient extends AntaresCore {
|
|||||||
length: typeAndLength[1] ? typeAndLength[1] : null,
|
length: typeAndLength[1] ? typeAndLength[1] : null,
|
||||||
default: defaultValue
|
default: defaultValue
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.reduce((acc, curr) => {
|
.reduce((acc, curr) => {
|
||||||
|
Reference in New Issue
Block a user