Compare commits
No commits in common. "f290b61f44c5f0f5957894fda559cd167bcf42e5" and "3a01244199bbfa135a3187a3d24fecc038fb6218" have entirely different histories.
f290b61f44
...
3a01244199
3 changed files with 10 additions and 13 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "dblang",
|
"name": "dblang",
|
||||||
"version": "0.9.5",
|
"version": "0.9.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dblang",
|
"name": "dblang",
|
||||||
"version": "0.9.5",
|
"version": "0.9.3",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mariadb": "^3.0.2",
|
"mariadb": "^3.0.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "dblang",
|
"name": "dblang",
|
||||||
"version": "0.9.5",
|
"version": "0.9.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/db.js",
|
"main": "dist/db.js",
|
||||||
"types": "dist/db.d.ts",
|
"types": "dist/db.d.ts",
|
||||||
|
|
|
@ -121,7 +121,7 @@ export class Handler {
|
||||||
return found == fromAttrs.length && found == toAttrs.length;
|
return found == fromAttrs.length && found == toAttrs.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function freeForUpdate(attr: string, table: string, start = false, pool = del) {
|
function freeForUpdate(attr: string, table: string, start = false) {
|
||||||
for (let i = 0; i < key.length; i++) {
|
for (let i = 0; i < key.length; i++) {
|
||||||
const k = key[i];
|
const k = key[i];
|
||||||
if (
|
if (
|
||||||
|
@ -130,7 +130,7 @@ export class Handler {
|
||||||
|| (start && (k.TABLE_NAME ?? k.table_name) == table
|
|| (start && (k.TABLE_NAME ?? k.table_name) == table
|
||||||
&& (k.COLUMN_NAME ?? k.column_name).toLowerCase() == attr.toLowerCase() && (k.REFERENCED_COLUMN_NAME ?? k.referenced_column_name) != null)
|
&& (k.COLUMN_NAME ?? k.column_name).toLowerCase() == attr.toLowerCase() && (k.REFERENCED_COLUMN_NAME ?? k.referenced_column_name) != null)
|
||||||
) {
|
) {
|
||||||
pool.appendEnding(handler.querys.removeForeignKey(handler, (k.TABLE_NAME ?? k.table_name), (k.CONSTRAINT_NAME ?? k.constraint_name)));
|
del.appendEnding(handler.querys.removeForeignKey(handler, (k.TABLE_NAME ?? k.table_name), (k.CONSTRAINT_NAME ?? k.constraint_name)));
|
||||||
key.splice(i--, 1);
|
key.splice(i--, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,13 +195,7 @@ export class Handler {
|
||||||
const a = table.dbLangTableAttributes[keys[j]];
|
const a = table.dbLangTableAttributes[keys[j]];
|
||||||
const attrData = tableD[keys[j]];
|
const attrData = tableD[keys[j]];
|
||||||
if (attrData == null) {
|
if (attrData == null) {
|
||||||
if (a.ops.autoIncrement) {
|
create.appendEnding(handler.querys.addColumn(handler, a));
|
||||||
a.ops.autoIncrement = false;
|
|
||||||
create.appendEnding(handler.querys.addColumn(handler, a));
|
|
||||||
a.ops.autoIncrement = true;
|
|
||||||
connst.appendEnding(handler.querys.addColumn(handler, a));
|
|
||||||
}
|
|
||||||
else create.appendEnding(handler.querys.addColumn(handler, a));
|
|
||||||
if (a.ops.primaryKey) changePrimary = true;
|
if (a.ops.primaryKey) changePrimary = true;
|
||||||
} else if (
|
} else if (
|
||||||
!handler.builders.compareDatatypes(handler, a.type, attrData.Type) ||
|
!handler.builders.compareDatatypes(handler, a.type, attrData.Type) ||
|
||||||
|
@ -209,6 +203,10 @@ export class Handler {
|
||||||
(!!a.ops.notNull || !!a.ops.autoIncrement || !!a.ops.primaryKey) != (attrData.Null == "NO") ||
|
(!!a.ops.notNull || !!a.ops.autoIncrement || !!a.ops.primaryKey) != (attrData.Null == "NO") ||
|
||||||
(!!a.ops.autoIncrement) != (attrData.Extra == "auto_increment")
|
(!!a.ops.autoIncrement) != (attrData.Extra == "auto_increment")
|
||||||
) {
|
) {
|
||||||
|
/*console.log(!handler.builders.compareDatatypes(handler, a.type, attrData.Type), "|",
|
||||||
|
a.ops.default, attrData.Default, "|",
|
||||||
|
(!!a.ops.notNull || !!a.ops.autoIncrement || !!a.ops.primaryKey), (attrData.Null == "NO"), "|",
|
||||||
|
(!!a.ops.autoIncrement), (attrData.Extra == "auto_increment"));*/
|
||||||
freeForUpdate(a.name, a.table.dbLangTableName);
|
freeForUpdate(a.name, a.table.dbLangTableName);
|
||||||
if (a.ops.autoIncrement) {
|
if (a.ops.autoIncrement) {
|
||||||
a.ops.autoIncrement = false;
|
a.ops.autoIncrement = false;
|
||||||
|
@ -233,7 +231,6 @@ export class Handler {
|
||||||
a.ops.autoIncrement = true;
|
a.ops.autoIncrement = true;
|
||||||
connst.appendEnding(handler.querys.changeColumn(handler, a));
|
connst.appendEnding(handler.querys.changeColumn(handler, a));
|
||||||
}
|
}
|
||||||
freeForUpdate(a.name, a.table.dbLangTableName, true, create);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changePrimary) {
|
if (changePrimary) {
|
||||||
|
|
Loading…
Reference in a new issue