hysteria-orm 10.5.5 → 10.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.cts CHANGED
@@ -764,6 +764,122 @@ type ForeignKeyOptions = CommonConstraintOptions & {
764
764
  };
765
765
  type CreateTableContext = "alter_table" | "create_table";
766
766
  type CommonPostgresExtensions = "postgis" | "uuid-ossp" | "hstore" | "pg_trgm" | "btree_gin" | "btree_gist" | "citext" | "pgcrypto" | "tablefunc" | "unaccent" | "pg_stat_statements" | "ltree" | "cube" | "earthdistance" | "fuzzystrmatch" | "intarray" | "isn" | "lo" | "pg_buffercache" | "pgrowlocks" | "pgstattuple" | "pg_freespacemap" | "postgres_fdw" | "seg" | "tsm_system_rows" | "tsm_system_time" | "plpgsql" | "plperl" | "plpython3u" | "pltcl" | "adminpack" | "amcheck" | "autoinc" | "bloom" | "dict_int" | "dict_xsyn" | "file_fdw" | "insert_username" | "intagg" | "moddatetime" | "old_snapshot" | "pageinspect" | "pg_prewarm" | "pg_surgery" | "pg_visibility" | "pgaudit" | "pglogical" | "pgrouting" | "postgis_topology" | "postgis_raster" | "postgis_sfcgal" | "postgis_tiger_geocoder" | "address_standardizer" | "address_standardizer_data_us" | "refint" | "sslinfo" | "tcn" | "timescaledb" | "vector" | "xml2";
767
+ /**
768
+ * @description Common MySQL storage engines
769
+ * @mysql only
770
+ */
771
+ type CommonMysqlEngines = "InnoDB" | "MyISAM" | "MEMORY" | "CSV" | "ARCHIVE" | "BLACKHOLE" | "NDB" | "FEDERATED";
772
+ /**
773
+ * @description Common MySQL character sets
774
+ * @mysql only
775
+ * @description utf8mb4 is recommended for new projects (full UTF-8 support including emojis)
776
+ */
777
+ type CommonMysqlCharsets = "utf8mb4" | "utf8" | "latin1" | "ascii" | "binary" | "utf16" | "utf32" | "ucs2";
778
+ /**
779
+ * @description Common MySQL collations for utf8mb4 charset
780
+ * @mysql only
781
+ * @description utf8mb4_unicode_ci is recommended for most use cases
782
+ */
783
+ type CommonMysqlUtf8mb4Collations = "utf8mb4_unicode_ci" | "utf8mb4_general_ci" | "utf8mb4_bin" | "utf8mb4_0900_ai_ci" | "utf8mb4_0900_as_ci";
784
+ /**
785
+ * @description Common MySQL collations for utf8 (legacy) charset
786
+ * @mysql only
787
+ * @description Note: utf8 is deprecated, use utf8mb4 instead
788
+ */
789
+ type CommonMysqlUtf8Collations = "utf8_unicode_ci" | "utf8_general_ci" | "utf8_bin";
790
+ /**
791
+ * @description Common MySQL collations for latin1 charset
792
+ * @mysql only
793
+ * @description latin1_swedish_ci is the default for latin1
794
+ */
795
+ type CommonMysqlLatin1Collations = "latin1_swedish_ci" | "latin1_general_ci" | "latin1_general_cs" | "latin1_bin";
796
+ /**
797
+ * @description Common MySQL collations for ascii charset
798
+ * @mysql only
799
+ */
800
+ type CommonMysqlAsciiCollations = "ascii_general_ci" | "ascii_bin";
801
+ /**
802
+ * @description All common MySQL collations (all charsets)
803
+ * @mysql only
804
+ */
805
+ type CommonMysqlCollations = CommonMysqlUtf8mb4Collations | CommonMysqlUtf8Collations | CommonMysqlLatin1Collations | CommonMysqlAsciiCollations;
806
+ /**
807
+ * @description MySQL-specific table options
808
+ * @mysql only
809
+ */
810
+ type MysqlTableOptions = {
811
+ engine?: CommonMysqlEngines | (string & {});
812
+ charset?: CommonMysqlCharsets | (string & {});
813
+ collate?: CommonMysqlCollations | (string & {});
814
+ };
815
+ /**
816
+ * @description Additional MySQL/MariaDB table options beyond engine/charset/collate
817
+ * @mysql only
818
+ */
819
+ type MysqlAdvancedTableOptions = {
820
+ rowFormat?: "DEFAULT" | "DYNAMIC" | "COMPRESSED" | "REDUNDANT" | "COMPACT" | "FIXED";
821
+ autoIncrement?: number;
822
+ dataDirectory?: string;
823
+ indexDirectory?: string;
824
+ maxRows?: number;
825
+ minRows?: number;
826
+ checksum?: boolean;
827
+ encrypted?: boolean;
828
+ comment?: string;
829
+ };
830
+ /**
831
+ * @description PostgreSQL-specific table options
832
+ * @postgres only
833
+ */
834
+ type PostgresTableOptions = {
835
+ tablespace?: string;
836
+ unlogged?: boolean;
837
+ temporary?: boolean;
838
+ with?: Record<string, string | number | boolean>;
839
+ };
840
+ /**
841
+ * @description SQLite-specific table options
842
+ * @sqlite only
843
+ */
844
+ type SqliteTableOptions = {
845
+ strict?: boolean;
846
+ withoutRowId?: boolean;
847
+ temporary?: boolean;
848
+ };
849
+ /**
850
+ * @description MSSQL-specific table options
851
+ * @mssql only
852
+ */
853
+ type MssqlTableOptions = {
854
+ onFilegroup?: string;
855
+ textImageOn?: string;
856
+ dataCompression?: "NONE" | "ROW" | "PAGE" | "COLUMNSTORE" | "COLUMNSTORE_ARCHIVE";
857
+ };
858
+ /**
859
+ * @description OracleDB-specific table options
860
+ * @oracledb only
861
+ */
862
+ type OracledbTableOptions = {
863
+ tablespace?: string;
864
+ compress?: boolean;
865
+ storage?: {
866
+ initial?: string;
867
+ next?: string;
868
+ minextents?: number;
869
+ maxextents?: string;
870
+ pctincrease?: number;
871
+ pctfree?: number;
872
+ pctused?: number;
873
+ };
874
+ logging?: boolean;
875
+ cache?: boolean;
876
+ inMemory?: boolean;
877
+ compressFor?: "QUERY LOW" | "QUERY HIGH" | "ARCHIVE LOW" | "ARCHIVE HIGH";
878
+ };
879
+ /**
880
+ * @description Union type for all database-specific table options
881
+ */
882
+ type DatabaseTableOptions = MysqlTableOptions | PostgresTableOptions | SqliteTableOptions | MssqlTableOptions | OracledbTableOptions | MysqlAdvancedTableOptions;
767
883
 
