Compare commits

..

32 Commits

Author SHA1 Message Date
renovate[bot] 6198eab5ad chore: update dependency sinon to v20
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-31 15:43:11 -04:00
renovate[bot] a4db93762a chore: update dependency sinon to ^19.0.5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-25 18:39:45 -04:00
renovate[bot] 2a4078b407 chore: update dependency sinon to ^19.0.4
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-19 20:11:38 -04:00
dhmlau 746bdf49b7 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-03-18 09:45:26 -04:00
renovate[bot] 82f9c3da42 chore: update dependency loopback-datasource-juggler to ^5.1.6
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 20:25:40 -04:00
renovate[bot] f8a4ac4e0d chore: update dependency loopback-connector to ^6.2.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-17 14:41:16 -04:00
renovate[bot] 53724ad430 chore: update dependency @commitlint/config-conventional to ^19.8.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-07 20:58:20 -05:00
dhmlau ecb86079cb 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])
2025-02-12 10:28:13 -05:00
renovate[bot] 516244148e chore: update dependency loopback-datasource-juggler to ^5.1.5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-11 21:52:57 -05:00
renovate[bot] ca61167e61 chore: update dependency loopback-connector to ^6.2.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-10 14:15:34 -05:00
renovate[bot] 908d47b801 chore: update dependency @commitlint/config-conventional to ^19.7.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-03 13:03:43 -05:00
renovate[bot] fc43922f3b chore: update dependency loopback-connector to ^6.2.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-03 13:03:27 -05:00
Muhammad Aaqil 2386245e15 feat: query to fetch unique columns
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
2025-02-03 10:05:36 +05:30
renovate[bot] 3596be1fa8 chore: update dependency mocha to ^11.1.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-22 13:12:28 -05:00
renovate[bot] 83a19eac6f chore: update dependency debug to ^4.4.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-11 13:36:39 -05:00
dhmlau d4a39f7ad2 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-12-05 12:57:05 -05:00
renovate[bot] 561474c2d2 chore: update dependency loopback-datasource-juggler to ^5.1.3
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 12:56:06 -05:00
renovate[bot] 41147d3cc9 chore: update dependency loopback-connector to ^6.1.12
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-04 13:22:55 -05:00
renovate[bot] db42cf6946 chore: update dependency mocha to v11
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-04 08:20:13 -05:00
renovate[bot] 8094eceabc chore: update dependency @commitlint/config-conventional to ^19.6.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-26 11:30:03 -05:00
dhmlau 4c4ddb8ea5 7.0.16
* chore: update dependency loopback-connector to ^6.1.11 (renovate[bot])
 * chore: update dependency loopback-datasource-juggler to ^5.1.2 (renovate[bot])
 * chore: update dependency mocha to ^10.8.2 (renovate[bot])
 * chore: update dependency loopback-connector to ^6.1.10 (renovate[bot])
2024-11-12 08:40:56 -05:00
renovate[bot] f26e5693e1 chore: update dependency loopback-connector to ^6.1.11
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-12 08:40:02 -05:00
renovate[bot] 510e3ac983 chore: update dependency loopback-datasource-juggler to ^5.1.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 13:40:34 -05:00
renovate[bot] 814c13cf1d chore: update dependency mocha to ^10.8.2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-01 16:08:31 -04:00
renovate[bot] 9f21dee283 chore: update dependency loopback-connector to ^6.1.10
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-11 10:07:46 -04:00
dhmlau 68a4eb7326 7.0.15
* chore: update dependency loopback-datasource-juggler to ^5.1.1 (renovate[bot])
 * chore: update dependency sinon to v19 (renovate[bot])
 * chore: update dependency ubuntu to v24 (renovate[bot])
 * chore: update dependency eslint to ^8.57.1 (renovate[bot])
 * chore: update dependency sinon to ^18.0.1 (renovate[bot])
 * chore: update dependency @commitlint/config-conventional to ^19.5.0 (renovate[bot])
2024-10-11 10:05:17 -04:00
renovate[bot] ce4262f227 chore: update dependency loopback-datasource-juggler to ^5.1.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-11 09:36:10 -04:00
renovate[bot] 28d41b5f84 chore: update dependency sinon to v19
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-03 10:58:03 -04:00
renovate[bot] d6fa334a17 chore: update dependency ubuntu to v24
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-03 10:52:47 -04:00
renovate[bot] ee3266732e chore: update dependency eslint to ^8.57.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-24 09:52:23 -04:00
renovate[bot] 412dac918c chore: update dependency sinon to ^18.0.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-15 03:48:21 +00:00
renovate[bot] 01337c29d8 chore: update dependency @commitlint/config-conventional to ^19.5.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-14 22:22:09 -04:00
7 changed files with 698 additions and 1013 deletions

View File

@ -8,7 +8,7 @@ on:
jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
MYSQL_HOST: '127.0.0.1'
MYSQL_USER: myUser

View File

@ -1,3 +1,71 @@
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
==========================
* chore: update dependency loopback-connector to ^6.1.11 (renovate[bot])
* chore: update dependency loopback-datasource-juggler to ^5.1.2 (renovate[bot])
* chore: update dependency mocha to ^10.8.2 (renovate[bot])
* chore: update dependency loopback-connector to ^6.1.10 (renovate[bot])
2024-10-11, Version 7.0.15
==========================
* chore: update dependency loopback-datasource-juggler to ^5.1.1 (renovate[bot])
* chore: update dependency sinon to v19 (renovate[bot])
* chore: update dependency ubuntu to v24 (renovate[bot])
* chore: update dependency eslint to ^8.57.1 (renovate[bot])
* chore: update dependency sinon to ^18.0.1 (renovate[bot])
* chore: update dependency @commitlint/config-conventional to ^19.5.0 (renovate[bot])
2024-09-09, Version 7.0.14
==========================

View File

@ -301,6 +301,29 @@ function mixinDiscovery(MySQL, mysql) {
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
* @param {String} table The table name

1584
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "loopback-connector-mysql",
"version": "7.0.14",
"version": "7.1.1",
"description": "MySQL connector for loopback-datasource-juggler",
"engines": {
"node": ">=18"
@ -22,22 +22,22 @@
],
"dependencies": {
"async": "^3.2.6",
"debug": "^4.3.7",
"debug": "^4.4.0",
"lodash": "^4.17.21",
"loopback-connector": "^6.1.9",
"loopback-connector": "^6.2.2",
"mysql2": "^3.6.3",
"patch-package": "^8.0.0",
"strong-globalize": "^6.0.6"
},
"devDependencies": {
"@commitlint/config-conventional": "^19.4.1",
"eslint": "^8.57.0",
"@commitlint/config-conventional": "^19.8.0",
"eslint": "^8.57.1",
"eslint-config-loopback": "^13.1.0",
"loopback-datasource-juggler": "^5.1.0",
"mocha": "^10.7.3",
"loopback-datasource-juggler": "^5.1.6",
"mocha": "^11.1.0",
"rc": "^1.2.8",
"should": "^13.2.3",
"sinon": "^18.0.0"
"sinon": "^20.0.0"
},
"repository": {
"type": "git",

View File

@ -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() {
let schema;
before(function(done) {

View File

@ -39,7 +39,8 @@ CREATE TABLE `CUSTOMER` (
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
ALTER TABLE `CUSTOMER`
ADD COLUMN `email` VARCHAR(100) UNIQUE;
--
-- Dumping data for table `CUSTOMER`
--