Compare commits
23 Commits
Author | SHA1 | Date |
---|---|---|
|
15426bfef9 | |
|
01b0b209a6 | |
|
07cfd1d858 | |
|
6198eab5ad | |
|
a4db93762a | |
|
2a4078b407 | |
|
746bdf49b7 | |
|
82f9c3da42 | |
|
f8a4ac4e0d | |
|
53724ad430 | |
|
ecb86079cb | |
|
516244148e | |
|
ca61167e61 | |
|
908d47b801 | |
|
fc43922f3b | |
|
2386245e15 | |
|
3596be1fa8 | |
|
83a19eac6f | |
|
d4a39f7ad2 | |
|
561474c2d2 | |
|
41147d3cc9 | |
|
db42cf6946 | |
|
8094eceabc |
54
CHANGES.md
54
CHANGES.md
|
@ -1,3 +1,57 @@
|
||||||
|
2025-04-14, Version 7.1.2
|
||||||
|
=========================
|
||||||
|
|
||||||
|
* chore: update dependency loopback-datasource-juggler to ^5.1.7 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency loopback-connector to ^6.2.3 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency sinon to v20 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency sinon to ^19.0.5 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency sinon to ^19.0.4 (renovate[bot])
|
||||||
|
|
||||||
|
|
||||||
|
2025-03-18, Version 7.1.1
|
||||||
|
=========================
|
||||||
|
|
||||||
|
* chore: update dependency loopback-datasource-juggler to ^5.1.6 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency loopback-connector to ^6.2.2 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency @commitlint/config-conventional to ^19.8.0 (renovate[bot])
|
||||||
|
|
||||||
|
|
||||||
|
2025-02-12, Version 7.1.0
|
||||||
|
=========================
|
||||||
|
|
||||||
|
* chore: update dependency loopback-datasource-juggler to ^5.1.5 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency loopback-connector to ^6.2.1 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency @commitlint/config-conventional to ^19.7.1 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency loopback-connector to ^6.2.0 (renovate[bot])
|
||||||
|
|
||||||
|
* feat: query to fetch unique columns (Muhammad Aaqil)
|
||||||
|
|
||||||
|
* chore: update dependency mocha to ^11.1.0 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency debug to ^4.4.0 (renovate[bot])
|
||||||
|
|
||||||
|
|
||||||
|
2024-12-05, Version 7.0.17
|
||||||
|
==========================
|
||||||
|
|
||||||
|
* chore: update dependency loopback-datasource-juggler to ^5.1.3 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency loopback-connector to ^6.1.12 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency mocha to v11 (renovate[bot])
|
||||||
|
|
||||||
|
* chore: update dependency @commitlint/config-conventional to ^19.6.0 (renovate[bot])
|
||||||
|
|
||||||
|
|
||||||
2024-11-12, Version 7.0.16
|
2024-11-12, Version 7.0.16
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
|
|
|
@ -301,6 +301,29 @@ function mixinDiscovery(MySQL, mysql) {
|
||||||
return sql;
|
return sql;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discover unique keys for a given table
|
||||||
|
* @param {String} table The table name
|
||||||
|
* @param {Object} options The options for discovery
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Retrieves a list of column names that have unique key index
|
||||||
|
* @param schema
|
||||||
|
* @param table
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
MySQL.prototype.buildQueryUniqueKeys = function(schema, table) {
|
||||||
|
const sql = 'SELECT Column_name AS "columnName",' +
|
||||||
|
' table_schema AS "owner",' +
|
||||||
|
' table_name AS "tableName"' +
|
||||||
|
' FROM Information_schema.statistics' +
|
||||||
|
' WHERE Table_schema = ' + mysql.escape(schema) +
|
||||||
|
' AND Table_name = ' + mysql.escape(table) +
|
||||||
|
' AND Non_unique = 0 AND Index_name <> \'PRIMARY\';';
|
||||||
|
return sql;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discover foreign keys that reference to the primary key of this table
|
* Discover foreign keys that reference to the primary key of this table
|
||||||
* @param {String} table The table name
|
* @param {String} table The table name
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "loopback-connector-mysql",
|
"name": "loopback-connector-mysql",
|
||||||
"version": "7.0.16",
|
"version": "7.1.2",
|
||||||
"description": "MySQL connector for loopback-datasource-juggler",
|
"description": "MySQL connector for loopback-datasource-juggler",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
|
@ -22,22 +22,22 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^3.2.6",
|
"async": "^3.2.6",
|
||||||
"debug": "^4.3.7",
|
"debug": "^4.4.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"loopback-connector": "^6.1.11",
|
"loopback-connector": "^6.2.3",
|
||||||
"mysql2": "^3.6.3",
|
"mysql2": "^3.6.3",
|
||||||
"patch-package": "^8.0.0",
|
"patch-package": "^8.0.0",
|
||||||
"strong-globalize": "^6.0.6"
|
"strong-globalize": "^6.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/config-conventional": "^19.5.0",
|
"@commitlint/config-conventional": "^19.8.0",
|
||||||
"eslint": "^8.57.1",
|
"eslint": "^8.57.1",
|
||||||
"eslint-config-loopback": "^13.1.0",
|
"eslint-config-loopback": "^13.1.0",
|
||||||
"loopback-datasource-juggler": "^5.1.2",
|
"loopback-datasource-juggler": "^5.1.7",
|
||||||
"mocha": "^10.8.2",
|
"mocha": "^11.1.0",
|
||||||
"rc": "^1.2.8",
|
"rc": "^1.2.8",
|
||||||
"should": "^13.2.3",
|
"should": "^13.2.3",
|
||||||
"sinon": "^19.0.2"
|
"sinon": "^20.0.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -283,6 +283,21 @@ describe('Discover LDL schema from a table', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Discover unique properties', function() {
|
||||||
|
let schema;
|
||||||
|
before(function(done) {
|
||||||
|
db.discoverSchema('CUSTOMER', {owner: 'STRONGLOOP'}, function(err, schema_) {
|
||||||
|
schema = schema_;
|
||||||
|
done(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should validate unique key for customer', function() {
|
||||||
|
assert.ok(/STRONGLOOP/i.test(schema.options.mysql.schema));
|
||||||
|
assert.strictEqual(schema.options.mysql.table, 'CUSTOMER');
|
||||||
|
assert.strictEqual(schema.properties.email.index.unique, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Discover and handle enum', function() {
|
describe('Discover and handle enum', function() {
|
||||||
let schema;
|
let schema;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
|
|
@ -39,7 +39,8 @@ CREATE TABLE `CUSTOMER` (
|
||||||
PRIMARY KEY (`ID`)
|
PRIMARY KEY (`ID`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
ALTER TABLE `CUSTOMER`
|
||||||
|
ADD COLUMN `email` VARCHAR(100) UNIQUE;
|
||||||
--
|
--
|
||||||
-- Dumping data for table `CUSTOMER`
|
-- Dumping data for table `CUSTOMER`
|
||||||
--
|
--
|
||||||
|
|
Loading…
Reference in New Issue