768
884
  type OpenApiModelType = {
769
885
  type: "object";
@@ -1401,6 +1517,7 @@ declare class ColumnTypeNode extends QueryNode {
1401
1517
  enumValues?: readonly string[];
1402
1518
  autoIncrement?: boolean;
1403
1519
  withTimezone?: boolean;
1520
+ collate?: string;
1404
1521
  chainsWith: string;
1405
1522
  canKeywordBeSeenMultipleTimes: boolean;
1406
1523
  folder: string;
@@ -1413,6 +1530,7 @@ declare class ColumnTypeNode extends QueryNode {
1413
1530
  enumValues?: readonly string[];
1414
1531
  withTimezone?: boolean;
1415
1532
  autoIncrement?: boolean;
1533
+ collate?: string;
1416
1534
  isRawValue?: boolean;
1417
1535
  });
1418
1536
  }
@@ -1464,6 +1582,12 @@ declare class ConstraintBuilder extends BaseBuilder {
1464
1582
  * @mysql only
1465
1583
  */
1466
1584
  after(columnName: string): this;
1585
+ /**
1586
+ * @description Sets the COLLATE for the column
1587
+ * @mysql only
1588
+ */
1589
+ collate(collation: CommonMysqlCollations): this;
1590
+ collate(collation: string): this;
1467
1591
  private handleSqliteAutoIncrement;
1468
1592
  }
1469
1593
 
