diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index fb24aca..a183792 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -7,6 +7,10 @@ env: POSTGRES_PASSWORD: password POSTGRES_DB: sequelize + MYSQL_USER: sequelize + MYSQL_DATABASE: sequelize + MYSQL_PASSWORD: password + jobs: build: @@ -24,10 +28,27 @@ jobs: # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mysql: + image: mysql:8.4 + env: + # The MySQL docker container requires these environment variables to be set + # so we can create and migrate the test database. + # See: https://hub.docker.com/_/mysql + MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} + MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_PASSWORD }} + MYSQL_USER: ${{ env.MYSQL_USER }} + MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }} + ports: + # Opens port 3306 on service container and host + # https://docs.github.com/en/actions/using-containerized-services/about-service-containers + - 3306:3306 + # Before continuing, verify the mysql container is reachable from the ubuntu host + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries 5 + strategy: matrix: node-version: [18.x, 20.x, 22.x] - database: ['sqlite', 'postgres'] + database: ['sqlite', 'postgres', 'mysql'] steps: - uses: actions/checkout@v3 diff --git a/src/adapter.ts b/src/adapter.ts index 702339c..c6877b3 100644 --- a/src/adapter.ts +++ b/src/adapter.ts @@ -363,11 +363,6 @@ export class SequelizeAdapter< } as UpdateOptions) .catch(errorHandler) as [number, Model[]?]; - if (instances?.length) { - // eslint-disable-next-line no-console - console.log('instanceof', instances[0] instanceof Model); - } - if (sequelizeOptions.returning === false) { return [] } diff --git a/test/connection.ts b/test/connection.ts index 65f349b..859aa4b 100644 --- a/test/connection.ts +++ b/test/connection.ts @@ -5,7 +5,6 @@ export default (DB?: 'postgres' | 'mysql' | string) => { const logging: Options['logging'] = false; if (DB === 'postgres') { - console.log(process.env.POSTGRES_DB, process.env.POSTGRES_USER, process.env.POSTGRES_PASSWORD) return new Sequelize( process.env.POSTGRES_DB ?? 'sequelize', process.env.POSTGRES_USER ?? 'postgres', @@ -17,11 +16,16 @@ export default (DB?: 'postgres' | 'mysql' | string) => { } ); } else if (DB === 'mysql') { - return new Sequelize('sequelize', 'root', '', { - host: '127.0.0.1', - dialect: 'mysql', - logging - }); + return new Sequelize( + process.env.MYSQl_DATABASE ?? 'sequelize', + process.env.MYSQL_USER ?? 'root', + process.env.MYSQL_PASSWORD ?? '', + { + host: '127.0.0.1', + dialect: 'mysql', + logging + } + ); } else { return new Sequelize('sequelize', '', '', { dialect: 'sqlite',