strapi/packages/generators/app/lib/utils/db-client-dependencies.js

27 lines
491 B
JavaScript
Raw Normal View History

2019-06-20 16:38:15 +02:00
'use strict';
const sqlClientModule = {
2021-02-24 21:59:18 +01:00
mysql: { mysql: '2.18.1' },
2021-06-29 16:27:35 +02:00
postgres: { pg: '8.6.0' },
2022-03-31 17:46:11 +02:00
sqlite: { 'better-sqlite3': '7.4.6' },
'sqlite-legacy': { sqlite3: '^5.0.2' },
2019-06-20 16:38:15 +02:00
};
/**
* Client dependencies
*/
2021-06-29 16:27:35 +02:00
module.exports = ({ client }) => {
2019-06-20 16:38:15 +02:00
switch (client) {
case 'sqlite':
case 'sqlite-legacy':
2019-06-20 16:38:15 +02:00
case 'postgres':
case 'mysql':
return {
2021-02-24 21:59:18 +01:00
...sqlClientModule[client],
2019-06-20 16:38:15 +02:00
};
2021-06-29 16:27:35 +02:00
2019-06-20 16:38:15 +02:00
default:
throw new Error(`Invalid client "${client}"`);
2019-06-20 16:38:15 +02:00
}
};