@@ -1472,7 +1596,10 @@ declare class CreateTableBuilder extends BaseBuilder {
1472
1596
  private namedConstraints;
1473
1597
  private context;
1474
1598
  private sqlType;
1599
+ private _mysqlOptions?;
1475
1600
  constructor(sqlType: SqlDataSourceType, nodes: QueryNode[], tableName?: string, context?: "alter_table" | "create_table");
1601
+ mysqlOptions(options: MysqlTableOptions): this;
1602
+ getMysqlOptions(): MysqlTableOptions | undefined;
1476
1603
  private build;
1477
1604
  /**
1478
1605
  * @description Adds a raw statement to define a default value as is
@@ -1957,6 +2084,74 @@ declare class AlterTableBuilder extends BaseBuilder {
1957
2084
  * @mssql Foreign keys referencing this primary key must be dropped first
1958
2085
  */
1959
2086
  dropPrimaryKey(table?: string): void;
2087
+ /**
2088
+ * @description Sets table options for ALTER TABLE
2089
+ * @mysql Supports: engine, charset, collate, rowFormat, autoIncrement, dataDirectory, etc.
2090
+ * @postgres Supports: tablespace, with storage parameters
2091
+ * @sqlite Not supported for ALTER TABLE table options (most table options are CREATE TABLE only)
2092
+ * @mssql Supports: onFilegroup, dataCompression
2093
+ * @oracledb Supports: tablespace, compress, storage parameters
2094
+ */
2095
+ setTableOptions(options: MysqlTableOptions & MysqlAdvancedTableOptions): this;
2096
+ setTableOptions(options: PostgresTableOptions): this;
2097
+ setTableOptions(options: SqliteTableOptions): this;
2098
+ setTableOptions(options: MssqlTableOptions): this;
2099
+ setTableOptions(options: OracledbTableOptions): this;
2100
+ setTableOptions(options: {
2101
+ engine?: CommonMysqlEngines | string;
2102
+ charset?: CommonMysqlCharsets | string;
2103
+ collate?: CommonMysqlCollations | string;
2104
+ rowFormat?: "DEFAULT" | "DYNAMIC" | "COMPRESSED" | "REDUNDANT" | "COMPACT" | "FIXED";
2105
+ autoIncrement?: number;
2106
+ dataDirectory?: string;
2107
+ indexDirectory?: string;
2108
+ maxRows?: number;
2109
+ minRows?: number;
2110
+ checksum?: boolean;
2111
+ encrypted?: boolean;
2112
+ comment?: string;
2113
+ }): this;
2114
+ setTableOptions(options: {
2115
+ engine?: CommonMysqlEngines | string;
2116
+ charset?: CommonMysqlCharsets | string;
2117
+ collate?: CommonMysqlCollations | string;
2118
+ }): this;
2119
+ setTableOptions(options: {
2120
+ tablespace?: string;
2121
+ unlogged?: boolean;
2122
+ temporary?: boolean;
2123
+ with?: Record<string, string | number | boolean>;
2124
+ }): this;
2125
+ setTableOptions(options: {
2126
+ strict?: boolean;
2127
+ withoutRowId?: boolean;
2128
+ temporary?: boolean;
2129
+ }): this;
2130
+ setTableOptions(options: {
2131
+ onFilegroup?: string;
2132
+ textImageOn?: string;
2133
+ dataCompression?: "NONE" | "ROW" | "PAGE" | "COLUMNSTORE" | "COLUMNSTORE_ARCHIVE";
2134
+ }): this;
2135
+ setTableOptions(options: {
2136
+ tablespace?: string;
2137
+ compress?: boolean;
2138
+ storage?: {
2139
+ initial?: string;
2140
+ next?: string;
2141
+ minextents?: number;
2142
+ maxextents?: string;
2143
+ pctincrease?: number;
2144
+ pctfree?: number;
2145
+ pctused?: number;
2146
+ };
2147
+ logging?: boolean;
2148
+ cache?: boolean;
2149
+ inMemory?: boolean;
2150
+ compressFor?: "QUERY LOW" | "QUERY HIGH" | "ARCHIVE LOW" | "ARCHIVE HIGH";
2151
+ }): this;
2152
+ setTableOptions(options: {
2153
+ ifNotExists?: boolean;
2154
+ } & DatabaseTableOptions): this;
1960
2155
  }
1961
2156
 
1962
2157
  /**
@@ -2011,7 +2206,7 @@ declare class SchemaBuilder implements PromiseLike<void> {
2011
2206
  */
