diff --git a/.github/workflows/compatibility.yaml b/.github/workflows/compatibility.yaml index 83a75cc0..57ee191e 100644 --- a/.github/workflows/compatibility.yaml +++ b/.github/workflows/compatibility.yaml @@ -73,7 +73,11 @@ jobs: - name: Build docker-compose services for integration tests (Linux only) if: runner.os == 'Linux' - run: docker compose -f docker-compose.yml up -d + uses: Wandalen/wretry.action@v3.5.0 + with: + attempt_limit: 5 + attempt_delay: 5000 + command: docker compose -f docker-compose.yml up -d env: MYSQL_VERSION: ${{ matrix.db.mysql }} PG_VERSION: ${{ matrix.db.postgres }} @@ -212,7 +216,11 @@ jobs: uses: actions/checkout@v3 - name: Build docker-compose services - run: docker compose -f docker-compose.yml up -d + uses: Wandalen/wretry.action@v3.5.0 + with: + attempt_limit: 5 + attempt_delay: 5000 + command: docker compose -f docker-compose.yml up -d env: MYSQL_VERSION: ${{ matrix.db.mysql }} PG_VERSION: ${{ matrix.db.postgres }} diff --git a/src/ts_generator/types/ts_query.rs b/src/ts_generator/types/ts_query.rs index a6e72c9e..02f0e56d 100644 --- a/src/ts_generator/types/ts_query.rs +++ b/src/ts_generator/types/ts_query.rs @@ -223,7 +223,7 @@ impl TsFieldType { ) -> Self { match mysql_field_type.as_str() { "bigint" | "decimal" | "double" | "float" | "int" | "mediumint" | "smallint" | "year" => Self::Number, - "binary" | "bit" | "blob" | "char" | "text" | "varbinary" | "varchar" => Self::String, + "binary" | "bit" | "blob" | "char" | "text" | "varbinary" | "varchar" | "set" => Self::String, "tinyint" => Self::Boolean, "date" | "datetime" | "timestamp" => Self::Date, "json" => Self::Object, diff --git a/tests/demo/mysql/set_insert.queries.ts b/tests/demo/mysql/set_insert.queries.ts new file mode 100644 index 00000000..b7f9d7f9 --- /dev/null +++ b/tests/demo/mysql/set_insert.queries.ts @@ -0,0 +1,32 @@ +export type SetInsert1Params = [[string | null]]; + +export interface ISetInsert1Result { + +} + +export interface ISetInsert1Query { + params: SetInsert1Params; + result: ISetInsert1Result; +} + +export type SetInsert2Params = [[number | null, string | null, string | null]]; + +export interface ISetInsert2Result { + +} + +export interface ISetInsert2Query { + params: SetInsert2Params; + result: ISetInsert2Result; +} + +export type SetInsert3Params = [[string | null], [string | null]]; + +export interface ISetInsert3Result { + +} + +export interface ISetInsert3Query { + params: SetInsert3Params; + result: ISetInsert3Result; +} diff --git a/tests/demo/mysql/set_insert.snapshot.ts b/tests/demo/mysql/set_insert.snapshot.ts new file mode 100644 index 00000000..62530bb1 --- /dev/null +++ b/tests/demo/mysql/set_insert.snapshot.ts @@ -0,0 +1,33 @@ +export type SetInsert1Params = [[string | null]]; + +export interface ISetInsert1Result { + +} + +export interface ISetInsert1Query { + params: SetInsert1Params; + result: ISetInsert1Result; +} + +export type SetInsert2Params = [[number | null, string | null, string | null]]; + +export interface ISetInsert2Result { + +} + +export interface ISetInsert2Query { + params: SetInsert2Params; + result: ISetInsert2Result; +} + +export type SetInsert3Params = [[string | null], [string | null]]; + +export interface ISetInsert3Result { + +} + +export interface ISetInsert3Query { + params: SetInsert3Params; + result: ISetInsert3Result; +} + diff --git a/tests/demo/mysql/set_insert.ts b/tests/demo/mysql/set_insert.ts new file mode 100644 index 00000000..a63bb2b8 --- /dev/null +++ b/tests/demo/mysql/set_insert.ts @@ -0,0 +1,29 @@ +import { sql } from 'sqlx-ts' + +// MySQL SET type - insert single value +const setInsert1 = sql` +-- @db: db_mysql +INSERT INTO + random (set1) +VALUES + (?) +` + +// MySQL SET type - insert multiple columns including SET +const setInsert2 = sql` +-- @db: db_mysql +INSERT INTO + random (intz, set1, varchar1) +VALUES + (?, ?, ?) +` + +// MySQL SET type - insert with multiple rows +const setInsert3 = sql` +-- @db: db_mysql +INSERT INTO + random (set1) +VALUES + (?), + (?) +` diff --git a/tests/demo/mysql/set_select.queries.ts b/tests/demo/mysql/set_select.queries.ts new file mode 100644 index 00000000..2e74237d --- /dev/null +++ b/tests/demo/mysql/set_select.queries.ts @@ -0,0 +1,34 @@ +export type SetSelect1Params = []; + +export interface ISetSelect1Result { + set1: string | null; +} + +export interface ISetSelect1Query { + params: SetSelect1Params; + result: ISetSelect1Result; +} + +export type SetSelect2Params = []; + +export interface ISetSelect2Result { + intz: number | null; + set1: string | null; + varchar1: string | null; +} + +export interface ISetSelect2Query { + params: SetSelect2Params; + result: ISetSelect2Result; +} + +export type SetSelect3Params = [number | null]; + +export interface ISetSelect3Result { + set1: string | null; +} + +export interface ISetSelect3Query { + params: SetSelect3Params; + result: ISetSelect3Result; +} diff --git a/tests/demo/mysql/set_select.snapshot.ts b/tests/demo/mysql/set_select.snapshot.ts new file mode 100644 index 00000000..d5ec90c6 --- /dev/null +++ b/tests/demo/mysql/set_select.snapshot.ts @@ -0,0 +1,35 @@ +export type SetSelect1Params = []; + +export interface ISetSelect1Result { + set1: string | null; +} + +export interface ISetSelect1Query { + params: SetSelect1Params; + result: ISetSelect1Result; +} + +export type SetSelect2Params = []; + +export interface ISetSelect2Result { + intz: number | null; + set1: string | null; + varchar1: string | null; +} + +export interface ISetSelect2Query { + params: SetSelect2Params; + result: ISetSelect2Result; +} + +export type SetSelect3Params = [number | null]; + +export interface ISetSelect3Result { + set1: string | null; +} + +export interface ISetSelect3Query { + params: SetSelect3Params; + result: ISetSelect3Result; +} + diff --git a/tests/demo/mysql/set_select.ts b/tests/demo/mysql/set_select.ts new file mode 100644 index 00000000..39107aa1 --- /dev/null +++ b/tests/demo/mysql/set_select.ts @@ -0,0 +1,32 @@ +import { sql } from 'sqlx-ts' + +// MySQL SET type - select single SET column +const setSelect1 = sql` +-- @db: db_mysql +SELECT + set1 +FROM + random +` + +// MySQL SET type - select multiple columns including SET +const setSelect2 = sql` +-- @db: db_mysql +SELECT + intz, + set1, + varchar1 +FROM + random +` + +// MySQL SET type - with WHERE clause +const setSelect3 = sql` +-- @db: db_mysql +SELECT + set1 +FROM + random +WHERE + intz = ? +`