drizzle-kit 1.0.0-beta.1-e30ede4 → 1.0.0-beta.1-af4c434
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/api.js +33 -22
 - package/api.mjs +33 -22
 - package/bin.cjs +1 -1
 - package/package.json +1 -1
 
    
        package/api.js
    CHANGED
    
    | 
         @@ -23703,8 +23703,6 @@ var init_relations = __esm({ 
     | 
|
| 
       23703 
23703 
     | 
    
         
             
                    this.tables = tables;
         
     | 
| 
       23704 
23704 
     | 
    
         
             
                    this.config = config;
         
     | 
| 
       23705 
23705 
     | 
    
         
             
                    for (const [tsName, table6] of Object.entries(tables)) {
         
     | 
| 
       23706 
     | 
    
         
            -
                      if (config[tsName]?.$drizzleTypeError)
         
     | 
| 
       23707 
     | 
    
         
            -
                        continue;
         
     | 
| 
       23708 
23706 
     | 
    
         
             
                      const isTable2 = is(table6, Table2);
         
     | 
| 
       23709 
23707 
     | 
    
         
             
                      const isView2 = is(table6, View3);
         
     | 
| 
       23710 
23708 
     | 
    
         
             
                      if (!(isTable2 || isView2))
         
     | 
| 
         @@ -23811,14 +23809,14 @@ var init_relations = __esm({ 
     | 
|
| 
       23811 
23809 
     | 
    
         
             
                          );
         
     | 
| 
       23812 
23810 
     | 
    
         
             
                          if (reverseRelations.length > 1) {
         
     | 
| 
       23813 
23811 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23814 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
      
 23812 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
       23815 
23813 
     | 
    
         
             
            Hint: you can specify "alias" on both sides of the relation with the same value`
         
     | 
| 
       23816 
23814 
     | 
    
         
             
                            );
         
     | 
| 
       23817 
23815 
     | 
    
         
             
                          }
         
     | 
| 
       23818 
23816 
     | 
    
         
             
                          reverseRelation = reverseRelations[0];
         
     | 
| 
       23819 
23817 
     | 
    
         
             
                          if (!reverseRelation) {
         
     | 
| 
       23820 
23818 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23821 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
      
 23819 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
       23822 
23820 
     | 
    
         
             
                            );
         
     | 
| 
       23823 
23821 
     | 
    
         
             
                          }
         
     | 
| 
       23824 
23822 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -33531,7 +33529,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33531 
33529 
     | 
    
         
             
                    isNested,
         
     | 
| 
       33532 
33530 
     | 
    
         
             
                    errorPath,
         
     | 
| 
       33533 
33531 
     | 
    
         
             
                    depth,
         
     | 
| 
       33534 
     | 
    
         
            -
                    throughJoin
         
     | 
| 
      
 33532 
     | 
    
         
            +
                    throughJoin,
         
     | 
| 
      
 33533 
     | 
    
         
            +
                    jsonb: jsonb2
         
     | 
| 
       33535 
33534 
     | 
    
         
             
                  }) {
         
     | 
| 
       33536 
33535 
     | 
    
         
             
                    const selection = [];
         
     | 
| 
       33537 
33536 
     | 
    
         
             
                    const isSingle = mode === "first";
         
     | 
| 
         @@ -33584,7 +33583,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33584 
33583 
     | 
    
         
             
                            isNested: true,
         
     | 
| 
       33585 
33584 
     | 
    
         
             
                            errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
         
     | 
| 
       33586 
33585 
     | 
    
         
             
                            depth: currentDepth + 1,
         
     | 
| 
       33587 
     | 
    
         
            -
                            throughJoin: throughJoin2
         
     | 
| 
      
 33586 
     | 
    
         
            +
                            throughJoin: throughJoin2,
         
     | 
| 
      
 33587 
     | 
    
         
            +
                            jsonb: jsonb2
         
     | 
| 
       33588 
33588 
     | 
    
         
             
                          });
         
     | 
| 
       33589 
33589 
     | 
    
         
             
                          selection.push({
         
     | 
| 
       33590 
33590 
     | 
    
         
             
                            field: targetTable,
         
     | 
| 
         @@ -33595,12 +33595,12 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33595 
33595 
     | 
    
         
             
                          });
         
     | 
| 
       33596 
33596 
     | 
    
         
             
                          const jsonColumns = sql.join(
         
     | 
| 
       33597 
33597 
     | 
    
         
             
                            innerQuery.selection.map((s) => {
         
     | 
| 
       33598 
     | 
    
         
            -
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 33598 
     | 
    
         
            +
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       33599 
33599 
     | 
    
         
             
                            }),
         
     | 
| 
       33600 
33600 
     | 
    
         
             
                            sql`, `
         
     | 
| 
       33601 
33601 
     | 
    
         
             
                          );
         
     | 
| 
       33602 
     | 
    
         
            -
                          const json4 = isNested ?  
     | 
| 
       33603 
     | 
    
         
            -
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}),  
     | 
| 
      
 33602 
     | 
    
         
            +
                          const json4 = isNested ? jsonb2 : sql`json`;
         
     | 
| 
      
 33603 
     | 
    
         
            +
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}), ${jsonb2}_array()) as ${sql.identifier(k)}`;
         
     | 
| 
       33604 
33604 
     | 
    
         
             
                          return joinQuery;
         
     | 
| 
       33605 
33605 
     | 
    
         
             
                        }),
         
     | 
| 
       33606 
33606 
     | 
    
         
             
                        sql`, `
         
     | 
| 
         @@ -35001,7 +35001,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35001 
35001 
     | 
    
         
             
                init_sql();
         
     | 
| 
       35002 
35002 
     | 
    
         
             
                _a225 = entityKind;
         
     | 
| 
       35003 
35003 
     | 
    
         
             
                RelationalQueryBuilder2 = class {
         
     | 
| 
       35004 
     | 
    
         
            -
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode) {
         
     | 
| 
      
 35004 
     | 
    
         
            +
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode, forbidJsonb) {
         
     | 
| 
       35005 
35005 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35006 
35006 
     | 
    
         
             
                    this.tables = tables;
         
     | 
| 
       35007 
35007 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
         @@ -35011,6 +35011,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35011 
35011 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35012 
35012 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35013 
35013 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35014 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35014 
35015 
     | 
    
         
             
                  }
         
     | 
| 
       35015 
35016 
     | 
    
         
             
                  findMany(config) {
         
     | 
| 
       35016 
35017 
     | 
    
         
             
                    return this.mode === "sync" ? new SQLiteSyncRelationalQuery2(
         
     | 
| 
         @@ -35023,7 +35024,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35023 
35024 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35024 
35025 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35025 
35026 
     | 
    
         
             
                      "many",
         
     | 
| 
       35026 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35027 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35028 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35027 
35029 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35028 
35030 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35029 
35031 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35034,7 +35036,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35034 
35036 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35035 
35037 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35036 
35038 
     | 
    
         
             
                      "many",
         
     | 
| 
       35037 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35039 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35040 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35038 
35041 
     | 
    
         
             
                    );
         
     | 
| 
       35039 
35042 
     | 
    
         
             
                  }
         
     | 
| 
       35040 
35043 
     | 
    
         
             
                  findFirst(config) {
         
     | 
| 
         @@ -35048,7 +35051,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35048 
35051 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35049 
35052 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35050 
35053 
     | 
    
         
             
                      "first",
         
     | 
| 
       35051 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35054 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35055 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35052 
35056 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35053 
35057 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35054 
35058 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35059,13 +35063,14 @@ var init_query4 = __esm({ 
     | 
|
| 
       35059 
35063 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35060 
35064 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35061 
35065 
     | 
    
         
             
                      "first",
         
     | 
| 
       35062 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35066 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35067 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35063 
35068 
     | 
    
         
             
                    );
         
     | 
| 
       35064 
35069 
     | 
    
         
             
                  }
         
     | 
| 
       35065 
35070 
     | 
    
         
             
                };
         
     | 
| 
       35066 
35071 
     | 
    
         
             
                __publicField(RelationalQueryBuilder2, _a225, "SQLiteAsyncRelationalQueryBuilderV2");
         
     | 
| 
       35067 
35072 
     | 
    
         
             
                SQLiteRelationalQuery2 = class extends (_b156 = QueryPromise, _a226 = entityKind, _b156) {
         
     | 
| 
       35068 
     | 
    
         
            -
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode) {
         
     | 
| 
      
 35073 
     | 
    
         
            +
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode, forbidJsonb) {
         
     | 
| 
       35069 
35074 
     | 
    
         
             
                    super();
         
     | 
| 
       35070 
35075 
     | 
    
         
             
                    /** @internal */
         
     | 
| 
       35071 
35076 
     | 
    
         
             
                    __publicField(this, "mode");
         
     | 
| 
         @@ -35079,6 +35084,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35079 
35084 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35080 
35085 
     | 
    
         
             
                    this.config = config;
         
     | 
| 
       35081 
35086 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35087 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35082 
35088 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35083 
35089 
     | 
    
         
             
                    this.table = table6;
         
     | 
| 
       35084 
35090 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35091,7 +35097,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35091 
35097 
     | 
    
         
             
                      tableConfig: this.tableConfig,
         
     | 
| 
       35092 
35098 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35093 
35099 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35094 
     | 
    
         
            -
                      mode: this.mode
         
     | 
| 
      
 35100 
     | 
    
         
            +
                      mode: this.mode,
         
     | 
| 
      
 35101 
     | 
    
         
            +
                      jsonb: this.forbidJsonb ? sql`json` : sql`jsonb`
         
     | 
| 
       35095 
35102 
     | 
    
         
             
                    });
         
     | 
| 
       35096 
35103 
     | 
    
         
             
                    return query.sql;
         
     | 
| 
       35097 
35104 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35115,6 +35122,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35115 
35122 
     | 
    
         
             
                    return this._prepare(false);
         
     | 
| 
       35116 
35123 
     | 
    
         
             
                  }
         
     | 
| 
       35117 
35124 
     | 
    
         
             
                  _getQuery() {
         
     | 
| 
      
 35125 
     | 
    
         
            +
                    const jsonb2 = this.forbidJsonb ? sql`json` : sql`jsonb`;
         
     | 
| 
       35118 
35126 
     | 
    
         
             
                    const query = this.dialect.buildRelationalQuery({
         
     | 
| 
       35119 
35127 
     | 
    
         
             
                      schema: this.schema,
         
     | 
| 
       35120 
35128 
     | 
    
         
             
                      tableNamesMap: this.tableNamesMap,
         
     | 
| 
         @@ -35123,12 +35131,13 @@ var init_query4 = __esm({ 
     | 
|
| 
       35123 
35131 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35124 
35132 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35125 
35133 
     | 
    
         
             
                      mode: this.mode,
         
     | 
| 
       35126 
     | 
    
         
            -
                      isNested: this.rowMode
         
     | 
| 
      
 35134 
     | 
    
         
            +
                      isNested: this.rowMode,
         
     | 
| 
      
 35135 
     | 
    
         
            +
                      jsonb: jsonb2
         
     | 
| 
       35127 
35136 
     | 
    
         
             
                    });
         
     | 
| 
       35128 
35137 
     | 
    
         
             
                    if (this.rowMode) {
         
     | 
| 
       35129 
35138 
     | 
    
         
             
                      const jsonColumns = sql.join(
         
     | 
| 
       35130 
35139 
     | 
    
         
             
                        query.selection.map((s) => {
         
     | 
| 
       35131 
     | 
    
         
            -
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 35140 
     | 
    
         
            +
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       35132 
35141 
     | 
    
         
             
                        }),
         
     | 
| 
       35133 
35142 
     | 
    
         
             
                        sql`, `
         
     | 
| 
       35134 
35143 
     | 
    
         
             
                      );
         
     | 
| 
         @@ -35217,7 +35226,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35217 
35226 
     | 
    
         
             
                init_raw2();
         
     | 
| 
       35218 
35227 
     | 
    
         
             
                _a229 = entityKind;
         
     | 
| 
       35219 
35228 
     | 
    
         
             
                BaseSQLiteDatabase = class {
         
     | 
| 
       35220 
     | 
    
         
            -
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB) {
         
     | 
| 
      
 35229 
     | 
    
         
            +
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB, forbidJsonb) {
         
     | 
| 
       35221 
35230 
     | 
    
         
             
                    /** @deprecated */
         
     | 
| 
       35222 
35231 
     | 
    
         
             
                    __publicField(this, "_query");
         
     | 
| 
       35223 
35232 
     | 
    
         
             
                    // TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas
         
     | 
| 
         @@ -35276,6 +35285,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35276 
35285 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35277 
35286 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35278 
35287 
     | 
    
         
             
                    this.rowModeRQB = rowModeRQB;
         
     | 
| 
      
 35288 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35279 
35289 
     | 
    
         
             
                    const rel = relations ?? {};
         
     | 
| 
       35280 
35290 
     | 
    
         
             
                    this._ = _schema ? {
         
     | 
| 
       35281 
35291 
     | 
    
         
             
                      schema: _schema.schema,
         
     | 
| 
         @@ -35316,7 +35326,8 @@ var init_db2 = __esm({ 
     | 
|
| 
       35316 
35326 
     | 
    
         
             
                          relation,
         
     | 
| 
       35317 
35327 
     | 
    
         
             
                          dialect6,
         
     | 
| 
       35318 
35328 
     | 
    
         
             
                          session,
         
     | 
| 
       35319 
     | 
    
         
            -
                          rowModeRQB
         
     | 
| 
      
 35329 
     | 
    
         
            +
                          rowModeRQB,
         
     | 
| 
      
 35330 
     | 
    
         
            +
                          forbidJsonb
         
     | 
| 
       35320 
35331 
     | 
    
         
             
                        );
         
     | 
| 
       35321 
35332 
     | 
    
         
             
                      }
         
     | 
| 
       35322 
35333 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -35736,8 +35747,8 @@ var init_session2 = __esm({ 
     | 
|
| 
       35736 
35747 
     | 
    
         
             
                };
         
     | 
| 
       35737 
35748 
     | 
    
         
             
                __publicField(SQLiteSession, _a237, "SQLiteSession");
         
     | 
| 
       35738 
35749 
     | 
    
         
             
                SQLiteTransaction = class extends (_b160 = BaseSQLiteDatabase, _a238 = entityKind, _b160) {
         
     | 
| 
       35739 
     | 
    
         
            -
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB) {
         
     | 
| 
       35740 
     | 
    
         
            -
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB);
         
     | 
| 
      
 35750 
     | 
    
         
            +
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB, forbidJsonb) {
         
     | 
| 
      
 35751 
     | 
    
         
            +
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB, forbidJsonb);
         
     | 
| 
       35741 
35752 
     | 
    
         
             
                    this.relations = relations;
         
     | 
| 
       35742 
35753 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
       35743 
35754 
     | 
    
         
             
                    this.nestedIndex = nestedIndex;
         
     | 
    
        package/api.mjs
    CHANGED
    
    | 
         @@ -23708,8 +23708,6 @@ var init_relations = __esm({ 
     | 
|
| 
       23708 
23708 
     | 
    
         
             
                    this.tables = tables;
         
     | 
| 
       23709 
23709 
     | 
    
         
             
                    this.config = config;
         
     | 
| 
       23710 
23710 
     | 
    
         
             
                    for (const [tsName, table6] of Object.entries(tables)) {
         
     | 
| 
       23711 
     | 
    
         
            -
                      if (config[tsName]?.$drizzleTypeError)
         
     | 
| 
       23712 
     | 
    
         
            -
                        continue;
         
     | 
| 
       23713 
23711 
     | 
    
         
             
                      const isTable2 = is(table6, Table2);
         
     | 
| 
       23714 
23712 
     | 
    
         
             
                      const isView2 = is(table6, View3);
         
     | 
| 
       23715 
23713 
     | 
    
         
             
                      if (!(isTable2 || isView2))
         
     | 
| 
         @@ -23816,14 +23814,14 @@ var init_relations = __esm({ 
     | 
|
| 
       23816 
23814 
     | 
    
         
             
                          );
         
     | 
| 
       23817 
23815 
     | 
    
         
             
                          if (reverseRelations.length > 1) {
         
     | 
| 
       23818 
23816 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23819 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
      
 23817 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and multiple relations between "${targetTableTsName}" and "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" were found.
         
     | 
| 
       23820 
23818 
     | 
    
         
             
            Hint: you can specify "alias" on both sides of the relation with the same value`
         
     | 
| 
       23821 
23819 
     | 
    
         
             
                            );
         
     | 
| 
       23822 
23820 
     | 
    
         
             
                          }
         
     | 
| 
       23823 
23821 
     | 
    
         
             
                          reverseRelation = reverseRelations[0];
         
     | 
| 
       23824 
23822 
     | 
    
         
             
                          if (!reverseRelation) {
         
     | 
| 
       23825 
23823 
     | 
    
         
             
                            throw new Error(
         
     | 
| 
       23826 
     | 
    
         
            -
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
      
 23824 
     | 
    
         
            +
                              `${relationPrintName}: not enough data provided to build the relation - "from"/"to" are not defined, and no reverse relation of table "${targetTableTsName}" with target table "${this.tableNamesMap[getTableUniqueName(relation.sourceTable)] ?? getTableUniqueName(relation.sourceTable)}" was found`
         
     | 
| 
       23827 
23825 
     | 
    
         
             
                            );
         
     | 
| 
       23828 
23826 
     | 
    
         
             
                          }
         
     | 
| 
       23829 
23827 
     | 
    
         
             
                        }
         
     | 
| 
         @@ -33536,7 +33534,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33536 
33534 
     | 
    
         
             
                    isNested,
         
     | 
| 
       33537 
33535 
     | 
    
         
             
                    errorPath,
         
     | 
| 
       33538 
33536 
     | 
    
         
             
                    depth,
         
     | 
| 
       33539 
     | 
    
         
            -
                    throughJoin
         
     | 
| 
      
 33537 
     | 
    
         
            +
                    throughJoin,
         
     | 
| 
      
 33538 
     | 
    
         
            +
                    jsonb: jsonb2
         
     | 
| 
       33540 
33539 
     | 
    
         
             
                  }) {
         
     | 
| 
       33541 
33540 
     | 
    
         
             
                    const selection = [];
         
     | 
| 
       33542 
33541 
     | 
    
         
             
                    const isSingle = mode === "first";
         
     | 
| 
         @@ -33589,7 +33588,8 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33589 
33588 
     | 
    
         
             
                            isNested: true,
         
     | 
| 
       33590 
33589 
     | 
    
         
             
                            errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
         
     | 
| 
       33591 
33590 
     | 
    
         
             
                            depth: currentDepth + 1,
         
     | 
| 
       33592 
     | 
    
         
            -
                            throughJoin: throughJoin2
         
     | 
| 
      
 33591 
     | 
    
         
            +
                            throughJoin: throughJoin2,
         
     | 
| 
      
 33592 
     | 
    
         
            +
                            jsonb: jsonb2
         
     | 
| 
       33593 
33593 
     | 
    
         
             
                          });
         
     | 
| 
       33594 
33594 
     | 
    
         
             
                          selection.push({
         
     | 
| 
       33595 
33595 
     | 
    
         
             
                            field: targetTable,
         
     | 
| 
         @@ -33600,12 +33600,12 @@ var init_dialect2 = __esm({ 
     | 
|
| 
       33600 
33600 
     | 
    
         
             
                          });
         
     | 
| 
       33601 
33601 
     | 
    
         
             
                          const jsonColumns = sql.join(
         
     | 
| 
       33602 
33602 
     | 
    
         
             
                            innerQuery.selection.map((s) => {
         
     | 
| 
       33603 
     | 
    
         
            -
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 33603 
     | 
    
         
            +
                              return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       33604 
33604 
     | 
    
         
             
                            }),
         
     | 
| 
       33605 
33605 
     | 
    
         
             
                            sql`, `
         
     | 
| 
       33606 
33606 
     | 
    
         
             
                          );
         
     | 
| 
       33607 
     | 
    
         
            -
                          const json4 = isNested ?  
     | 
| 
       33608 
     | 
    
         
            -
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}),  
     | 
| 
      
 33607 
     | 
    
         
            +
                          const json4 = isNested ? jsonb2 : sql`json`;
         
     | 
| 
      
 33608 
     | 
    
         
            +
                          const joinQuery = isSingle2 ? sql`(select ${json4}_object(${jsonColumns}) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}) as ${sql.identifier(k)}` : sql`coalesce((select ${json4}_group_array(json_object(${jsonColumns})) as ${sql.identifier("r")} from (${innerQuery.sql}) as ${sql.identifier("t")}), ${jsonb2}_array()) as ${sql.identifier(k)}`;
         
     | 
| 
       33609 
33609 
     | 
    
         
             
                          return joinQuery;
         
     | 
| 
       33610 
33610 
     | 
    
         
             
                        }),
         
     | 
| 
       33611 
33611 
     | 
    
         
             
                        sql`, `
         
     | 
| 
         @@ -35006,7 +35006,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35006 
35006 
     | 
    
         
             
                init_sql();
         
     | 
| 
       35007 
35007 
     | 
    
         
             
                _a225 = entityKind;
         
     | 
| 
       35008 
35008 
     | 
    
         
             
                RelationalQueryBuilder2 = class {
         
     | 
| 
       35009 
     | 
    
         
            -
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode) {
         
     | 
| 
      
 35009 
     | 
    
         
            +
                  constructor(mode, tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, rowMode, forbidJsonb) {
         
     | 
| 
       35010 
35010 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35011 
35011 
     | 
    
         
             
                    this.tables = tables;
         
     | 
| 
       35012 
35012 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
         @@ -35016,6 +35016,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35016 
35016 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35017 
35017 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35018 
35018 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35019 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35019 
35020 
     | 
    
         
             
                  }
         
     | 
| 
       35020 
35021 
     | 
    
         
             
                  findMany(config) {
         
     | 
| 
       35021 
35022 
     | 
    
         
             
                    return this.mode === "sync" ? new SQLiteSyncRelationalQuery2(
         
     | 
| 
         @@ -35028,7 +35029,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35028 
35029 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35029 
35030 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35030 
35031 
     | 
    
         
             
                      "many",
         
     | 
| 
       35031 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35032 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35033 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35032 
35034 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35033 
35035 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35034 
35036 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35039,7 +35041,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35039 
35041 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35040 
35042 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35041 
35043 
     | 
    
         
             
                      "many",
         
     | 
| 
       35042 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35044 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35045 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35043 
35046 
     | 
    
         
             
                    );
         
     | 
| 
       35044 
35047 
     | 
    
         
             
                  }
         
     | 
| 
       35045 
35048 
     | 
    
         
             
                  findFirst(config) {
         
     | 
| 
         @@ -35053,7 +35056,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35053 
35056 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35054 
35057 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35055 
35058 
     | 
    
         
             
                      "first",
         
     | 
| 
       35056 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35059 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35060 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35057 
35061 
     | 
    
         
             
                    ) : new SQLiteRelationalQuery2(
         
     | 
| 
       35058 
35062 
     | 
    
         
             
                      this.tables,
         
     | 
| 
       35059 
35063 
     | 
    
         
             
                      this.schema,
         
     | 
| 
         @@ -35064,13 +35068,14 @@ var init_query4 = __esm({ 
     | 
|
| 
       35064 
35068 
     | 
    
         
             
                      this.session,
         
     | 
| 
       35065 
35069 
     | 
    
         
             
                      config ?? true,
         
     | 
| 
       35066 
35070 
     | 
    
         
             
                      "first",
         
     | 
| 
       35067 
     | 
    
         
            -
                      this.rowMode
         
     | 
| 
      
 35071 
     | 
    
         
            +
                      this.rowMode,
         
     | 
| 
      
 35072 
     | 
    
         
            +
                      this.forbidJsonb
         
     | 
| 
       35068 
35073 
     | 
    
         
             
                    );
         
     | 
| 
       35069 
35074 
     | 
    
         
             
                  }
         
     | 
| 
       35070 
35075 
     | 
    
         
             
                };
         
     | 
| 
       35071 
35076 
     | 
    
         
             
                __publicField(RelationalQueryBuilder2, _a225, "SQLiteAsyncRelationalQueryBuilderV2");
         
     | 
| 
       35072 
35077 
     | 
    
         
             
                SQLiteRelationalQuery2 = class extends (_b156 = QueryPromise, _a226 = entityKind, _b156) {
         
     | 
| 
       35073 
     | 
    
         
            -
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode) {
         
     | 
| 
      
 35078 
     | 
    
         
            +
                  constructor(tables, schema5, tableNamesMap, table6, tableConfig, dialect6, session, config, mode, rowMode, forbidJsonb) {
         
     | 
| 
       35074 
35079 
     | 
    
         
             
                    super();
         
     | 
| 
       35075 
35080 
     | 
    
         
             
                    /** @internal */
         
     | 
| 
       35076 
35081 
     | 
    
         
             
                    __publicField(this, "mode");
         
     | 
| 
         @@ -35084,6 +35089,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35084 
35089 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35085 
35090 
     | 
    
         
             
                    this.config = config;
         
     | 
| 
       35086 
35091 
     | 
    
         
             
                    this.rowMode = rowMode;
         
     | 
| 
      
 35092 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35087 
35093 
     | 
    
         
             
                    this.mode = mode;
         
     | 
| 
       35088 
35094 
     | 
    
         
             
                    this.table = table6;
         
     | 
| 
       35089 
35095 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35096,7 +35102,8 @@ var init_query4 = __esm({ 
     | 
|
| 
       35096 
35102 
     | 
    
         
             
                      tableConfig: this.tableConfig,
         
     | 
| 
       35097 
35103 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35098 
35104 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35099 
     | 
    
         
            -
                      mode: this.mode
         
     | 
| 
      
 35105 
     | 
    
         
            +
                      mode: this.mode,
         
     | 
| 
      
 35106 
     | 
    
         
            +
                      jsonb: this.forbidJsonb ? sql`json` : sql`jsonb`
         
     | 
| 
       35100 
35107 
     | 
    
         
             
                    });
         
     | 
| 
       35101 
35108 
     | 
    
         
             
                    return query.sql;
         
     | 
| 
       35102 
35109 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -35120,6 +35127,7 @@ var init_query4 = __esm({ 
     | 
|
| 
       35120 
35127 
     | 
    
         
             
                    return this._prepare(false);
         
     | 
| 
       35121 
35128 
     | 
    
         
             
                  }
         
     | 
| 
       35122 
35129 
     | 
    
         
             
                  _getQuery() {
         
     | 
| 
      
 35130 
     | 
    
         
            +
                    const jsonb2 = this.forbidJsonb ? sql`json` : sql`jsonb`;
         
     | 
| 
       35123 
35131 
     | 
    
         
             
                    const query = this.dialect.buildRelationalQuery({
         
     | 
| 
       35124 
35132 
     | 
    
         
             
                      schema: this.schema,
         
     | 
| 
       35125 
35133 
     | 
    
         
             
                      tableNamesMap: this.tableNamesMap,
         
     | 
| 
         @@ -35128,12 +35136,13 @@ var init_query4 = __esm({ 
     | 
|
| 
       35128 
35136 
     | 
    
         
             
                      queryConfig: this.config,
         
     | 
| 
       35129 
35137 
     | 
    
         
             
                      tables: this.tables,
         
     | 
| 
       35130 
35138 
     | 
    
         
             
                      mode: this.mode,
         
     | 
| 
       35131 
     | 
    
         
            -
                      isNested: this.rowMode
         
     | 
| 
      
 35139 
     | 
    
         
            +
                      isNested: this.rowMode,
         
     | 
| 
      
 35140 
     | 
    
         
            +
                      jsonb: jsonb2
         
     | 
| 
       35132 
35141 
     | 
    
         
             
                    });
         
     | 
| 
       35133 
35142 
     | 
    
         
             
                    if (this.rowMode) {
         
     | 
| 
       35134 
35143 
     | 
    
         
             
                      const jsonColumns = sql.join(
         
     | 
| 
       35135 
35144 
     | 
    
         
             
                        query.selection.map((s) => {
         
     | 
| 
       35136 
     | 
    
         
            -
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql 
     | 
| 
      
 35145 
     | 
    
         
            +
                          return sql`${sql.raw(this.dialect.escapeString(s.key))}, ${s.selection ? sql`${jsonb2}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
         
     | 
| 
       35137 
35146 
     | 
    
         
             
                        }),
         
     | 
| 
       35138 
35147 
     | 
    
         
             
                        sql`, `
         
     | 
| 
       35139 
35148 
     | 
    
         
             
                      );
         
     | 
| 
         @@ -35222,7 +35231,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35222 
35231 
     | 
    
         
             
                init_raw2();
         
     | 
| 
       35223 
35232 
     | 
    
         
             
                _a229 = entityKind;
         
     | 
| 
       35224 
35233 
     | 
    
         
             
                BaseSQLiteDatabase = class {
         
     | 
| 
       35225 
     | 
    
         
            -
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB) {
         
     | 
| 
      
 35234 
     | 
    
         
            +
                  constructor(resultKind, dialect6, session, relations, _schema, rowModeRQB, forbidJsonb) {
         
     | 
| 
       35226 
35235 
     | 
    
         
             
                    /** @deprecated */
         
     | 
| 
       35227 
35236 
     | 
    
         
             
                    __publicField(this, "_query");
         
     | 
| 
       35228 
35237 
     | 
    
         
             
                    // TO-DO: Figure out how to pass DrizzleTypeError without breaking withReplicas
         
     | 
| 
         @@ -35281,6 +35290,7 @@ var init_db2 = __esm({ 
     | 
|
| 
       35281 
35290 
     | 
    
         
             
                    this.dialect = dialect6;
         
     | 
| 
       35282 
35291 
     | 
    
         
             
                    this.session = session;
         
     | 
| 
       35283 
35292 
     | 
    
         
             
                    this.rowModeRQB = rowModeRQB;
         
     | 
| 
      
 35293 
     | 
    
         
            +
                    this.forbidJsonb = forbidJsonb;
         
     | 
| 
       35284 
35294 
     | 
    
         
             
                    const rel = relations ?? {};
         
     | 
| 
       35285 
35295 
     | 
    
         
             
                    this._ = _schema ? {
         
     | 
| 
       35286 
35296 
     | 
    
         
             
                      schema: _schema.schema,
         
     | 
| 
         @@ -35321,7 +35331,8 @@ var init_db2 = __esm({ 
     | 
|
| 
       35321 
35331 
     | 
    
         
             
                          relation,
         
     | 
| 
       35322 
35332 
     | 
    
         
             
                          dialect6,
         
     | 
| 
       35323 
35333 
     | 
    
         
             
                          session,
         
     | 
| 
       35324 
     | 
    
         
            -
                          rowModeRQB
         
     | 
| 
      
 35334 
     | 
    
         
            +
                          rowModeRQB,
         
     | 
| 
      
 35335 
     | 
    
         
            +
                          forbidJsonb
         
     | 
| 
       35325 
35336 
     | 
    
         
             
                        );
         
     | 
| 
       35326 
35337 
     | 
    
         
             
                      }
         
     | 
| 
       35327 
35338 
     | 
    
         
             
                    }
         
     | 
| 
         @@ -35741,8 +35752,8 @@ var init_session2 = __esm({ 
     | 
|
| 
       35741 
35752 
     | 
    
         
             
                };
         
     | 
| 
       35742 
35753 
     | 
    
         
             
                __publicField(SQLiteSession, _a237, "SQLiteSession");
         
     | 
| 
       35743 
35754 
     | 
    
         
             
                SQLiteTransaction = class extends (_b160 = BaseSQLiteDatabase, _a238 = entityKind, _b160) {
         
     | 
| 
       35744 
     | 
    
         
            -
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB) {
         
     | 
| 
       35745 
     | 
    
         
            -
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB);
         
     | 
| 
      
 35755 
     | 
    
         
            +
                  constructor(resultType, dialect6, session, relations, schema5, nestedIndex = 0, rowModeRQB, forbidJsonb) {
         
     | 
| 
      
 35756 
     | 
    
         
            +
                    super(resultType, dialect6, session, relations, schema5, rowModeRQB, forbidJsonb);
         
     | 
| 
       35746 
35757 
     | 
    
         
             
                    this.relations = relations;
         
     | 
| 
       35747 
35758 
     | 
    
         
             
                    this.schema = schema5;
         
     | 
| 
       35748 
35759 
     | 
    
         
             
                    this.nestedIndex = nestedIndex;
         
     | 
    
        package/bin.cjs
    CHANGED
    
    | 
         @@ -92669,7 +92669,7 @@ init_utils5(); 
     | 
|
| 
       92669 
92669 
     | 
    
         
             
            var version2 = async () => {
         
     | 
| 
       92670 
92670 
     | 
    
         
             
              const { npmVersion } = await ormCoreVersions();
         
     | 
| 
       92671 
92671 
     | 
    
         
             
              const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
         
     | 
| 
       92672 
     | 
    
         
            -
              const envVersion = "1.0.0-beta.1- 
     | 
| 
      
 92672 
     | 
    
         
            +
              const envVersion = "1.0.0-beta.1-af4c434";
         
     | 
| 
       92673 
92673 
     | 
    
         
             
              const kitVersion = envVersion ? `v${envVersion}` : "--";
         
     | 
| 
       92674 
92674 
     | 
    
         
             
              const versions = `drizzle-kit: ${kitVersion}
         
     | 
| 
       92675 
92675 
     | 
    
         
             
            ${ormVersion}`;
         
     |