2012
2207
  createTable(table: string, cb: (table: CreateTableBuilder) => void, options?: {
2013
2208
  ifNotExists?: boolean;
2014
- }): this;
2209
+ } & DatabaseTableOptions): this;
2015
2210
  /**
2016
2211
  * @description Alter table constructor
2017
2212
  */
@@ -2396,6 +2591,9 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
2396
2591
  * ```
2397
2592
  */
2398
2593
  select<const Columns extends readonly Selectable[]>(...columns: Columns): QueryBuilder<T, ComposeBuildRawSelect<S, Columns>>;
2594
+ select<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2595
+ [K in Alias]: ValueType;
2596
+ }>>;
2399
2597
  /**
2400
2598
  * @description Adds a raw SELECT statement to the query with type safety.
2401
2599
  * @description Use the generic parameter to specify the type of the selected columns.
@@ -2430,12 +2628,6 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
2430
2628
  selectFunc<F extends SqlFunction, Alias extends string>(sqlFunc: F, column: string, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2431
2629
  [K in Alias]: SqlFunctionReturnType<F>;
2432
2630
  }>>;
2433
- /**
2434
- * @description Selects a subquery, subquery must return a single column
2435
- */
2436
- selectSubQuery<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2437
- [K in Alias]: ValueType;
2438
- }>>;
2439
2631
  selectJson<ValueType = any, Alias extends string = string>(column: ModelKey<T> | string, path: JsonPathInput, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2440
2632
  [K in Alias]: ValueType;
2441
2633
  }>>;
@@ -4347,6 +4539,9 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
4347
4539
  * ```
4348
4540
  */
4349
4541
  select<const Columns extends readonly ModelSelectableInput<T>[]>(...columns: Columns): ModelQueryBuilder<T, ComposeBuildSelect<S, T, Columns extends readonly (string | readonly [string, string])[] ? Columns : readonly (string | readonly [string, string])[]>, R>;
4542
+ select<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): ModelQueryBuilder<T, ComposeSelect<S, {
4543
+ [K in Alias]: ValueType;
4544
+ }>, R>;
4350
4545
  /**
4351
4546
  * @description Adds a raw SELECT statement with type-safe return type.
4352
4547
  * @description Use the generic parameter to specify the type of the selected columns.
@@ -4391,28 +4586,6 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
4391
4586
  selectFunc<F extends SqlFunction, Alias extends string>(sqlFunc: F, column: ModelKey<T> | "*" | (string & {}), alias: Alias): ModelQueryBuilder<T, ComposeSelect<S, {
4392
4587
  [K in Alias]: SqlFunctionReturnType<F>;
4393
4588
  }>, R>;
4394
- /**
4395
- * @description Selects a subquery with a typed alias
4396
- * @param cbOrQueryBuilder A callback that receives a QueryBuilder or a QueryBuilder instance
4397
- * @param alias The alias for the subquery result
4398
- * @description Subquery must return a single column
4399
- * @example
4400
- * ```ts
4401
- * const users = await User.query()
4402
- * .select("id")
4403
- * .selectSubQuery<number, "postCount">((subQuery) => {
4404
- * subQuery
4405
- * .select("COUNT(*)")
4406
- * .from("posts")
4407
- * .whereColumn("posts.user_id", "users.id");
4408
- * }, "postCount")
4409
- * .many();
4410
- * // users[0].postCount is typed as number
4411
- * ```
4412
- */
4413
- selectSubQuery<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): ModelQueryBuilder<T, ComposeSelect<S, {
4414
- [K in Alias]: ValueType;
4415
- }>, R>;
4416
4589
  /**
4417
4590
  * @description Clears the SELECT clause and resets to default model type
4418
4591
  * @example
@@ -7492,7 +7665,7 @@ declare class Schema {
7492
7665
  */
