Use sub query on mysql to avoid alias issue & add mysql 5 tests

This commit is contained in:
Alexandre Bodin 2021-09-20 19:29:06 +02:00
parent 82fe2a1b87
commit 2d02f8ec2d
3 changed files with 40 additions and 2 deletions

View File

@ -137,6 +137,41 @@ jobs:
with:
dbOptions: '--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi'
e2e_ce_mysql_5:
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]
name: '[CE] E2E (mysql, node: ${{ matrix.node }})'
strategy:
matrix:
node: [12, 14, 16]
max-parallel: 2
services:
mysql:
image: mysql:5
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
-e MYSQL_ROOT_PASSWORD=strapi
-e MYSQL_ROOT_HOST="%"
-e MYSQL_USER=strapi
-e MYSQL_PASSWORD=strapi
-e MYSQL_DATABASE=strapi_test
--entrypoint sh mysql -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
ports:
# Maps tcp port 5432 on service container to the host
- 3306:3306
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/install-modules
- uses: ./.github/actions/run-e2e-tests
with:
dbOptions: '--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi'
e2e_ce_sqlite:
runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front]

View File

@ -14,7 +14,7 @@ services:
- '5432:5432'
mysql:
image: mysql
image: mysql:5
restart: always
command: --default-authentication-plugin=mysql_native_password
environment:

View File

@ -194,7 +194,10 @@ const createQueryBuilder = (uid, db) => {
this.select('*');
}
if (['delete', 'update'].includes(state.type) && state.joins.length > 0) {
if (
['delete', 'update'].includes(state.type) &&
(db.dialect.client === 'mysql' || state.joins.length > 0)
) {
this.select('id');
const subQB = this.getKnexQuery();