mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Support db-client sqlite-legacy and add tests for them
This commit is contained in:
parent
317d5be115
commit
4213aed07b
42
.github/workflows/tests.yml
vendored
42
.github/workflows/tests.yml
vendored
@ -191,6 +191,25 @@ jobs:
|
||||
with:
|
||||
dbOptions: '--dbclient=sqlite --dbfile=./tmp/data.db'
|
||||
|
||||
e2e_ce_sqlite_legacy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, unit_back, unit_front]
|
||||
name: '[CE] E2E (sqlite, node: ${{ matrix.node }})'
|
||||
strategy:
|
||||
matrix:
|
||||
node: [12, 14, 16]
|
||||
max-parallel: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- uses: ./.github/actions/install-modules
|
||||
- uses: ./.github/actions/run-e2e-tests
|
||||
with:
|
||||
dbOptions: '--dbclient=sqlite-legacy --dbfile=./tmp/data.db'
|
||||
|
||||
# EE
|
||||
e2e_ee_pg:
|
||||
runs-on: ubuntu-latest
|
||||
@ -295,3 +314,26 @@ jobs:
|
||||
with:
|
||||
dbOptions: '--dbclient=sqlite --dbfile=./tmp/data.db'
|
||||
runEE: true
|
||||
|
||||
e2e_ee_sqlite_legacy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, unit_back, unit_front]
|
||||
name: '[EE] E2E (sqlite, node: ${{ matrix.node }})'
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]')
|
||||
env:
|
||||
STRAPI_LICENSE: ${{ secrets.strapiLicense }}
|
||||
strategy:
|
||||
matrix:
|
||||
node: [12, 14, 16]
|
||||
max-parallel: 3
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- uses: ./.github/actions/install-modules
|
||||
- uses: ./.github/actions/run-e2e-tests
|
||||
with:
|
||||
dbOptions: '--dbclient=sqlite-legacy --dbfile=./tmp/data.db'
|
||||
runEE: true
|
||||
|
||||
@ -5,6 +5,7 @@ const { merge } = require('lodash');
|
||||
const { trackUsage } = require('./utils/usage');
|
||||
const defaultConfigs = require('./utils/db-configs');
|
||||
const clientDependencies = require('./utils/db-client-dependencies');
|
||||
const getClientName = require('./utils/db-client-name');
|
||||
const createProject = require('./create-project');
|
||||
|
||||
module.exports = async scope => {
|
||||
@ -13,7 +14,7 @@ module.exports = async scope => {
|
||||
|
||||
const client = scope.database.client;
|
||||
const configuration = {
|
||||
client,
|
||||
client: getClientName({ client }),
|
||||
connection: merge({}, defaultConfigs[client] || {}, scope.database),
|
||||
dependencies: clientDependencies({ scope, client }),
|
||||
};
|
||||
|
||||
@ -4,6 +4,7 @@ const sqlClientModule = {
|
||||
mysql: { mysql: '2.18.1' },
|
||||
postgres: { pg: '8.6.0' },
|
||||
sqlite: { 'better-sqlite3': '^7.5.0' },
|
||||
'sqlite-legacy': { sqlite3: '^5.0.2' },
|
||||
};
|
||||
|
||||
/**
|
||||
@ -12,6 +13,7 @@ const sqlClientModule = {
|
||||
module.exports = ({ client }) => {
|
||||
switch (client) {
|
||||
case 'sqlite':
|
||||
case 'sqlite-legacy':
|
||||
case 'postgres':
|
||||
case 'mysql':
|
||||
return {
|
||||
|
||||
13
packages/generators/app/lib/utils/db-client-name.js
Normal file
13
packages/generators/app/lib/utils/db-client-name.js
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Client
|
||||
*/
|
||||
module.exports = ({ client }) => {
|
||||
switch (client) {
|
||||
case 'sqlite-legacy':
|
||||
return 'sqlite';
|
||||
default:
|
||||
return client;
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user