7493
7666
  createTable(table: string, cb: (table: CreateTableBuilder) => void, options?: {
7494
7667
  ifNotExists?: boolean;
7495
- }): void;
7668
+ } & DatabaseTableOptions): void;
7496
7669
  /**
7497
7670
  * @description Alter table constructor
7498
7671
  * @mssql Limited support - cannot modify columns with constraints; see AlterTableBuilder methods for details
package/lib/index.d.ts CHANGED
@@ -764,6 +764,122 @@ type ForeignKeyOptions = CommonConstraintOptions & {
764
764
  };
765
765
  type CreateTableContext = "alter_table" | "create_table";
766
766
  type CommonPostgresExtensions = "postgis" | "uuid-ossp" | "hstore" | "pg_trgm" | "btree_gin" | "btree_gist" | "citext" | "pgcrypto" | "tablefunc" | "unaccent" | "pg_stat_statements" | "ltree" | "cube" | "earthdistance" | "fuzzystrmatch" | "intarray" | "isn" | "lo" | "pg_buffercache" | "pgrowlocks" | "pgstattuple" | "pg_freespacemap" | "postgres_fdw" | "seg" | "tsm_system_rows" | "tsm_system_time" | "plpgsql" | "plperl" | "plpython3u" | "pltcl" | "adminpack" | "amcheck" | "autoinc" | "bloom" | "dict_int" | "dict_xsyn" | "file_fdw" | "insert_username" | "intagg" | "moddatetime" | "old_snapshot" | "pageinspect" | "pg_prewarm" | "pg_surgery" | "pg_visibility" | "pgaudit" | "pglogical" | "pgrouting" | "postgis_topology" | "postgis_raster" | "postgis_sfcgal" | "postgis_tiger_geocoder" | "address_standardizer" | "address_standardizer_data_us" | "refint" | "sslinfo" | "tcn" | "timescaledb" | "vector" | "xml2";
767
+ /**
768
+ * @description Common MySQL storage engines
769
+ * @mysql only
770
+ */
771
+ type CommonMysqlEngines = "InnoDB" | "MyISAM" | "MEMORY" | "CSV" | "ARCHIVE" | "BLACKHOLE" | "NDB" | "FEDERATED";
772
+ /**
773
+ * @description Common MySQL character sets
774
+ * @mysql only
775
+ * @description utf8mb4 is recommended for new projects (full UTF-8 support including emojis)
776
+ */
777
+ type CommonMysqlCharsets = "utf8mb4" | "utf8" | "latin1" | "ascii" | "binary" | "utf16" | "utf32" | "ucs2";
778
+ /**
779
+ * @description Common MySQL collations for utf8mb4 charset
780
+ * @mysql only
781
+ * @description utf8mb4_unicode_ci is recommended for most use cases
782
+ */
783
+ type CommonMysqlUtf8mb4Collations = "utf8mb4_unicode_ci" | "utf8mb4_general_ci" | "utf8mb4_bin" | "utf8mb4_0900_ai_ci" | "utf8mb4_0900_as_ci";
784
+ /**
785
+ * @description Common MySQL collations for utf8 (legacy) charset
786
+ * @mysql only
787
+ * @description Note: utf8 is deprecated, use utf8mb4 instead
788
+ */
789
+ type CommonMysqlUtf8Collations = "utf8_unicode_ci" | "utf8_general_ci" | "utf8_bin";
790
+ /**
791
+ * @description Common MySQL collations for latin1 charset
792
+ * @mysql only
793
+ * @description latin1_swedish_ci is the default for latin1
794
+ */
795
+ type CommonMysqlLatin1Collations = "latin1_swedish_ci" | "latin1_general_ci" | "latin1_general_cs" | "latin1_bin";
796
+ /**
797
+ * @description Common MySQL collations for ascii charset
798
+ * @mysql only
799
+ */
800
+ type CommonMysqlAsciiCollations = "ascii_general_ci" | "ascii_bin";
801
+ /**
802
+ * @description All common MySQL collations (all charsets)
803
+ * @mysql only
804
+ */
805
+ type CommonMysqlCollations = CommonMysqlUtf8mb4Collations | CommonMysqlUtf8Collations | CommonMysqlLatin1Collations | CommonMysqlAsciiCollations;
806
+ /**
807
+ * @description MySQL-specific table options
808
+ * @mysql only
809
+ */
810
+ type MysqlTableOptions = {
811
+ engine?: CommonMysqlEngines | (string & {});
812
+ charset?: CommonMysqlCharsets | (string & {});
813
+ collate?: CommonMysqlCollations | (string & {});
814
+ };
815
+ /**
816
+ * @description Additional MySQL/MariaDB table options beyond engine/charset/collate
817
+ * @mysql only
818
+ */
819
+ type MysqlAdvancedTableOptions = {
820
+ rowFormat?: "DEFAULT" | "DYNAMIC" | "COMPRESSED" | "REDUNDANT" | "COMPACT" | "FIXED";
821
+ autoIncrement?: number;
822
+ dataDirectory?: string;
823
+ indexDirectory?: string;
824
+ maxRows?: number;
825
+ minRows?: number;
826
+ checksum?: boolean;
827
+ encrypted?: boolean;
828
+ comment?: string;
829
+ };
830
+ /**
831
+ * @description PostgreSQL-specific table options
832
+ * @postgres only
833
+ */
834
+ type PostgresTableOptions = {
835
+ tablespace?: string;
836
+ unlogged?: boolean;
837
+ temporary?: boolean;
838
+ with?: Record<string, string | number | boolean>;
839
+ };
840
+ /**
841
+ * @description SQLite-specific table options
842
+ * @sqlite only
843
+ */
844
+ type SqliteTableOptions = {
845
+ strict?: boolean;
846
+ withoutRowId?: boolean;
847
+ temporary?: boolean;
848
+ };
849
+ /**
850
+ * @description MSSQL-specific table options
851
+ * @mssql only
852
+ */
853
+ type MssqlTableOptions = {
854
+ onFilegroup?: string;
855
+ textImageOn?: string;
856
+ dataCompression?: "NONE" | "ROW" | "PAGE" | "COLUMNSTORE" | "COLUMNSTORE_ARCHIVE";
857
+ };
858
+ /**
859
+ * @description OracleDB-specific table options
860
+ * @oracledb only
861
+ */
862
+ type OracledbTableOptions = {
863
+ tablespace?: string;
864
+ compress?: boolean;
865
+ storage?: {
866
+ initial?: string;
867
+ next?: string;
868
+ minextents?: number;
869
+ maxextents?: string;
870
+ pctincrease?: number;
871
+ pctfree?: number;
872
+ pctused?: number;
873
+ };
874
+ logging?: boolean;
875
+ cache?: boolean;
876
+ inMemory?: boolean;
877
+ compressFor?: "QUERY LOW" | "QUERY HIGH" | "ARCHIVE LOW" | "ARCHIVE HIGH";
878
+ };
879
+ /**
880
+ * @description Union type for all database-specific table options
881
+ */
882
+ type DatabaseTableOptions = MysqlTableOptions | PostgresTableOptions | SqliteTableOptions | MssqlTableOptions | OracledbTableOptions | MysqlAdvancedTableOptions;
767
883
 
