From 7be35f4d387898a5d1c8c5baef07577a9463732c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Poullain?= Date: Tue, 15 Aug 2023 11:08:57 +0200 Subject: [PATCH] Drop MariaDB support --- docker-compose.yml | 14 +--- docs/docs/databases/typeorm/introduction.md | 70 ------------------- .../current/databases/typeorm/introduction.md | 70 ------------------- .../current/databases/typeorm/introduction.md | 70 ------------------- .../current/databases/typeorm/introduction.md | 70 ------------------- packages/typeorm/package.json | 3 +- .../typeorm/src/entities/group.entity.spec.ts | 4 +- .../src/entities/permission.entity.spec.ts | 4 +- .../user-with-permissions.entity.spec.ts | 4 +- .../typeorm/src/typeorm-store.service.spec.ts | 5 +- packages/typeorm/src/typeorm-store.service.ts | 2 +- 11 files changed, 8 insertions(+), 308 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4b12a85dee..728f5cec91 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,16 +12,6 @@ services: MYSQL_PASSWORD: "test" MYSQL_DATABASE: "test" - mariadb: - image: "mariadb:10.2.32" - ports: - - "3307:3306" - environment: - MYSQL_ROOT_PASSWORD: "admin" - MYSQL_USER: "test" - MYSQL_PASSWORD: "test" - MYSQL_DATABASE: "test" - postgres: image: "postgres:9.6.18" ports: @@ -35,8 +25,8 @@ services: image: "mongo:4.0.18" ports: - "27017:27017" - + redis: image: "redis:4.0.14" ports: - - "6380:6379" \ No newline at end of file + - "6380:6379" diff --git a/docs/docs/databases/typeorm/introduction.md b/docs/docs/databases/typeorm/introduction.md index abb5d35873..73facf17a1 100644 --- a/docs/docs/databases/typeorm/introduction.md +++ b/docs/docs/databases/typeorm/introduction.md @@ -49,7 +49,6 @@ FoalTS supports officially the following databases: | --- | --- | --- | | PostgreSQL | 9.6+ ([Version Policy](https://www.postgresql.org/support/versioning/)) | `pg@8` | | MySQL | 5.7+ ([Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history)) | `mysql@2` | -| MariaDB | 10.2+ ([Version Policy](https://en.wikipedia.org/wiki/MariaDB#Versioning)) | `mysql@2` | | SQLite | 3 | `sqlite3@5` and `better-sqlite3@7` (since v2.1) | | MongoDB | 4.0+ ([Version Policy](https://www.mongodb.com/support-policy)) | `mongodb@3` | @@ -211,75 +210,6 @@ module.exports = { -### MariaDB - -```sh -npm install mysql -``` - -*config/default.{json|yml|js}* - - - - -```yaml -# ... - -database: - type: mariadb - host: localhost - port: 3306 - username: root - password: password - database: my-db -``` - - - - -```json -{ - // ... - - "database": { - "type": "mariadb", - "host": "localhost", - "port": 3306, - "username": "root", - "password": "password", - "database": "my-db" - } -} -``` - - - - -```javascript -module.exports = { - // ... - - database: { - type: "mariadb", - host: "localhost", - port: 3306, - username: "root", - password: "password", - database: "my-db" - } -} -``` - - - - ## Configuration and Testing When running the command `npm run test` with the above configuration, FoalTS will try to retrieve the database configuration in this order: diff --git a/docs/i18n/es/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md b/docs/i18n/es/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md index 0ec043587b..f24154a6c5 100644 --- a/docs/i18n/es/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md +++ b/docs/i18n/es/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md @@ -49,7 +49,6 @@ FoalTS supports officially the following databases: | --- | --- | --- | | PostgreSQL | 9.6+ ([Version Policy](https://www.postgresql.org/support/versioning/)) | `pg@8` | | MySQL | 5.7+ ([Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history)) | `mysql@2` | -| MariaDB | 10.2+ ([Version Policy](https://en.wikipedia.org/wiki/MariaDB#Versioning)) | `mysql@2` | | SQLite | 3 | `sqlite3@5` and `better-sqlite3@7` (since v2.1) | | MongoDB | 4.0+ ([Version Policy](https://www.mongodb.com/support-policy)) | `mongodb@3` | @@ -211,75 +210,6 @@ module.exports = { -### MariaDB - -```sh -npm install mysql -``` - -*config/default.{json|yml|js}* - - - - -```yaml -# ... - -database: - type: mariadb - host: localhost - port: 3306 - username: root - password: password - database: my-db -``` - - - - -```json -{ - // ... - - "database": { - "type": "mariadb", - "host": "localhost", - "port": 3306, - "username": "root", - "password": "password", - "database": "my-db" - } -} -``` - - - - -```javascript -module.exports = { - // ... - - database: { - type: "mariadb", - host: "localhost", - port: 3306, - username: "root", - password: "password", - database: "my-db" - } -} -``` - - - - ## Configuration and Testing When running the command `npm run test` with the above configuration, FoalTS will try to retrieve the database configuration in this order: diff --git a/docs/i18n/fr/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md b/docs/i18n/fr/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md index abb5d35873..73facf17a1 100644 --- a/docs/i18n/fr/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md +++ b/docs/i18n/fr/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md @@ -49,7 +49,6 @@ FoalTS supports officially the following databases: | --- | --- | --- | | PostgreSQL | 9.6+ ([Version Policy](https://www.postgresql.org/support/versioning/)) | `pg@8` | | MySQL | 5.7+ ([Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history)) | `mysql@2` | -| MariaDB | 10.2+ ([Version Policy](https://en.wikipedia.org/wiki/MariaDB#Versioning)) | `mysql@2` | | SQLite | 3 | `sqlite3@5` and `better-sqlite3@7` (since v2.1) | | MongoDB | 4.0+ ([Version Policy](https://www.mongodb.com/support-policy)) | `mongodb@3` | @@ -211,75 +210,6 @@ module.exports = { -### MariaDB - -```sh -npm install mysql -``` - -*config/default.{json|yml|js}* - - - - -```yaml -# ... - -database: - type: mariadb - host: localhost - port: 3306 - username: root - password: password - database: my-db -``` - - - - -```json -{ - // ... - - "database": { - "type": "mariadb", - "host": "localhost", - "port": 3306, - "username": "root", - "password": "password", - "database": "my-db" - } -} -``` - - - - -```javascript -module.exports = { - // ... - - database: { - type: "mariadb", - host: "localhost", - port: 3306, - username: "root", - password: "password", - database: "my-db" - } -} -``` - - - - ## Configuration and Testing When running the command `npm run test` with the above configuration, FoalTS will try to retrieve the database configuration in this order: diff --git a/docs/i18n/id/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md b/docs/i18n/id/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md index abb5d35873..73facf17a1 100644 --- a/docs/i18n/id/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md +++ b/docs/i18n/id/docusaurus-plugin-content-docs/current/databases/typeorm/introduction.md @@ -49,7 +49,6 @@ FoalTS supports officially the following databases: | --- | --- | --- | | PostgreSQL | 9.6+ ([Version Policy](https://www.postgresql.org/support/versioning/)) | `pg@8` | | MySQL | 5.7+ ([Version Policy](https://en.wikipedia.org/wiki/MySQL#Release_history)) | `mysql@2` | -| MariaDB | 10.2+ ([Version Policy](https://en.wikipedia.org/wiki/MariaDB#Versioning)) | `mysql@2` | | SQLite | 3 | `sqlite3@5` and `better-sqlite3@7` (since v2.1) | | MongoDB | 4.0+ ([Version Policy](https://www.mongodb.com/support-policy)) | `mongodb@3` | @@ -211,75 +210,6 @@ module.exports = { -### MariaDB - -```sh -npm install mysql -``` - -*config/default.{json|yml|js}* - - - - -```yaml -# ... - -database: - type: mariadb - host: localhost - port: 3306 - username: root - password: password - database: my-db -``` - - - - -```json -{ - // ... - - "database": { - "type": "mariadb", - "host": "localhost", - "port": 3306, - "username": "root", - "password": "password", - "database": "my-db" - } -} -``` - - - - -```javascript -module.exports = { - // ... - - database: { - type: "mariadb", - host: "localhost", - port: 3306, - username: "root", - password: "password", - database: "my-db" - } -} -``` - - - - ## Configuration and Testing When running the command `npm run test` with the above configuration, FoalTS will try to retrieve the database configuration in this order: diff --git a/packages/typeorm/package.json b/packages/typeorm/package.json index 4dfd7364e6..20f5cba621 100644 --- a/packages/typeorm/package.json +++ b/packages/typeorm/package.json @@ -23,7 +23,6 @@ "FoalTS", "foal", "postgres", - "mariadb", "mongodb", "mysql", "sqlite", @@ -66,4 +65,4 @@ "typeorm": "0.3.10", "typescript": "~4.9.5" } -} +} \ No newline at end of file diff --git a/packages/typeorm/src/entities/group.entity.spec.ts b/packages/typeorm/src/entities/group.entity.spec.ts index 18a5e88f92..a5eaa35e68 100644 --- a/packages/typeorm/src/entities/group.entity.spec.ts +++ b/packages/typeorm/src/entities/group.entity.spec.ts @@ -8,7 +8,7 @@ import { BaseEntity, DataSource, QueryFailedError } from 'typeorm'; import { Group } from './group.entity'; import { Permission } from './permission.entity'; -function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-sqlite3') { +function testSuite(type: 'mysql' | 'postgres' | 'sqlite' | 'better-sqlite3') { describe(`with ${type}`, () => { @@ -17,7 +17,6 @@ function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-s before(async () => { switch (type) { case 'mysql': - case 'mariadb': dataSource = new DataSource({ database: 'test', dropSchema: true, @@ -202,7 +201,6 @@ function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-s describe('UserWithPermissions', () => { testSuite('mysql'); - testSuite('mariadb'); testSuite('sqlite'); testSuite('better-sqlite3'); testSuite('postgres'); diff --git a/packages/typeorm/src/entities/permission.entity.spec.ts b/packages/typeorm/src/entities/permission.entity.spec.ts index 19481f8365..4a3f17b053 100644 --- a/packages/typeorm/src/entities/permission.entity.spec.ts +++ b/packages/typeorm/src/entities/permission.entity.spec.ts @@ -7,7 +7,7 @@ import { BaseEntity, DataSource, QueryFailedError } from 'typeorm'; // FoalTS import { Permission } from './permission.entity'; -function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-sqlite3') { +function testSuite(type: 'mysql' | 'postgres' | 'sqlite' | 'better-sqlite3') { describe(`with ${type}`, () => { @@ -16,7 +16,6 @@ function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-s before(async () => { switch (type) { case 'mysql': - case 'mariadb': dataSource = new DataSource({ database: 'test', dropSchema: true, @@ -150,7 +149,6 @@ function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-s describe('UserWithPermissions', () => { testSuite('mysql'); - testSuite('mariadb'); testSuite('sqlite'); testSuite('better-sqlite3'); testSuite('postgres'); diff --git a/packages/typeorm/src/entities/user-with-permissions.entity.spec.ts b/packages/typeorm/src/entities/user-with-permissions.entity.spec.ts index 6c2a75d807..378a01c37e 100644 --- a/packages/typeorm/src/entities/user-with-permissions.entity.spec.ts +++ b/packages/typeorm/src/entities/user-with-permissions.entity.spec.ts @@ -9,7 +9,7 @@ import { Group } from './group.entity'; import { Permission } from './permission.entity'; import { UserWithPermissions } from './user-with-permissions.entity'; -function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-sqlite3') { +function testSuite(type: 'mysql' | 'postgres' | 'sqlite' | 'better-sqlite3') { describe(`with ${type}`, () => { @@ -21,7 +21,6 @@ function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-s before(async () => { switch (type) { case 'mysql': - case 'mariadb': dataSource = new DataSource({ database: 'test', dropSchema: true, @@ -332,7 +331,6 @@ function testSuite(type: 'mysql' | 'mariadb' | 'postgres' | 'sqlite' | 'better-s describe('UserWithPermissions', () => { testSuite('mysql'); - testSuite('mariadb'); testSuite('sqlite'); testSuite('better-sqlite3'); testSuite('postgres'); diff --git a/packages/typeorm/src/typeorm-store.service.spec.ts b/packages/typeorm/src/typeorm-store.service.spec.ts index f7ffc43e6d..f7d510d9b5 100644 --- a/packages/typeorm/src/typeorm-store.service.spec.ts +++ b/packages/typeorm/src/typeorm-store.service.spec.ts @@ -8,12 +8,11 @@ import { DataSource } from 'typeorm'; import { createService, createSession, SessionAlreadyExists, SessionState } from '@foal/core'; import { DatabaseSession, TypeORMStore } from './typeorm-store.service'; -type DBType = 'mysql'|'mariadb'|'postgres'|'sqlite'|'better-sqlite3'; +type DBType = 'mysql'|'postgres'|'sqlite'|'better-sqlite3'; function createTestDataSource(type: DBType, name?: string): DataSource { switch (type) { case 'mysql': - case 'mariadb': return new DataSource({ database: 'test', dropSchema: true, @@ -184,7 +183,6 @@ function entityTestSuite(type: DBType) { describe('DatabaseSession', () => { entityTestSuite('mysql'); - entityTestSuite('mariadb'); entityTestSuite('sqlite'); entityTestSuite('better-sqlite3'); entityTestSuite('postgres'); @@ -683,7 +681,6 @@ function storeTestSuite(type: DBType) { describe('TypeORMStore', () => { storeTestSuite('mysql'); - storeTestSuite('mariadb'); storeTestSuite('sqlite'); storeTestSuite('better-sqlite3'); storeTestSuite('postgres'); diff --git a/packages/typeorm/src/typeorm-store.service.ts b/packages/typeorm/src/typeorm-store.service.ts index b23536b4f8..7cb04ad3a7 100644 --- a/packages/typeorm/src/typeorm-store.service.ts +++ b/packages/typeorm/src/typeorm-store.service.ts @@ -64,7 +64,7 @@ export class TypeORMStore extends SessionStore { }) .execute(); } catch (error: any) { - // SQLite, MariaDB & MySQL, PostgreSQL + // SQLite, MySQL, PostgreSQL if ( ['SQLITE_CONSTRAINT', 'ER_DUP_ENTRY', '23505'].includes(error.code) || error.message === 'SqliteError: UNIQUE constraint failed: sessions.id'