768
884
  type OpenApiModelType = {
769
885
  type: "object";
@@ -1401,6 +1517,7 @@ declare class ColumnTypeNode extends QueryNode {
1401
1517
  enumValues?: readonly string[];
1402
1518
  autoIncrement?: boolean;
1403
1519
  withTimezone?: boolean;
1520
+ collate?: string;
1404
1521
  chainsWith: string;
1405
1522
  canKeywordBeSeenMultipleTimes: boolean;
1406
1523
  folder: string;
@@ -1413,6 +1530,7 @@ declare class ColumnTypeNode extends QueryNode {
1413
1530
  enumValues?: readonly string[];
1414
1531
  withTimezone?: boolean;
1415
1532
  autoIncrement?: boolean;
1533
+ collate?: string;
1416
1534
  isRawValue?: boolean;
1417
1535
  });
1418
1536
  }
@@ -1464,6 +1582,12 @@ declare class ConstraintBuilder extends BaseBuilder {
1464
1582
  * @mysql only
1465
1583
  */
1466
1584
  after(columnName: string): this;
1585
+ /**
1586
+ * @description Sets the COLLATE for the column
1587
+ * @mysql only
1588
+ */
1589
+ collate(collation: CommonMysqlCollations): this;
1590
+ collate(collation: string): this;
1467
1591
  private handleSqliteAutoIncrement;
1468
1592
  }
1469
1593
 
@@ -1472,7 +1596,10 @@ declare class CreateTableBuilder extends BaseBuilder {
1472
1596
  private namedConstraints;
1473
1597
  private context;
1474
1598
  private sqlType;
1599
+ private _mysqlOptions?;
1475
1600
  constructor(sqlType: SqlDataSourceType, nodes: QueryNode[], tableName?: string, context?: "alter_table" | "create_table");
1601
+ mysqlOptions(options: MysqlTableOptions): this;
1602
+ getMysqlOptions(): MysqlTableOptions | undefined;
1476
1603
  private build;
1477
1604
  /**
1478
1605
  * @description Adds a raw statement to define a default value as is
@@ -1957,6 +2084,74 @@ declare class AlterTableBuilder extends BaseBuilder {
1957
2084
  * @mssql Foreign keys referencing this primary key must be dropped first
1958
2085
  */
1959
2086
  dropPrimaryKey(table?: string): void;
2087
+ /**
2088
+ * @description Sets table options for ALTER TABLE
2089
+ * @mysql Supports: engine, charset, collate, rowFormat, autoIncrement, dataDirectory, etc.
2090
+ * @postgres Supports: tablespace, with storage parameters
2091
+ * @sqlite Not supported for ALTER TABLE table options (most table options are CREATE TABLE only)
2092
+ * @mssql Supports: onFilegroup, dataCompression
2093
+ * @oracledb Supports: tablespace, compress, storage parameters
2094
+ */
2095
+ setTableOptions(options: MysqlTableOptions & MysqlAdvancedTableOptions): this;
2096
+ setTableOptions(options: PostgresTableOptions): this;
2097
+ setTableOptions(options: SqliteTableOptions): this;
2098
+ setTableOptions(options: MssqlTableOptions): this;
2099
+ setTableOptions(options: OracledbTableOptions): this;
2100
+ setTableOptions(options: {
2101
+ engine?: CommonMysqlEngines | string;
2102
+ charset?: CommonMysqlCharsets | string;
2103
+ collate?: CommonMysqlCollations | string;
2104
+ rowFormat?: "DEFAULT" | "DYNAMIC" | "COMPRESSED" | "REDUNDANT" | "COMPACT" | "FIXED";
2105
+ autoIncrement?: number;
2106
+ dataDirectory?: string;
2107
+ indexDirectory?: string;
2108
+ maxRows?: number;
2109
+ minRows?: number;
2110
+ checksum?: boolean;
2111
+ encrypted?: boolean;
2112
+ comment?: string;
2113
+ }): this;
2114
+ setTableOptions(options: {
2115
+ engine?: CommonMysqlEngines | string;
2116
+ charset?: CommonMysqlCharsets | string;
2117
+ collate?: CommonMysqlCollations | string;
2118
+ }): this;
2119
+ setTableOptions(options: {
2120
+ tablespace?: string;
2121
+ unlogged?: boolean;
2122
+ temporary?: boolean;
2123
+ with?: Record<string, string | number | boolean>;
2124
+ }): this;
2125
+ setTableOptions(options: {
2126
+ strict?: boolean;
2127
+ withoutRowId?: boolean;
2128
+ temporary?: boolean;
2129
+ }): this;
2130
+ setTableOptions(options: {
2131
+ onFilegroup?: string;
2132
+ textImageOn?: string;
2133
+ dataCompression?: "NONE" | "ROW" | "PAGE" | "COLUMNSTORE" | "COLUMNSTORE_ARCHIVE";
2134
+ }): this;
2135
+ setTableOptions(options: {
2136
+ tablespace?: string;
2137
+ compress?: boolean;
2138
+ storage?: {
2139
+ initial?: string;
2140
+ next?: string;
2141
+ minextents?: number;
2142
+ maxextents?: string;
2143
+ pctincrease?: number;
2144
+ pctfree?: number;
2145
+ pctused?: number;
2146
+ };
2147
+ logging?: boolean;
2148
+ cache?: boolean;
2149
+ inMemory?: boolean;
2150
+ compressFor?: "QUERY LOW" | "QUERY HIGH" | "ARCHIVE LOW" | "ARCHIVE HIGH";
2151
+ }): this;
2152
+ setTableOptions(options: {
2153
+ ifNotExists?: boolean;
2154
+ } & DatabaseTableOptions): this;
1960
2155
  }
1961
2156
 
1962
2157
  /**
@@ -2011,7 +2206,7 @@ declare class SchemaBuilder implements PromiseLike<void> {
2011
2206
  */
2012
2207
  createTable(table: string, cb: (table: CreateTableBuilder) => void, options?: {
2013
2208
  ifNotExists?: boolean;
2014
- }): this;
2209
+ } & DatabaseTableOptions): this;
2015
2210
  /**
2016
2211
  * @description Alter table constructor
2017
2212
  */
@@ -2396,6 +2591,9 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
2396
2591
  * ```
2397
2592
  */
2398
2593
  select<const Columns extends readonly Selectable[]>(...columns: Columns): QueryBuilder<T, ComposeBuildRawSelect<S, Columns>>;
2594
+ select<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2595
+ [K in Alias]: ValueType;
2596
+ }>>;
2399
2597
  /**
2400
2598
  * @description Adds a raw SELECT statement to the query with type safety.
2401
2599
  * @description Use the generic parameter to specify the type of the selected columns.
@@ -2430,12 +2628,6 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
2430
2628
  selectFunc<F extends SqlFunction, Alias extends string>(sqlFunc: F, column: string, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2431
2629
  [K in Alias]: SqlFunctionReturnType<F>;
2432
2630
  }>>;
2433
- /**
2434
- * @description Selects a subquery, subquery must return a single column
2435
- */
2436
- selectSubQuery<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2437
- [K in Alias]: ValueType;
2438
- }>>;
2439
2631
  selectJson<ValueType = any, Alias extends string = string>(column: ModelKey<T> | string, path: JsonPathInput, alias: Alias): QueryBuilder<T, ComposeRawSelect<S, {
2440
2632
  [K in Alias]: ValueType;
2441
2633
  }>>;
@@ -4347,6 +4539,9 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
4347
4539
  * ```
4348
4540
  */
4349
4541
  select<const Columns extends readonly ModelSelectableInput<T>[]>(...columns: Columns): ModelQueryBuilder<T, ComposeBuildSelect<S, T, Columns extends readonly (string | readonly [string, string])[] ? Columns : readonly (string | readonly [string, string])[]>, R>;
4542
+ select<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): ModelQueryBuilder<T, ComposeSelect<S, {
4543
+ [K in Alias]: ValueType;
4544
+ }>, R>;
4350
4545
  /**
4351
4546
  * @description Adds a raw SELECT statement with type-safe return type.
4352
4547
  * @description Use the generic parameter to specify the type of the selected columns.
@@ -4391,28 +4586,6 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
4391
4586
  selectFunc<F extends SqlFunction, Alias extends string>(sqlFunc: F, column: ModelKey<T> | "*" | (string & {}), alias: Alias): ModelQueryBuilder<T, ComposeSelect<S, {
4392
4587
  [K in Alias]: SqlFunctionReturnType<F>;
4393
4588
  }>, R>;
4394
- /**
4395
- * @description Selects a subquery with a typed alias
4396
- * @param cbOrQueryBuilder A callback that receives a QueryBuilder or a QueryBuilder instance
4397
- * @param alias The alias for the subquery result
4398
- * @description Subquery must return a single column
4399
- * @example
4400
- * ```ts
4401
- * const users = await User.query()
4402
- * .select("id")
4403
- * .selectSubQuery<number, "postCount">((subQuery) => {
4404
- * subQuery
4405
- * .select("COUNT(*)")
4406
- * .from("posts")
4407
- * .whereColumn("posts.user_id", "users.id");
4408
- * }, "postCount")
4409
- * .many();
4410
- * // users[0].postCount is typed as number
4411
- * ```
4412
- */
4413
- selectSubQuery<ValueType = any, Alias extends string = string>(cbOrQueryBuilder: ((subQuery: QueryBuilder<T>) => void) | QueryBuilder<any>, alias: Alias): ModelQueryBuilder<T, ComposeSelect<S, {
4414
- [K in Alias]: ValueType;
4415
- }>, R>;
4416
4589
  /**
4417
4590
  * @description Clears the SELECT clause and resets to default model type
4418
4591
  * @example
@@ -7492,7 +7665,7 @@ declare class Schema {
7492
7665
  */
7493
7666
  createTable(table: string, cb: (table: CreateTableBuilder) => void, options?: {
7494
7667
  ifNotExists?: boolean;
7495
- }): void;
7668
+ } & DatabaseTableOptions): void;
7496
7669
  /**
7497
7670
  * @description Alter table constructor
7498
7671
  * @mssql Limited support - cannot modify columns with constraints; see AlterTableBuilder methods for details