drizzle-kit 0.25.0-a5a41e0 → 0.25.0-b8bf113
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.d.mts +0 -474
- package/api.d.ts +0 -474
- package/api.js +15323 -95849
- package/api.mjs +15236 -95758
- package/bin.cjs +88 -1144
- package/package.json +1 -1
- package/utils.js +11 -51
- package/utils.mjs +11 -51
    
        package/bin.cjs
    CHANGED
    
    | @@ -922,8 +922,8 @@ var require_hanji = __commonJS({ | |
| 922 922 | 
             
                };
         | 
| 923 923 | 
             
                exports2.deferred = deferred;
         | 
| 924 924 | 
             
                var Terminal = class {
         | 
| 925 | 
            -
                  constructor( | 
| 926 | 
            -
                    this.view =  | 
| 925 | 
            +
                  constructor(view, stdin, stdout, closable) {
         | 
| 926 | 
            +
                    this.view = view;
         | 
| 927 927 | 
             
                    this.stdin = stdin;
         | 
| 928 928 | 
             
                    this.stdout = stdout;
         | 
| 929 929 | 
             
                    this.closable = closable;
         | 
| @@ -961,7 +961,7 @@ var require_hanji = __commonJS({ | |
| 961 961 | 
             
                        this.resolve({ status: "submitted", data: this.view.result() });
         | 
| 962 962 | 
             
                        return;
         | 
| 963 963 | 
             
                      }
         | 
| 964 | 
            -
                       | 
| 964 | 
            +
                      view.input(str, key);
         | 
| 965 965 | 
             
                    };
         | 
| 966 966 | 
             
                    this.stdin.on("keypress", keypress);
         | 
| 967 967 | 
             
                    this.view.attach(this);
         | 
| @@ -1023,8 +1023,8 @@ var require_hanji = __commonJS({ | |
| 1023 1023 | 
             
                };
         | 
| 1024 1024 | 
             
                exports2.TaskView = TaskView2;
         | 
| 1025 1025 | 
             
                var TaskTerminal = class {
         | 
| 1026 | 
            -
                  constructor( | 
| 1027 | 
            -
                    this.view =  | 
| 1026 | 
            +
                  constructor(view, stdout) {
         | 
| 1027 | 
            +
                    this.view = view;
         | 
| 1028 1028 | 
             
                    this.stdout = stdout;
         | 
| 1029 1029 | 
             
                    this.text = "";
         | 
| 1030 1030 | 
             
                    this.view.attach(this);
         | 
| @@ -1043,22 +1043,22 @@ var require_hanji = __commonJS({ | |
| 1043 1043 | 
             
                  }
         | 
| 1044 1044 | 
             
                };
         | 
| 1045 1045 | 
             
                exports2.TaskTerminal = TaskTerminal;
         | 
| 1046 | 
            -
                function render9( | 
| 1046 | 
            +
                function render9(view) {
         | 
| 1047 1047 | 
             
                  const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
         | 
| 1048 | 
            -
                  if ( | 
| 1049 | 
            -
                    const terminal = new Terminal( | 
| 1048 | 
            +
                  if (view instanceof Prompt3) {
         | 
| 1049 | 
            +
                    const terminal = new Terminal(view, stdin, stdout, closable);
         | 
| 1050 1050 | 
             
                    terminal.requestLayout();
         | 
| 1051 1051 | 
             
                    return terminal.result();
         | 
| 1052 1052 | 
             
                  }
         | 
| 1053 | 
            -
                  stdout.write(`${ | 
| 1053 | 
            +
                  stdout.write(`${view}
         | 
| 1054 1054 | 
             
            `);
         | 
| 1055 1055 | 
             
                  closable.close();
         | 
| 1056 1056 | 
             
                  return;
         | 
| 1057 1057 | 
             
                }
         | 
| 1058 1058 | 
             
                exports2.render = render9;
         | 
| 1059 | 
            -
                function renderWithTask6( | 
| 1059 | 
            +
                function renderWithTask6(view, task) {
         | 
| 1060 1060 | 
             
                  return __awaiter2(this, void 0, void 0, function* () {
         | 
| 1061 | 
            -
                    const terminal = new TaskTerminal( | 
| 1061 | 
            +
                    const terminal = new TaskTerminal(view, process.stdout);
         | 
| 1062 1062 | 
             
                    terminal.requestLayout();
         | 
| 1063 1063 | 
             
                    const result = yield task;
         | 
| 1064 1064 | 
             
                    terminal.clear();
         | 
| @@ -5706,7 +5706,7 @@ var init_vector = __esm({ | |
| 5706 5706 | 
             
            });
         | 
| 5707 5707 |  | 
| 5708 5708 | 
             
            // src/serializer/pgSchema.ts
         | 
| 5709 | 
            -
            var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2, columnSquashed, tableV32, compositePK2, uniqueConstraint2,  | 
| 5709 | 
            +
            var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
         | 
| 5710 5710 | 
             
            var init_pgSchema = __esm({
         | 
| 5711 5711 | 
             
              "src/serializer/pgSchema.ts"() {
         | 
| 5712 5712 | 
             
                "use strict";
         | 
| @@ -5901,44 +5901,6 @@ var init_pgSchema = __esm({ | |
| 5901 5901 | 
             
                  columns: stringType().array(),
         | 
| 5902 5902 | 
             
                  nullsNotDistinct: booleanType()
         | 
| 5903 5903 | 
             
                }).strict();
         | 
| 5904 | 
            -
                viewWithOption = objectType({
         | 
| 5905 | 
            -
                  checkOption: enumType(["local", "cascaded"]).optional(),
         | 
| 5906 | 
            -
                  securityBarrier: booleanType().optional(),
         | 
| 5907 | 
            -
                  securityInvoker: booleanType().optional()
         | 
| 5908 | 
            -
                }).strict();
         | 
| 5909 | 
            -
                matViewWithOption = objectType({
         | 
| 5910 | 
            -
                  fillfactor: numberType().optional(),
         | 
| 5911 | 
            -
                  toastTupleTarget: numberType().optional(),
         | 
| 5912 | 
            -
                  parallelWorkers: numberType().optional(),
         | 
| 5913 | 
            -
                  autovacuumEnabled: booleanType().optional(),
         | 
| 5914 | 
            -
                  vacuumIndexCleanup: enumType(["auto", "off", "on"]).optional(),
         | 
| 5915 | 
            -
                  vacuumTruncate: booleanType().optional(),
         | 
| 5916 | 
            -
                  autovacuumVacuumThreshold: numberType().optional(),
         | 
| 5917 | 
            -
                  autovacuumVacuumScaleFactor: numberType().optional(),
         | 
| 5918 | 
            -
                  autovacuumVacuumCostDelay: numberType().optional(),
         | 
| 5919 | 
            -
                  autovacuumVacuumCostLimit: numberType().optional(),
         | 
| 5920 | 
            -
                  autovacuumFreezeMinAge: numberType().optional(),
         | 
| 5921 | 
            -
                  autovacuumFreezeMaxAge: numberType().optional(),
         | 
| 5922 | 
            -
                  autovacuumFreezeTableAge: numberType().optional(),
         | 
| 5923 | 
            -
                  autovacuumMultixactFreezeMinAge: numberType().optional(),
         | 
| 5924 | 
            -
                  autovacuumMultixactFreezeMaxAge: numberType().optional(),
         | 
| 5925 | 
            -
                  autovacuumMultixactFreezeTableAge: numberType().optional(),
         | 
| 5926 | 
            -
                  logAutovacuumMinDuration: numberType().optional(),
         | 
| 5927 | 
            -
                  userCatalogTable: booleanType().optional()
         | 
| 5928 | 
            -
                }).strict();
         | 
| 5929 | 
            -
                mergedViewWithOption = viewWithOption.merge(matViewWithOption);
         | 
| 5930 | 
            -
                view = objectType({
         | 
| 5931 | 
            -
                  name: stringType(),
         | 
| 5932 | 
            -
                  schema: stringType(),
         | 
| 5933 | 
            -
                  columns: recordType(stringType(), column2),
         | 
| 5934 | 
            -
                  definition: stringType().optional(),
         | 
| 5935 | 
            -
                  materialized: booleanType(),
         | 
| 5936 | 
            -
                  with: mergedViewWithOption.optional(),
         | 
| 5937 | 
            -
                  isExisting: booleanType(),
         | 
| 5938 | 
            -
                  withNoData: booleanType().optional(),
         | 
| 5939 | 
            -
                  using: stringType().optional(),
         | 
| 5940 | 
            -
                  tablespace: stringType().optional()
         | 
| 5941 | 
            -
                }).strict();
         | 
| 5942 5904 | 
             
                tableV42 = objectType({
         | 
| 5943 5905 | 
             
                  name: stringType(),
         | 
| 5944 5906 | 
             
                  schema: stringType(),
         | 
| @@ -6073,7 +6035,6 @@ var init_pgSchema = __esm({ | |
| 6073 6035 | 
             
                  tables: recordType(stringType(), table2),
         | 
| 6074 6036 | 
             
                  enums: recordType(stringType(), enumSchema),
         | 
| 6075 6037 | 
             
                  schemas: recordType(stringType(), stringType()),
         | 
| 6076 | 
            -
                  views: recordType(stringType(), view).default({}),
         | 
| 6077 6038 | 
             
                  sequences: recordType(stringType(), sequenceSchema).default({}),
         | 
| 6078 6039 | 
             
                  _meta: objectType({
         | 
| 6079 6040 | 
             
                    schemas: recordType(stringType(), stringType()),
         | 
| @@ -6118,7 +6079,6 @@ var init_pgSchema = __esm({ | |
| 6118 6079 | 
             
                  tables: recordType(stringType(), tableSquashed2),
         | 
| 6119 6080 | 
             
                  enums: recordType(stringType(), enumSchema),
         | 
| 6120 6081 | 
             
                  schemas: recordType(stringType(), stringType()),
         | 
| 6121 | 
            -
                  views: recordType(stringType(), view),
         | 
| 6122 6082 | 
             
                  sequences: recordType(stringType(), sequenceSquashed)
         | 
| 6123 6083 | 
             
                }).strict();
         | 
| 6124 6084 | 
             
                pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
         | 
| @@ -6336,7 +6296,6 @@ var init_pgSchema = __esm({ | |
| 6336 6296 | 
             
                    tables: mappedTables,
         | 
| 6337 6297 | 
             
                    enums: json.enums,
         | 
| 6338 6298 | 
             
                    schemas: json.schemas,
         | 
| 6339 | 
            -
                    views: json.views,
         | 
| 6340 6299 | 
             
                    sequences: mappedSequences
         | 
| 6341 6300 | 
             
                  };
         | 
| 6342 6301 | 
             
                };
         | 
| @@ -8852,9 +8811,6 @@ var init_utils3 = __esm({ | |
| 8852 8811 | 
             
                String.prototype.concatIf = function(it, condition) {
         | 
| 8853 8812 | 
             
                  return condition ? `${this}${it}` : String(this);
         | 
| 8854 8813 | 
             
                };
         | 
| 8855 | 
            -
                String.prototype.snake_case = function() {
         | 
| 8856 | 
            -
                  return this && this.length > 0 ? `${this.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)}` : String(this);
         | 
| 8857 | 
            -
                };
         | 
| 8858 8814 | 
             
                Array.prototype.random = function() {
         | 
| 8859 8815 | 
             
                  return this[~~(Math.random() * this.length)];
         | 
| 8860 8816 | 
             
                };
         | 
| @@ -12551,11 +12507,11 @@ var require_node2 = __commonJS({ | |
| 12551 12507 | 
             
                };
         | 
| 12552 12508 | 
             
                var require_base64 = __commonJS3((exports3) => {
         | 
| 12553 12509 | 
             
                  var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
         | 
| 12554 | 
            -
                  exports3.encode = function( | 
| 12555 | 
            -
                    if (0 <=  | 
| 12556 | 
            -
                      return intToCharMap[ | 
| 12510 | 
            +
                  exports3.encode = function(number3) {
         | 
| 12511 | 
            +
                    if (0 <= number3 && number3 < intToCharMap.length) {
         | 
| 12512 | 
            +
                      return intToCharMap[number3];
         | 
| 12557 12513 | 
             
                    }
         | 
| 12558 | 
            -
                    throw new TypeError("Must be between 0 and 63: " +  | 
| 12514 | 
            +
                    throw new TypeError("Must be between 0 and 63: " + number3);
         | 
| 12559 12515 | 
             
                  };
         | 
| 12560 12516 | 
             
                  exports3.decode = function(charCode) {
         | 
| 12561 12517 | 
             
                    var bigA = 65;
         | 
| @@ -18508,8 +18464,6 @@ var init_pgImports = __esm({ | |
| 18508 18464 | 
             
                  const enums = [];
         | 
| 18509 18465 | 
             
                  const schemas = [];
         | 
| 18510 18466 | 
             
                  const sequences = [];
         | 
| 18511 | 
            -
                  const views = [];
         | 
| 18512 | 
            -
                  const matViews = [];
         | 
| 18513 18467 | 
             
                  const i0values = Object.values(exports2);
         | 
| 18514 18468 | 
             
                  i0values.forEach((t2) => {
         | 
| 18515 18469 | 
             
                    if ((0, import_pg_core.isPgEnum)(t2)) {
         | 
| @@ -18522,25 +18476,17 @@ var init_pgImports = __esm({ | |
| 18522 18476 | 
             
                    if ((0, import_drizzle_orm4.is)(t2, import_pg_core.PgSchema)) {
         | 
| 18523 18477 | 
             
                      schemas.push(t2);
         | 
| 18524 18478 | 
             
                    }
         | 
| 18525 | 
            -
                    if ((0, import_pg_core.isPgView)(t2)) {
         | 
| 18526 | 
            -
                      views.push(t2);
         | 
| 18527 | 
            -
                    }
         | 
| 18528 | 
            -
                    if ((0, import_pg_core.isPgMaterializedView)(t2)) {
         | 
| 18529 | 
            -
                      matViews.push(t2);
         | 
| 18530 | 
            -
                    }
         | 
| 18531 18479 | 
             
                    if ((0, import_pg_core.isPgSequence)(t2)) {
         | 
| 18532 18480 | 
             
                      sequences.push(t2);
         | 
| 18533 18481 | 
             
                    }
         | 
| 18534 18482 | 
             
                  });
         | 
| 18535 | 
            -
                  return { tables, enums, schemas, sequences | 
| 18483 | 
            +
                  return { tables, enums, schemas, sequences };
         | 
| 18536 18484 | 
             
                };
         | 
| 18537 18485 | 
             
                prepareFromPgImports = async (imports) => {
         | 
| 18538 | 
            -
                   | 
| 18539 | 
            -
                   | 
| 18540 | 
            -
                   | 
| 18541 | 
            -
                   | 
| 18542 | 
            -
                  const views = [];
         | 
| 18543 | 
            -
                  const matViews = [];
         | 
| 18486 | 
            +
                  let tables = [];
         | 
| 18487 | 
            +
                  let enums = [];
         | 
| 18488 | 
            +
                  let schemas = [];
         | 
| 18489 | 
            +
                  let sequences = [];
         | 
| 18544 18490 | 
             
                  const { unregister } = await safeRegister();
         | 
| 18545 18491 | 
             
                  for (let i2 = 0; i2 < imports.length; i2++) {
         | 
| 18546 18492 | 
             
                    const it = imports[i2];
         | 
| @@ -18550,11 +18496,9 @@ var init_pgImports = __esm({ | |
| 18550 18496 | 
             
                    enums.push(...prepared.enums);
         | 
| 18551 18497 | 
             
                    schemas.push(...prepared.schemas);
         | 
| 18552 18498 | 
             
                    sequences.push(...prepared.sequences);
         | 
| 18553 | 
            -
                    views.push(...prepared.views);
         | 
| 18554 | 
            -
                    matViews.push(...prepared.matViews);
         | 
| 18555 18499 | 
             
                  }
         | 
| 18556 18500 | 
             
                  unregister();
         | 
| 18557 | 
            -
                  return { tables: Array.from(new Set(tables)), enums, schemas, sequences | 
| 18501 | 
            +
                  return { tables: Array.from(new Set(tables)), enums, schemas, sequences };
         | 
| 18558 18502 | 
             
                };
         | 
| 18559 18503 | 
             
              }
         | 
| 18560 18504 | 
             
            });
         | 
| @@ -18618,10 +18562,9 @@ var init_pgSerializer = __esm({ | |
| 18618 18562 | 
             
                indexName2 = (tableName, columns) => {
         | 
| 18619 18563 | 
             
                  return `${tableName}_${columns.join("_")}_index`;
         | 
| 18620 18564 | 
             
                };
         | 
| 18621 | 
            -
                generatePgSnapshot = (tables, enums, schemas, sequences,  | 
| 18622 | 
            -
                  var _a, _b, _c, _d, _e, _f | 
| 18565 | 
            +
                generatePgSnapshot = (tables, enums, schemas, sequences, schemaFilter) => {
         | 
| 18566 | 
            +
                  var _a, _b, _c, _d, _e, _f;
         | 
| 18623 18567 | 
             
                  const result = {};
         | 
| 18624 | 
            -
                  const resultViews = {};
         | 
| 18625 18568 | 
             
                  const sequencesToReturn = {};
         | 
| 18626 18569 | 
             
                  const indexesInSchema = {};
         | 
| 18627 18570 | 
             
                  for (const table4 of tables) {
         | 
| @@ -18920,149 +18863,6 @@ ${withStyle.errorWarning( | |
| 18920 18863 | 
             
                    } else {
         | 
| 18921 18864 | 
             
                    }
         | 
| 18922 18865 | 
             
                  }
         | 
| 18923 | 
            -
                  const combinedViews = [...views, ...matViews];
         | 
| 18924 | 
            -
                  for (const view2 of combinedViews) {
         | 
| 18925 | 
            -
                    let viewName;
         | 
| 18926 | 
            -
                    let schema5;
         | 
| 18927 | 
            -
                    let query;
         | 
| 18928 | 
            -
                    let selectedFields;
         | 
| 18929 | 
            -
                    let isExisting;
         | 
| 18930 | 
            -
                    let withOption;
         | 
| 18931 | 
            -
                    let tablespace;
         | 
| 18932 | 
            -
                    let using;
         | 
| 18933 | 
            -
                    let withNoData;
         | 
| 18934 | 
            -
                    let materialized = false;
         | 
| 18935 | 
            -
                    if ((0, import_drizzle_orm5.is)(view2, import_pg_core2.PgView)) {
         | 
| 18936 | 
            -
                      ({ name: viewName, schema: schema5, query, selectedFields, isExisting, with: withOption } = (0, import_pg_core2.getViewConfig)(view2));
         | 
| 18937 | 
            -
                    } else {
         | 
| 18938 | 
            -
                      ({ name: viewName, schema: schema5, query, selectedFields, isExisting, with: withOption, tablespace, using, withNoData } = (0, import_pg_core2.getMaterializedViewConfig)(
         | 
| 18939 | 
            -
                        view2
         | 
| 18940 | 
            -
                      ));
         | 
| 18941 | 
            -
                      materialized = true;
         | 
| 18942 | 
            -
                    }
         | 
| 18943 | 
            -
                    const viewSchema = schema5 ?? "public";
         | 
| 18944 | 
            -
                    const viewKey = `${viewSchema}.${viewName}`;
         | 
| 18945 | 
            -
                    const columnsObject = {};
         | 
| 18946 | 
            -
                    const uniqueConstraintObject = {};
         | 
| 18947 | 
            -
                    const existingView = resultViews[viewKey];
         | 
| 18948 | 
            -
                    if (typeof existingView !== "undefined") {
         | 
| 18949 | 
            -
                      console.log(
         | 
| 18950 | 
            -
                        `
         | 
| 18951 | 
            -
            ${withStyle.errorWarning(
         | 
| 18952 | 
            -
                          `We've found duplicated view name across ${source_default.underline.blue(
         | 
| 18953 | 
            -
                            schema5 ?? "public"
         | 
| 18954 | 
            -
                          )} schema. Please rename your view`
         | 
| 18955 | 
            -
                        )}`
         | 
| 18956 | 
            -
                      );
         | 
| 18957 | 
            -
                      process.exit(1);
         | 
| 18958 | 
            -
                    }
         | 
| 18959 | 
            -
                    for (const key in selectedFields) {
         | 
| 18960 | 
            -
                      if ((0, import_drizzle_orm5.is)(selectedFields[key], import_pg_core2.PgColumn)) {
         | 
| 18961 | 
            -
                        const column7 = selectedFields[key];
         | 
| 18962 | 
            -
                        const notNull = column7.notNull;
         | 
| 18963 | 
            -
                        const primaryKey = column7.primary;
         | 
| 18964 | 
            -
                        const sqlTypeLowered = column7.getSQLType().toLowerCase();
         | 
| 18965 | 
            -
                        const typeSchema = (0, import_drizzle_orm5.is)(column7, import_pg_core2.PgEnumColumn) ? column7.enum.schema || "public" : void 0;
         | 
| 18966 | 
            -
                        const generated = column7.generated;
         | 
| 18967 | 
            -
                        const identity = column7.generatedIdentity;
         | 
| 18968 | 
            -
                        const increment = stringFromIdentityProperty((_g = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _g.increment) ?? "1";
         | 
| 18969 | 
            -
                        const minValue = stringFromIdentityProperty((_h = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _h.minValue) ?? (parseFloat(increment) < 0 ? minRangeForIdentityBasedOn(column7.columnType) : "1");
         | 
| 18970 | 
            -
                        const maxValue = stringFromIdentityProperty((_i = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _i.maxValue) ?? (parseFloat(increment) < 0 ? "-1" : maxRangeForIdentityBasedOn(column7.getSQLType()));
         | 
| 18971 | 
            -
                        const startWith = stringFromIdentityProperty((_j = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _j.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
         | 
| 18972 | 
            -
                        const cache = stringFromIdentityProperty((_k = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _k.cache) ?? "1";
         | 
| 18973 | 
            -
                        const columnToSet = {
         | 
| 18974 | 
            -
                          name: column7.name,
         | 
| 18975 | 
            -
                          type: column7.getSQLType(),
         | 
| 18976 | 
            -
                          typeSchema,
         | 
| 18977 | 
            -
                          primaryKey,
         | 
| 18978 | 
            -
                          notNull,
         | 
| 18979 | 
            -
                          generated: generated ? {
         | 
| 18980 | 
            -
                            as: (0, import_drizzle_orm5.is)(generated.as, import_drizzle_orm5.SQL) ? dialect5.sqlToQuery(generated.as).sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as()).sql : generated.as,
         | 
| 18981 | 
            -
                            type: "stored"
         | 
| 18982 | 
            -
                          } : void 0,
         | 
| 18983 | 
            -
                          identity: identity ? {
         | 
| 18984 | 
            -
                            type: identity.type,
         | 
| 18985 | 
            -
                            name: identity.sequenceName ?? `${viewName}_${column7.name}_seq`,
         | 
| 18986 | 
            -
                            schema: schema5 ?? "public",
         | 
| 18987 | 
            -
                            increment,
         | 
| 18988 | 
            -
                            startWith,
         | 
| 18989 | 
            -
                            minValue,
         | 
| 18990 | 
            -
                            maxValue,
         | 
| 18991 | 
            -
                            cache,
         | 
| 18992 | 
            -
                            cycle: ((_l = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _l.cycle) ?? false
         | 
| 18993 | 
            -
                          } : void 0
         | 
| 18994 | 
            -
                        };
         | 
| 18995 | 
            -
                        if (column7.isUnique) {
         | 
| 18996 | 
            -
                          const existingUnique = uniqueConstraintObject[column7.uniqueName];
         | 
| 18997 | 
            -
                          if (typeof existingUnique !== "undefined") {
         | 
| 18998 | 
            -
                            console.log(
         | 
| 18999 | 
            -
                              `
         | 
| 19000 | 
            -
            ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${source_default.underline.blue(
         | 
| 19001 | 
            -
                                viewName
         | 
| 19002 | 
            -
                              )} table. 
         | 
| 19003 | 
            -
                      The unique constraint ${source_default.underline.blue(
         | 
| 19004 | 
            -
                                column7.uniqueName
         | 
| 19005 | 
            -
                              )} on the ${source_default.underline.blue(
         | 
| 19006 | 
            -
                                column7.name
         | 
| 19007 | 
            -
                              )} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
         | 
| 19008 | 
            -
                                existingUnique.columns.join(",")
         | 
| 19009 | 
            -
                              )} columns
         | 
| 19010 | 
            -
            `)}`
         | 
| 19011 | 
            -
                            );
         | 
| 19012 | 
            -
                            process.exit(1);
         | 
| 19013 | 
            -
                          }
         | 
| 19014 | 
            -
                          uniqueConstraintObject[column7.uniqueName] = {
         | 
| 19015 | 
            -
                            name: column7.uniqueName,
         | 
| 19016 | 
            -
                            nullsNotDistinct: column7.uniqueType === "not distinct",
         | 
| 19017 | 
            -
                            columns: [columnToSet.name]
         | 
| 19018 | 
            -
                          };
         | 
| 19019 | 
            -
                        }
         | 
| 19020 | 
            -
                        if (column7.default !== void 0) {
         | 
| 19021 | 
            -
                          if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
         | 
| 19022 | 
            -
                            columnToSet.default = sqlToStr(column7.default);
         | 
| 19023 | 
            -
                          } else {
         | 
| 19024 | 
            -
                            if (typeof column7.default === "string") {
         | 
| 19025 | 
            -
                              columnToSet.default = `'${column7.default}'`;
         | 
| 19026 | 
            -
                            } else {
         | 
| 19027 | 
            -
                              if (sqlTypeLowered === "jsonb" || sqlTypeLowered === "json") {
         | 
| 19028 | 
            -
                                columnToSet.default = `'${JSON.stringify(
         | 
| 19029 | 
            -
                                  column7.default
         | 
| 19030 | 
            -
                                )}'::${sqlTypeLowered}`;
         | 
| 19031 | 
            -
                              } else if (column7.default instanceof Date) {
         | 
| 19032 | 
            -
                                if (sqlTypeLowered === "date") {
         | 
| 19033 | 
            -
                                  columnToSet.default = `'${column7.default.toISOString().split("T")[0]}'`;
         | 
| 19034 | 
            -
                                } else if (sqlTypeLowered === "timestamp") {
         | 
| 19035 | 
            -
                                  columnToSet.default = `'${column7.default.toISOString().replace("T", " ").slice(0, 23)}'`;
         | 
| 19036 | 
            -
                                } else {
         | 
| 19037 | 
            -
                                  columnToSet.default = `'${column7.default.toISOString()}'`;
         | 
| 19038 | 
            -
                                }
         | 
| 19039 | 
            -
                              } else if (isPgArrayType(sqlTypeLowered) && Array.isArray(column7.default)) {
         | 
| 19040 | 
            -
                                columnToSet.default = `'${buildArrayString(
         | 
| 19041 | 
            -
                                  column7.default,
         | 
| 19042 | 
            -
                                  sqlTypeLowered
         | 
| 19043 | 
            -
                                )}'`;
         | 
| 19044 | 
            -
                              } else {
         | 
| 19045 | 
            -
                                columnToSet.default = column7.default;
         | 
| 19046 | 
            -
                              }
         | 
| 19047 | 
            -
                            }
         | 
| 19048 | 
            -
                          }
         | 
| 19049 | 
            -
                        }
         | 
| 19050 | 
            -
                        columnsObject[column7.name] = columnToSet;
         | 
| 19051 | 
            -
                      }
         | 
| 19052 | 
            -
                    }
         | 
| 19053 | 
            -
                    resultViews[viewKey] = {
         | 
| 19054 | 
            -
                      columns: columnsObject,
         | 
| 19055 | 
            -
                      definition: isExisting ? void 0 : dialect5.sqlToQuery(query).sql,
         | 
| 19056 | 
            -
                      name: viewName,
         | 
| 19057 | 
            -
                      schema: viewSchema,
         | 
| 19058 | 
            -
                      isExisting,
         | 
| 19059 | 
            -
                      with: withOption,
         | 
| 19060 | 
            -
                      withNoData,
         | 
| 19061 | 
            -
                      materialized,
         | 
| 19062 | 
            -
                      tablespace,
         | 
| 19063 | 
            -
                      using
         | 
| 19064 | 
            -
                    };
         | 
| 19065 | 
            -
                  }
         | 
| 19066 18866 | 
             
                  const enumsToReturn = enums.reduce((map, obj) => {
         | 
| 19067 18867 | 
             
                    const enumSchema3 = obj.schema || "public";
         | 
| 19068 18868 | 
             
                    const key = `${enumSchema3}.${obj.enumName}`;
         | 
| @@ -19089,7 +18889,6 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so | |
| 19089 18889 | 
             
                    enums: enumsToReturn,
         | 
| 19090 18890 | 
             
                    schemas: schemasObject,
         | 
| 19091 18891 | 
             
                    sequences: sequencesToReturn,
         | 
| 19092 | 
            -
                    views: resultViews,
         | 
| 19093 18892 | 
             
                    _meta: {
         | 
| 19094 18893 | 
             
                      schemas: {},
         | 
| 19095 18894 | 
             
                      tables: {},
         | 
| @@ -19108,25 +18907,10 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so | |
| 19108 18907 | 
             
                };
         | 
| 19109 18908 | 
             
                fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
         | 
| 19110 18909 | 
             
                  const result = {};
         | 
| 19111 | 
            -
                  const views = {};
         | 
| 19112 18910 | 
             
                  const internals = { tables: {} };
         | 
| 19113 | 
            -
                  const where = schemaFilters.map((t2) => ` | 
| 18911 | 
            +
                  const where = schemaFilters.map((t2) => `table_schema = '${t2}'`).join(" or ");
         | 
| 19114 18912 | 
             
                  const allTables = await db.query(
         | 
| 19115 | 
            -
                    `SELECT 
         | 
| 19116 | 
            -
                n.nspname AS table_schema, 
         | 
| 19117 | 
            -
                c.relname AS table_name, 
         | 
| 19118 | 
            -
                CASE 
         | 
| 19119 | 
            -
                    WHEN c.relkind = 'r' THEN 'table'
         | 
| 19120 | 
            -
                    WHEN c.relkind = 'v' THEN 'view'
         | 
| 19121 | 
            -
                    WHEN c.relkind = 'm' THEN 'materialized_view'
         | 
| 19122 | 
            -
                END AS type
         | 
| 19123 | 
            -
            FROM 
         | 
| 19124 | 
            -
                pg_catalog.pg_class c
         | 
| 19125 | 
            -
            JOIN 
         | 
| 19126 | 
            -
                pg_catalog.pg_namespace n ON n.oid = c.relnamespace
         | 
| 19127 | 
            -
            WHERE 
         | 
| 19128 | 
            -
            	c.relkind IN ('r', 'v', 'm') 
         | 
| 19129 | 
            -
                ${where === "" ? "" : ` AND ${where}`};`
         | 
| 18913 | 
            +
                    `SELECT table_schema, table_name FROM information_schema.tables${where === "" ? "" : ` WHERE ${where}`};`
         | 
| 19130 18914 | 
             
                  );
         | 
| 19131 18915 | 
             
                  const schemas = new Set(allTables.map((it) => it.table_schema));
         | 
| 19132 18916 | 
             
                  schemas.delete("public");
         | 
| @@ -19204,7 +18988,7 @@ WHERE | |
| 19204 18988 | 
             
                    progressCallback("enums", Object.keys(enumsToReturn).length, "done");
         | 
| 19205 18989 | 
             
                  }
         | 
| 19206 18990 | 
             
                  const sequencesInColumns = [];
         | 
| 19207 | 
            -
                  const all = allTables. | 
| 18991 | 
            +
                  const all = allTables.map((row) => {
         | 
| 19208 18992 | 
             
                    return new Promise(async (res, rej) => {
         | 
| 19209 18993 | 
             
                      var _a, _b, _c, _d, _e, _f;
         | 
| 19210 18994 | 
             
                      const tableName = row.table_name;
         | 
| @@ -19613,336 +19397,6 @@ WHERE | |
| 19613 19397 | 
             
                  }
         | 
| 19614 19398 | 
             
                  for await (const _2 of all) {
         | 
| 19615 19399 | 
             
                  }
         | 
| 19616 | 
            -
                  const allViews = allTables.filter((it) => it.type === "view" || it.type === "materialized_view").map((row) => {
         | 
| 19617 | 
            -
                    return new Promise(async (res, rej) => {
         | 
| 19618 | 
            -
                      var _a, _b, _c, _d;
         | 
| 19619 | 
            -
                      const viewName = row.table_name;
         | 
| 19620 | 
            -
                      if (!tablesFilter(viewName))
         | 
| 19621 | 
            -
                        return res("");
         | 
| 19622 | 
            -
                      tableCount += 1;
         | 
| 19623 | 
            -
                      const viewSchema = row.table_schema;
         | 
| 19624 | 
            -
                      try {
         | 
| 19625 | 
            -
                        const columnToReturn = {};
         | 
| 19626 | 
            -
                        const viewResponses = await db.query(`WITH view_columns AS (
         | 
| 19627 | 
            -
                SELECT DISTINCT
         | 
| 19628 | 
            -
                    nv.nspname::information_schema.sql_identifier AS view_schema,
         | 
| 19629 | 
            -
                    v.relname::information_schema.sql_identifier AS view_name,
         | 
| 19630 | 
            -
                    nt.nspname::information_schema.sql_identifier AS table_schema,
         | 
| 19631 | 
            -
                    t.relname::information_schema.sql_identifier AS table_name,
         | 
| 19632 | 
            -
                    a.attname::information_schema.sql_identifier AS column_name
         | 
| 19633 | 
            -
                FROM pg_namespace nv
         | 
| 19634 | 
            -
                JOIN pg_class v ON nv.oid = v.relnamespace
         | 
| 19635 | 
            -
                JOIN pg_depend dv ON v.oid = dv.refobjid
         | 
| 19636 | 
            -
                JOIN pg_depend dt ON dv.objid = dt.objid
         | 
| 19637 | 
            -
                JOIN pg_class t ON dt.refobjid = t.oid
         | 
| 19638 | 
            -
                JOIN pg_namespace nt ON t.relnamespace = nt.oid
         | 
| 19639 | 
            -
                JOIN pg_attribute a ON t.oid = a.attrelid
         | 
| 19640 | 
            -
                WHERE (v.relkind = 'v'::"char" OR v.relkind = 'm'::"char")
         | 
| 19641 | 
            -
                  AND dv.refclassid = 'pg_class'::regclass::oid
         | 
| 19642 | 
            -
                  AND dv.classid = 'pg_rewrite'::regclass::oid
         | 
| 19643 | 
            -
                  AND dv.deptype = 'i'::"char"
         | 
| 19644 | 
            -
                  AND dv.objid = dt.objid
         | 
| 19645 | 
            -
                  AND dv.refobjid <> dt.refobjid
         | 
| 19646 | 
            -
                  AND dt.classid = 'pg_rewrite'::regclass::oid
         | 
| 19647 | 
            -
                  AND dt.refclassid = 'pg_class'::regclass::oid
         | 
| 19648 | 
            -
                  AND t.relkind = ANY (ARRAY['r'::"char", 'v'::"char", 'f'::"char", 'p'::"char"])
         | 
| 19649 | 
            -
                  AND dt.refobjsubid = a.attnum
         | 
| 19650 | 
            -
                  AND pg_has_role(t.relowner, 'USAGE'::text)
         | 
| 19651 | 
            -
            	  AND nv.nspname::information_schema.sql_identifier = '${viewSchema}'
         | 
| 19652 | 
            -
                  AND v.relname::information_schema.sql_identifier = '${viewName}'
         | 
| 19653 | 
            -
            ),
         | 
| 19654 | 
            -
            column_descriptions AS (
         | 
| 19655 | 
            -
                SELECT DISTINCT
         | 
| 19656 | 
            -
                    a.attrelid::regclass::text AS table_name,
         | 
| 19657 | 
            -
                    a.attname AS column_name,
         | 
| 19658 | 
            -
                    c.is_nullable,
         | 
| 19659 | 
            -
                    a.attndims AS array_dimensions,
         | 
| 19660 | 
            -
                    CASE
         | 
| 19661 | 
            -
                        WHEN a.atttypid = ANY ('{int,int8,int2}'::regtype[]) AND EXISTS (
         | 
| 19662 | 
            -
                            SELECT FROM pg_attrdef ad
         | 
| 19663 | 
            -
                            WHERE ad.adrelid = a.attrelid
         | 
| 19664 | 
            -
                            AND ad.adnum = a.attnum
         | 
| 19665 | 
            -
                            AND pg_get_expr(ad.adbin, ad.adrelid) = 'nextval(''' || pg_get_serial_sequence(a.attrelid::regclass::text, a.attname)::regclass || '''::regclass)'
         | 
| 19666 | 
            -
                        )
         | 
| 19667 | 
            -
                        THEN CASE a.atttypid
         | 
| 19668 | 
            -
                            WHEN 'int'::regtype  THEN 'serial'
         | 
| 19669 | 
            -
                            WHEN 'int8'::regtype THEN 'bigserial'
         | 
| 19670 | 
            -
                            WHEN 'int2'::regtype THEN 'smallserial'
         | 
| 19671 | 
            -
                        END
         | 
| 19672 | 
            -
                        ELSE format_type(a.atttypid, a.atttypmod)
         | 
| 19673 | 
            -
                    END AS data_type,
         | 
| 19674 | 
            -
                    pg_get_serial_sequence('"' || c.table_schema || '"."' || c.table_name || '"', a.attname)::regclass AS seq_name,
         | 
| 19675 | 
            -
                    c.column_default,
         | 
| 19676 | 
            -
                    c.data_type AS additional_dt,
         | 
| 19677 | 
            -
                    c.udt_name AS enum_name,
         | 
| 19678 | 
            -
                    c.is_generated,
         | 
| 19679 | 
            -
                    c.generation_expression,
         | 
| 19680 | 
            -
                    c.is_identity,
         | 
| 19681 | 
            -
                    c.identity_generation,
         | 
| 19682 | 
            -
                    c.identity_start,
         | 
| 19683 | 
            -
                    c.identity_increment,
         | 
| 19684 | 
            -
                    c.identity_maximum,
         | 
| 19685 | 
            -
                    c.identity_minimum,
         | 
| 19686 | 
            -
                    c.identity_cycle
         | 
| 19687 | 
            -
                FROM pg_attribute a
         | 
| 19688 | 
            -
                JOIN information_schema.columns c ON c.column_name = a.attname
         | 
| 19689 | 
            -
                JOIN pg_type t ON t.oid = a.atttypid
         | 
| 19690 | 
            -
                LEFT JOIN pg_namespace ns ON ns.oid = t.typnamespace
         | 
| 19691 | 
            -
                WHERE a.attnum > 0
         | 
| 19692 | 
            -
                AND NOT a.attisdropped
         | 
| 19693 | 
            -
            ),
         | 
| 19694 | 
            -
            table_constraints AS (
         | 
| 19695 | 
            -
                SELECT DISTINCT ON (ccu.column_name)
         | 
| 19696 | 
            -
                    ccu.column_name,
         | 
| 19697 | 
            -
                    c.data_type,
         | 
| 19698 | 
            -
                    tc.constraint_type,
         | 
| 19699 | 
            -
                    tc.constraint_name,
         | 
| 19700 | 
            -
                    tc.constraint_schema,
         | 
| 19701 | 
            -
                    tc.table_name
         | 
| 19702 | 
            -
                FROM information_schema.table_constraints tc
         | 
| 19703 | 
            -
                JOIN information_schema.constraint_column_usage ccu USING (constraint_schema, constraint_name)
         | 
| 19704 | 
            -
                JOIN information_schema.columns c ON c.table_schema = tc.constraint_schema
         | 
| 19705 | 
            -
                    AND tc.table_name = c.table_name
         | 
| 19706 | 
            -
                    AND ccu.column_name = c.column_name
         | 
| 19707 | 
            -
            ),
         | 
| 19708 | 
            -
            additional_column_info AS (
         | 
| 19709 | 
            -
                SELECT DISTINCT
         | 
| 19710 | 
            -
                    a.attrelid::regclass::text AS table_name,
         | 
| 19711 | 
            -
                    a.attname AS column_name,
         | 
| 19712 | 
            -
                    is_nullable,
         | 
| 19713 | 
            -
                    a.attndims AS array_dimensions,
         | 
| 19714 | 
            -
                    CASE
         | 
| 19715 | 
            -
                        WHEN a.atttypid = ANY ('{int,int8,int2}'::regtype[]) AND EXISTS (
         | 
| 19716 | 
            -
                            SELECT FROM pg_attrdef ad
         | 
| 19717 | 
            -
                            WHERE ad.adrelid = a.attrelid
         | 
| 19718 | 
            -
                            AND ad.adnum = a.attnum
         | 
| 19719 | 
            -
                            AND pg_get_expr(ad.adbin, ad.adrelid) = 'nextval(''' || pg_get_serial_sequence(a.attrelid::regclass::text, a.attname)::regclass || '''::regclass)'
         | 
| 19720 | 
            -
                        )
         | 
| 19721 | 
            -
                        THEN CASE a.atttypid
         | 
| 19722 | 
            -
                            WHEN 'int'::regtype  THEN 'serial'
         | 
| 19723 | 
            -
                            WHEN 'int8'::regtype THEN 'bigserial'
         | 
| 19724 | 
            -
                            WHEN 'int2'::regtype THEN 'smallserial'
         | 
| 19725 | 
            -
                        END
         | 
| 19726 | 
            -
                        ELSE format_type(a.atttypid, a.atttypmod)
         | 
| 19727 | 
            -
                    END AS data_type,
         | 
| 19728 | 
            -
                    pg_get_serial_sequence('"' || c.table_schema || '"."' || c.table_name || '"', a.attname)::regclass AS seq_name,
         | 
| 19729 | 
            -
                    c.column_default,
         | 
| 19730 | 
            -
                    c.data_type AS additional_dt,
         | 
| 19731 | 
            -
                    c.udt_name AS enum_name,
         | 
| 19732 | 
            -
                    c.is_generated,
         | 
| 19733 | 
            -
                    generation_expression,
         | 
| 19734 | 
            -
                    is_identity,
         | 
| 19735 | 
            -
                    identity_generation,
         | 
| 19736 | 
            -
                    identity_start,
         | 
| 19737 | 
            -
                    identity_increment,
         | 
| 19738 | 
            -
                    identity_maximum,
         | 
| 19739 | 
            -
                    identity_minimum,
         | 
| 19740 | 
            -
                    identity_cycle
         | 
| 19741 | 
            -
                FROM pg_attribute a
         | 
| 19742 | 
            -
                JOIN information_schema.columns c ON c.column_name = a.attname
         | 
| 19743 | 
            -
                LEFT JOIN pg_type t ON t.oid = a.atttypid
         | 
| 19744 | 
            -
                LEFT JOIN pg_namespace ns ON ns.oid = t.typnamespace
         | 
| 19745 | 
            -
                WHERE a.attnum > 0
         | 
| 19746 | 
            -
                AND NOT a.attisdropped
         | 
| 19747 | 
            -
            )
         | 
| 19748 | 
            -
            SELECT DISTINCT ON (vc.table_name, vc.column_name)
         | 
| 19749 | 
            -
                vc.view_schema,
         | 
| 19750 | 
            -
                vc.view_name,
         | 
| 19751 | 
            -
                vc.table_schema,
         | 
| 19752 | 
            -
                vc.table_name,
         | 
| 19753 | 
            -
                vc.column_name,
         | 
| 19754 | 
            -
                COALESCE(cd.data_type, aci.data_type) AS data_type,
         | 
| 19755 | 
            -
                tc.constraint_type,
         | 
| 19756 | 
            -
                tc.constraint_name,
         | 
| 19757 | 
            -
                aci.is_nullable,
         | 
| 19758 | 
            -
                aci.array_dimensions,
         | 
| 19759 | 
            -
                aci.seq_name,
         | 
| 19760 | 
            -
                aci.column_default,
         | 
| 19761 | 
            -
                aci.additional_dt,
         | 
| 19762 | 
            -
                aci.enum_name,
         | 
| 19763 | 
            -
                aci.is_generated,
         | 
| 19764 | 
            -
                aci.generation_expression,
         | 
| 19765 | 
            -
                aci.is_identity,
         | 
| 19766 | 
            -
                aci.identity_generation,
         | 
| 19767 | 
            -
                aci.identity_start,
         | 
| 19768 | 
            -
                aci.identity_increment,
         | 
| 19769 | 
            -
                aci.identity_maximum,
         | 
| 19770 | 
            -
                aci.identity_minimum,
         | 
| 19771 | 
            -
                aci.identity_cycle
         | 
| 19772 | 
            -
            FROM view_columns vc
         | 
| 19773 | 
            -
            LEFT JOIN column_descriptions cd ON vc.table_name = cd.table_name AND vc.column_name = cd.column_name
         | 
| 19774 | 
            -
            LEFT JOIN table_constraints tc ON vc.table_name = tc.table_name AND vc.column_name = tc.column_name
         | 
| 19775 | 
            -
            LEFT JOIN additional_column_info aci ON vc.table_name = aci.table_name AND vc.column_name = aci.column_name
         | 
| 19776 | 
            -
            ORDER BY vc.table_name, vc.column_name;`);
         | 
| 19777 | 
            -
                        for (const viewResponse of viewResponses) {
         | 
| 19778 | 
            -
                          const columnName = viewResponse.column_name;
         | 
| 19779 | 
            -
                          const columnAdditionalDT = viewResponse.additional_dt;
         | 
| 19780 | 
            -
                          const columnDimensions = viewResponse.array_dimensions;
         | 
| 19781 | 
            -
                          const enumType2 = viewResponse.enum_name;
         | 
| 19782 | 
            -
                          let columnType = viewResponse.data_type;
         | 
| 19783 | 
            -
                          const typeSchema = viewResponse.type_schema;
         | 
| 19784 | 
            -
                          const isGenerated = viewResponse.is_generated === "ALWAYS";
         | 
| 19785 | 
            -
                          const generationExpression = viewResponse.generation_expression;
         | 
| 19786 | 
            -
                          const isIdentity = viewResponse.is_identity === "YES";
         | 
| 19787 | 
            -
                          const identityGeneration = viewResponse.identity_generation === "ALWAYS" ? "always" : "byDefault";
         | 
| 19788 | 
            -
                          const identityStart = viewResponse.identity_start;
         | 
| 19789 | 
            -
                          const identityIncrement = viewResponse.identity_increment;
         | 
| 19790 | 
            -
                          const identityMaximum = viewResponse.identity_maximum;
         | 
| 19791 | 
            -
                          const identityMinimum = viewResponse.identity_minimum;
         | 
| 19792 | 
            -
                          const identityCycle = viewResponse.identity_cycle === "YES";
         | 
| 19793 | 
            -
                          const identityName = viewResponse.seq_name;
         | 
| 19794 | 
            -
                          const defaultValueRes = viewResponse.column_default;
         | 
| 19795 | 
            -
                          const primaryKey = viewResponse.constraint_type === "PRIMARY KEY";
         | 
| 19796 | 
            -
                          let columnTypeMapped = columnType;
         | 
| 19797 | 
            -
                          if (columnAdditionalDT === "ARRAY") {
         | 
| 19798 | 
            -
                            if (typeof internals.tables[viewName] === "undefined") {
         | 
| 19799 | 
            -
                              internals.tables[viewName] = {
         | 
| 19800 | 
            -
                                columns: {
         | 
| 19801 | 
            -
                                  [columnName]: {
         | 
| 19802 | 
            -
                                    isArray: true,
         | 
| 19803 | 
            -
                                    dimensions: columnDimensions,
         | 
| 19804 | 
            -
                                    rawType: columnTypeMapped.substring(
         | 
| 19805 | 
            -
                                      0,
         | 
| 19806 | 
            -
                                      columnTypeMapped.length - 2
         | 
| 19807 | 
            -
                                    )
         | 
| 19808 | 
            -
                                  }
         | 
| 19809 | 
            -
                                }
         | 
| 19810 | 
            -
                              };
         | 
| 19811 | 
            -
                            } else {
         | 
| 19812 | 
            -
                              if (typeof internals.tables[viewName].columns[columnName] === "undefined") {
         | 
| 19813 | 
            -
                                internals.tables[viewName].columns[columnName] = {
         | 
| 19814 | 
            -
                                  isArray: true,
         | 
| 19815 | 
            -
                                  dimensions: columnDimensions,
         | 
| 19816 | 
            -
                                  rawType: columnTypeMapped.substring(
         | 
| 19817 | 
            -
                                    0,
         | 
| 19818 | 
            -
                                    columnTypeMapped.length - 2
         | 
| 19819 | 
            -
                                  )
         | 
| 19820 | 
            -
                                };
         | 
| 19821 | 
            -
                              }
         | 
| 19822 | 
            -
                            }
         | 
| 19823 | 
            -
                          }
         | 
| 19824 | 
            -
                          const defaultValue = defaultForColumn(
         | 
| 19825 | 
            -
                            viewResponse,
         | 
| 19826 | 
            -
                            internals,
         | 
| 19827 | 
            -
                            viewName
         | 
| 19828 | 
            -
                          );
         | 
| 19829 | 
            -
                          if (defaultValue === "NULL" || defaultValueRes && defaultValueRes.startsWith("(") && defaultValueRes.endsWith(")")) {
         | 
| 19830 | 
            -
                            if (typeof internals.tables[viewName] === "undefined") {
         | 
| 19831 | 
            -
                              internals.tables[viewName] = {
         | 
| 19832 | 
            -
                                columns: {
         | 
| 19833 | 
            -
                                  [columnName]: {
         | 
| 19834 | 
            -
                                    isDefaultAnExpression: true
         | 
| 19835 | 
            -
                                  }
         | 
| 19836 | 
            -
                                }
         | 
| 19837 | 
            -
                              };
         | 
| 19838 | 
            -
                            } else {
         | 
| 19839 | 
            -
                              if (typeof internals.tables[viewName].columns[columnName] === "undefined") {
         | 
| 19840 | 
            -
                                internals.tables[viewName].columns[columnName] = {
         | 
| 19841 | 
            -
                                  isDefaultAnExpression: true
         | 
| 19842 | 
            -
                                };
         | 
| 19843 | 
            -
                              } else {
         | 
| 19844 | 
            -
                                internals.tables[viewName].columns[columnName].isDefaultAnExpression = true;
         | 
| 19845 | 
            -
                              }
         | 
| 19846 | 
            -
                            }
         | 
| 19847 | 
            -
                          }
         | 
| 19848 | 
            -
                          const isSerial = columnType === "serial";
         | 
| 19849 | 
            -
                          if (columnTypeMapped.startsWith("numeric(")) {
         | 
| 19850 | 
            -
                            columnTypeMapped = columnTypeMapped.replace(",", ", ");
         | 
| 19851 | 
            -
                          }
         | 
| 19852 | 
            -
                          if (columnAdditionalDT === "ARRAY") {
         | 
| 19853 | 
            -
                            for (let i2 = 1; i2 < Number(columnDimensions); i2++) {
         | 
| 19854 | 
            -
                              columnTypeMapped += "[]";
         | 
| 19855 | 
            -
                            }
         | 
| 19856 | 
            -
                          }
         | 
| 19857 | 
            -
                          columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char");
         | 
| 19858 | 
            -
                          columnTypeMapped = trimChar(columnTypeMapped, '"');
         | 
| 19859 | 
            -
                          columnToReturn[columnName] = {
         | 
| 19860 | 
            -
                            name: columnName,
         | 
| 19861 | 
            -
                            type: (
         | 
| 19862 | 
            -
                              // filter vectors, but in future we should filter any extension that was installed by user
         | 
| 19863 | 
            -
                              columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType2) ? enumType2 : columnTypeMapped
         | 
| 19864 | 
            -
                            ),
         | 
| 19865 | 
            -
                            typeSchema: enumsToReturn[`${typeSchema}.${enumType2}`] !== void 0 ? enumsToReturn[`${typeSchema}.${enumType2}`].schema : void 0,
         | 
| 19866 | 
            -
                            primaryKey,
         | 
| 19867 | 
            -
                            notNull: viewResponse.is_nullable === "NO",
         | 
| 19868 | 
            -
                            generated: isGenerated ? { as: generationExpression, type: "stored" } : void 0,
         | 
| 19869 | 
            -
                            identity: isIdentity ? {
         | 
| 19870 | 
            -
                              type: identityGeneration,
         | 
| 19871 | 
            -
                              name: identityName,
         | 
| 19872 | 
            -
                              increment: stringFromDatabaseIdentityProperty(identityIncrement),
         | 
| 19873 | 
            -
                              minValue: stringFromDatabaseIdentityProperty(identityMinimum),
         | 
| 19874 | 
            -
                              maxValue: stringFromDatabaseIdentityProperty(identityMaximum),
         | 
| 19875 | 
            -
                              startWith: stringFromDatabaseIdentityProperty(identityStart),
         | 
| 19876 | 
            -
                              cache: ((_a = sequencesToReturn[identityName]) == null ? void 0 : _a.cache) ? (_b = sequencesToReturn[identityName]) == null ? void 0 : _b.cache : ((_c = sequencesToReturn[`${viewSchema}.${identityName}`]) == null ? void 0 : _c.cache) ? (_d = sequencesToReturn[`${viewSchema}.${identityName}`]) == null ? void 0 : _d.cache : void 0,
         | 
| 19877 | 
            -
                              cycle: identityCycle,
         | 
| 19878 | 
            -
                              schema: viewSchema
         | 
| 19879 | 
            -
                            } : void 0
         | 
| 19880 | 
            -
                          };
         | 
| 19881 | 
            -
                          if (identityName) {
         | 
| 19882 | 
            -
                            delete sequencesToReturn[`${viewSchema}.${identityName.startsWith('"') && identityName.endsWith('"') ? identityName.slice(1, -1) : identityName}`];
         | 
| 19883 | 
            -
                            delete sequencesToReturn[identityName];
         | 
| 19884 | 
            -
                          }
         | 
| 19885 | 
            -
                          if (!isSerial && typeof defaultValue !== "undefined") {
         | 
| 19886 | 
            -
                            columnToReturn[columnName].default = defaultValue;
         | 
| 19887 | 
            -
                          }
         | 
| 19888 | 
            -
                        }
         | 
| 19889 | 
            -
                        const [viewInfo] = await db.query(`
         | 
| 19890 | 
            -
            					SELECT
         | 
| 19891 | 
            -
                c.relname AS view_name,
         | 
| 19892 | 
            -
                n.nspname AS schema_name,
         | 
| 19893 | 
            -
                pg_get_viewdef(c.oid, true) AS definition,
         | 
| 19894 | 
            -
                ts.spcname AS tablespace_name,
         | 
| 19895 | 
            -
                c.reloptions AS options,
         | 
| 19896 | 
            -
                pg_tablespace_location(ts.oid) AS location
         | 
| 19897 | 
            -
            FROM
         | 
| 19898 | 
            -
                pg_class c
         | 
| 19899 | 
            -
            JOIN
         | 
| 19900 | 
            -
                pg_namespace n ON c.relnamespace = n.oid
         | 
| 19901 | 
            -
            LEFT JOIN
         | 
| 19902 | 
            -
                pg_tablespace ts ON c.reltablespace = ts.oid 
         | 
| 19903 | 
            -
            WHERE
         | 
| 19904 | 
            -
                (c.relkind = 'm' OR c.relkind = 'v')
         | 
| 19905 | 
            -
                AND n.nspname = '${viewSchema}'
         | 
| 19906 | 
            -
                AND c.relname = '${viewName}';`);
         | 
| 19907 | 
            -
                        const resultWith = {};
         | 
| 19908 | 
            -
                        if (viewInfo.options) {
         | 
| 19909 | 
            -
                          viewInfo.options.forEach((pair) => {
         | 
| 19910 | 
            -
                            const splitted = pair.split("=");
         | 
| 19911 | 
            -
                            const key = splitted[0];
         | 
| 19912 | 
            -
                            const value = splitted[1];
         | 
| 19913 | 
            -
                            if (value === "true") {
         | 
| 19914 | 
            -
                              resultWith[key] = true;
         | 
| 19915 | 
            -
                            } else if (value === "false") {
         | 
| 19916 | 
            -
                              resultWith[key] = false;
         | 
| 19917 | 
            -
                            } else if (!isNaN(Number(value))) {
         | 
| 19918 | 
            -
                              resultWith[key] = Number(value);
         | 
| 19919 | 
            -
                            } else {
         | 
| 19920 | 
            -
                              resultWith[key] = value;
         | 
| 19921 | 
            -
                            }
         | 
| 19922 | 
            -
                          });
         | 
| 19923 | 
            -
                        }
         | 
| 19924 | 
            -
                        const definition = viewInfo.definition.replace(/\s+/g, " ").replace(";", "").trim();
         | 
| 19925 | 
            -
                        const withOption = Object.values(resultWith).length ? Object.fromEntries(Object.entries(resultWith).map(([key, value]) => [key.camelCase(), value])) : void 0;
         | 
| 19926 | 
            -
                        const materialized = row.type === "materialized_view";
         | 
| 19927 | 
            -
                        views[`${viewSchema}.${viewName}`] = {
         | 
| 19928 | 
            -
                          name: viewName,
         | 
| 19929 | 
            -
                          schema: viewSchema,
         | 
| 19930 | 
            -
                          columns: columnToReturn,
         | 
| 19931 | 
            -
                          isExisting: false,
         | 
| 19932 | 
            -
                          definition,
         | 
| 19933 | 
            -
                          materialized,
         | 
| 19934 | 
            -
                          with: withOption,
         | 
| 19935 | 
            -
                          tablespace: viewInfo.tablespace_name ?? void 0
         | 
| 19936 | 
            -
                        };
         | 
| 19937 | 
            -
                      } catch (e2) {
         | 
| 19938 | 
            -
                        rej(e2);
         | 
| 19939 | 
            -
                        return;
         | 
| 19940 | 
            -
                      }
         | 
| 19941 | 
            -
                      res("");
         | 
| 19942 | 
            -
                    });
         | 
| 19943 | 
            -
                  });
         | 
| 19944 | 
            -
                  for await (const _2 of allViews) {
         | 
| 19945 | 
            -
                  }
         | 
| 19946 19400 | 
             
                  if (progressCallback) {
         | 
| 19947 19401 | 
             
                    progressCallback("columns", columnsCount, "done");
         | 
| 19948 19402 | 
             
                    progressCallback("indexes", indexesCount, "done");
         | 
| @@ -19956,7 +19410,6 @@ WHERE | |
| 19956 19410 | 
             
                    enums: enumsToReturn,
         | 
| 19957 19411 | 
             
                    schemas: schemasObject,
         | 
| 19958 19412 | 
             
                    sequences: sequencesToReturn,
         | 
| 19959 | 
            -
                    views,
         | 
| 19960 19413 | 
             
                    _meta: {
         | 
| 19961 19414 | 
             
                      schemas: {},
         | 
| 19962 19415 | 
             
                      tables: {},
         | 
| @@ -20599,10 +20052,10 @@ ${filenames.join("\n")} | |
| 20599 20052 | 
             
                  const filenames = prepareFilenames(path5);
         | 
| 20600 20053 | 
             
                  const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
         | 
| 20601 20054 | 
             
                  const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
         | 
| 20602 | 
            -
                  const { tables, enums, schemas, sequences | 
| 20055 | 
            +
                  const { tables, enums, schemas, sequences } = await prepareFromPgImports2(
         | 
| 20603 20056 | 
             
                    filenames
         | 
| 20604 20057 | 
             
                  );
         | 
| 20605 | 
            -
                  return generatePgSnapshot2(tables, enums, schemas, sequences,  | 
| 20058 | 
            +
                  return generatePgSnapshot2(tables, enums, schemas, sequences, schemaFilter);
         | 
| 20606 20059 | 
             
                };
         | 
| 20607 20060 | 
             
                serializeSQLite = async (path5) => {
         | 
| 20608 20061 | 
             
                  const filenames = prepareFilenames(path5);
         | 
| @@ -23118,7 +22571,6 @@ function applyJsonDiff(json1, json2) { | |
| 23118 22571 | 
             
              difference.tables = difference.tables || {};
         | 
| 23119 22572 | 
             
              difference.enums = difference.enums || {};
         | 
| 23120 22573 | 
             
              difference.sequences = difference.sequences || {};
         | 
| 23121 | 
            -
              difference.views = difference.views || {};
         | 
| 23122 22574 | 
             
              const schemaKeys = Object.keys(difference.schemas);
         | 
| 23123 22575 | 
             
              for (let key of schemaKeys) {
         | 
| 23124 22576 | 
             
                if (key.endsWith("__added") || key.endsWith("__deleted")) {
         | 
| @@ -23174,71 +22626,6 @@ function applyJsonDiff(json1, json2) { | |
| 23174 22626 | 
             
              const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
         | 
| 23175 22627 | 
             
                return json2.sequences[it[0]];
         | 
| 23176 22628 | 
             
              });
         | 
| 23177 | 
            -
              const viewsEntries = Object.entries(difference.views);
         | 
| 23178 | 
            -
              const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
         | 
| 23179 | 
            -
                ([nameWithSchema, view2]) => {
         | 
| 23180 | 
            -
                  const deletedWithOption = view2.with__deleted;
         | 
| 23181 | 
            -
                  const addedWithOption = view2.with__added;
         | 
| 23182 | 
            -
                  const deletedWith = Object.fromEntries(
         | 
| 23183 | 
            -
                    Object.entries(view2.with || {}).filter((it) => it[0].endsWith("__deleted")).map(([key, value]) => {
         | 
| 23184 | 
            -
                      return [key.replace("__deleted", ""), value];
         | 
| 23185 | 
            -
                    })
         | 
| 23186 | 
            -
                  );
         | 
| 23187 | 
            -
                  const addedWith = Object.fromEntries(
         | 
| 23188 | 
            -
                    Object.entries(view2.with || {}).filter((it) => it[0].endsWith("__added")).map(([key, value]) => {
         | 
| 23189 | 
            -
                      return [key.replace("__added", ""), value];
         | 
| 23190 | 
            -
                    })
         | 
| 23191 | 
            -
                  );
         | 
| 23192 | 
            -
                  const alterWith = Object.fromEntries(
         | 
| 23193 | 
            -
                    Object.entries(view2.with || {}).filter(
         | 
| 23194 | 
            -
                      (it) => typeof it[1].__old !== "undefined" && typeof it[1].__new !== "undefined"
         | 
| 23195 | 
            -
                    ).map(
         | 
| 23196 | 
            -
                      (it) => {
         | 
| 23197 | 
            -
                        return [it[0], it[1].__new];
         | 
| 23198 | 
            -
                      }
         | 
| 23199 | 
            -
                    )
         | 
| 23200 | 
            -
                  );
         | 
| 23201 | 
            -
                  const alteredSchema = view2.schema;
         | 
| 23202 | 
            -
                  const alteredDefinition = view2.definition;
         | 
| 23203 | 
            -
                  const alteredExisting = view2.isExisting;
         | 
| 23204 | 
            -
                  const addedTablespace = view2.tablespace__added;
         | 
| 23205 | 
            -
                  const droppedTablespace = view2.tablespace__deleted;
         | 
| 23206 | 
            -
                  const alterTablespaceTo = view2.tablespace;
         | 
| 23207 | 
            -
                  let alteredTablespace;
         | 
| 23208 | 
            -
                  if (addedTablespace)
         | 
| 23209 | 
            -
                    alteredTablespace = { __new: addedTablespace, __old: "pg_default" };
         | 
| 23210 | 
            -
                  if (droppedTablespace)
         | 
| 23211 | 
            -
                    alteredTablespace = { __new: "pg_default", __old: droppedTablespace };
         | 
| 23212 | 
            -
                  if (alterTablespaceTo)
         | 
| 23213 | 
            -
                    alteredTablespace = alterTablespaceTo;
         | 
| 23214 | 
            -
                  const addedUsing = view2.using__added;
         | 
| 23215 | 
            -
                  const droppedUsing = view2.using__deleted;
         | 
| 23216 | 
            -
                  const alterUsingTo = view2.using;
         | 
| 23217 | 
            -
                  let alteredUsing;
         | 
| 23218 | 
            -
                  if (addedUsing)
         | 
| 23219 | 
            -
                    alteredUsing = { __new: addedUsing, __old: "heap" };
         | 
| 23220 | 
            -
                  if (droppedUsing)
         | 
| 23221 | 
            -
                    alteredUsing = { __new: "heap", __old: droppedUsing };
         | 
| 23222 | 
            -
                  if (alterUsingTo)
         | 
| 23223 | 
            -
                    alteredUsing = alterUsingTo;
         | 
| 23224 | 
            -
                  return {
         | 
| 23225 | 
            -
                    name: json2.views[nameWithSchema].name,
         | 
| 23226 | 
            -
                    schema: json2.views[nameWithSchema].schema,
         | 
| 23227 | 
            -
                    deletedWithOption,
         | 
| 23228 | 
            -
                    addedWithOption,
         | 
| 23229 | 
            -
                    alteredWith: {
         | 
| 23230 | 
            -
                      deletedWith: Object.keys(deletedWith).length ? deletedWith : void 0,
         | 
| 23231 | 
            -
                      addedWith: Object.keys(addedWith).length ? addedWith : void 0,
         | 
| 23232 | 
            -
                      alterWith: Object.keys(alterWith).length ? alterWith : void 0
         | 
| 23233 | 
            -
                    },
         | 
| 23234 | 
            -
                    alteredSchema,
         | 
| 23235 | 
            -
                    alteredDefinition,
         | 
| 23236 | 
            -
                    alteredExisting,
         | 
| 23237 | 
            -
                    alteredTablespace,
         | 
| 23238 | 
            -
                    alteredUsing
         | 
| 23239 | 
            -
                  };
         | 
| 23240 | 
            -
                }
         | 
| 23241 | 
            -
              );
         | 
| 23242 22629 | 
             
              const alteredTablesWithColumns = Object.values(difference.tables).map(
         | 
| 23243 22630 | 
             
                (table4) => {
         | 
| 23244 22631 | 
             
                  return findAlternationsInTable(table4);
         | 
| @@ -23247,8 +22634,7 @@ function applyJsonDiff(json1, json2) { | |
| 23247 22634 | 
             
              return {
         | 
| 23248 22635 | 
             
                alteredTablesWithColumns,
         | 
| 23249 22636 | 
             
                alteredEnums,
         | 
| 23250 | 
            -
                alteredSequences | 
| 23251 | 
            -
                alteredViews
         | 
| 22637 | 
            +
                alteredSequences
         | 
| 23252 22638 | 
             
              };
         | 
| 23253 22639 | 
             
            }
         | 
| 23254 22640 | 
             
            var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
         | 
| @@ -23643,7 +23029,7 @@ function fromJson(statements, dialect7, action, json2) { | |
| 23643 23029 | 
             
              }).filter((it) => it !== "");
         | 
| 23644 23030 | 
             
              return result;
         | 
| 23645 23031 | 
             
            }
         | 
| 23646 | 
            -
            var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor,  | 
| 23032 | 
            +
            var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
         | 
| 23647 23033 | 
             
            var init_sqlgenerator = __esm({
         | 
| 23648 23034 | 
             
              "src/sqlgenerator.ts"() {
         | 
| 23649 23035 | 
             
                "use strict";
         | 
| @@ -23859,118 +23245,6 @@ var init_sqlgenerator = __esm({ | |
| 23859 23245 | 
             
                    return statement;
         | 
| 23860 23246 | 
             
                  }
         | 
| 23861 23247 | 
             
                };
         | 
| 23862 | 
            -
                PgCreateViewConvertor = class extends Convertor {
         | 
| 23863 | 
            -
                  can(statement, dialect7) {
         | 
| 23864 | 
            -
                    return statement.type === "create_view" && dialect7 === "postgresql";
         | 
| 23865 | 
            -
                  }
         | 
| 23866 | 
            -
                  convert(st) {
         | 
| 23867 | 
            -
                    const { definition, name: viewName, schema: schema5, with: withOption, materialized, withNoData, tablespace, using } = st;
         | 
| 23868 | 
            -
                    const name = schema5 ? `"${schema5}"."${viewName}"` : `"${viewName}"`;
         | 
| 23869 | 
            -
                    let statement = materialized ? `CREATE MATERIALIZED VIEW ${name}` : `CREATE VIEW ${name}`;
         | 
| 23870 | 
            -
                    if (using)
         | 
| 23871 | 
            -
                      statement += ` USING "${using}"`;
         | 
| 23872 | 
            -
                    const options = [];
         | 
| 23873 | 
            -
                    if (withOption) {
         | 
| 23874 | 
            -
                      statement += ` WITH (`;
         | 
| 23875 | 
            -
                      Object.entries(withOption).forEach(([key, value]) => {
         | 
| 23876 | 
            -
                        if (typeof value === "undefined")
         | 
| 23877 | 
            -
                          return;
         | 
| 23878 | 
            -
                        options.push(`${key.snake_case()} = ${value}`);
         | 
| 23879 | 
            -
                      });
         | 
| 23880 | 
            -
                      statement += options.join(", ");
         | 
| 23881 | 
            -
                      statement += `)`;
         | 
| 23882 | 
            -
                    }
         | 
| 23883 | 
            -
                    if (tablespace)
         | 
| 23884 | 
            -
                      statement += ` TABLESPACE ${tablespace}`;
         | 
| 23885 | 
            -
                    statement += ` AS (${definition})`;
         | 
| 23886 | 
            -
                    if (withNoData)
         | 
| 23887 | 
            -
                      statement += ` WITH NO DATA`;
         | 
| 23888 | 
            -
                    statement += `;`;
         | 
| 23889 | 
            -
                    return statement;
         | 
| 23890 | 
            -
                  }
         | 
| 23891 | 
            -
                };
         | 
| 23892 | 
            -
                PgDropViewConvertor = class extends Convertor {
         | 
| 23893 | 
            -
                  can(statement, dialect7) {
         | 
| 23894 | 
            -
                    return statement.type === "drop_view" && dialect7 === "postgresql";
         | 
| 23895 | 
            -
                  }
         | 
| 23896 | 
            -
                  convert(st) {
         | 
| 23897 | 
            -
                    const { name: viewName, schema: schema5, materialized } = st;
         | 
| 23898 | 
            -
                    const name = schema5 ? `"${schema5}"."${viewName}"` : `"${viewName}"`;
         | 
| 23899 | 
            -
                    return `DROP${materialized ? " MATERIALIZED" : ""} VIEW ${name};`;
         | 
| 23900 | 
            -
                  }
         | 
| 23901 | 
            -
                };
         | 
| 23902 | 
            -
                PgRenameViewConvertor = class extends Convertor {
         | 
| 23903 | 
            -
                  can(statement, dialect7) {
         | 
| 23904 | 
            -
                    return statement.type === "rename_view" && dialect7 === "postgresql";
         | 
| 23905 | 
            -
                  }
         | 
| 23906 | 
            -
                  convert(st) {
         | 
| 23907 | 
            -
                    const { nameFrom: from, nameTo: to, schema: schema5, materialized } = st;
         | 
| 23908 | 
            -
                    const nameFrom = `"${schema5}"."${from}"`;
         | 
| 23909 | 
            -
                    return `ALTER${materialized ? " MATERIALIZED" : ""} VIEW ${nameFrom} RENAME TO "${to}";`;
         | 
| 23910 | 
            -
                  }
         | 
| 23911 | 
            -
                };
         | 
| 23912 | 
            -
                PgAlterViewSchemaConvertor = class extends Convertor {
         | 
| 23913 | 
            -
                  can(statement, dialect7) {
         | 
| 23914 | 
            -
                    return statement.type === "alter_view_alter_schema" && dialect7 === "postgresql";
         | 
| 23915 | 
            -
                  }
         | 
| 23916 | 
            -
                  convert(st) {
         | 
| 23917 | 
            -
                    const { fromSchema, toSchema, name, materialized } = st;
         | 
| 23918 | 
            -
                    const statement = `ALTER${materialized ? " MATERIALIZED" : ""} VIEW "${fromSchema}"."${name}" SET SCHEMA "${toSchema}";`;
         | 
| 23919 | 
            -
                    return statement;
         | 
| 23920 | 
            -
                  }
         | 
| 23921 | 
            -
                };
         | 
| 23922 | 
            -
                PgAlterViewAddWithOptionConvertor = class extends Convertor {
         | 
| 23923 | 
            -
                  can(statement, dialect7) {
         | 
| 23924 | 
            -
                    return statement.type === "alter_view_add_with_option" && dialect7 === "postgresql";
         | 
| 23925 | 
            -
                  }
         | 
| 23926 | 
            -
                  convert(st) {
         | 
| 23927 | 
            -
                    const { schema: schema5, with: withOption, name, materialized } = st;
         | 
| 23928 | 
            -
                    let statement = `ALTER${materialized ? " MATERIALIZED" : ""} VIEW "${schema5}"."${name}" SET (`;
         | 
| 23929 | 
            -
                    const options = [];
         | 
| 23930 | 
            -
                    Object.entries(withOption).forEach(([key, value]) => {
         | 
| 23931 | 
            -
                      options.push(`${key.snake_case()} = ${value}`);
         | 
| 23932 | 
            -
                    });
         | 
| 23933 | 
            -
                    statement += options.join(", ");
         | 
| 23934 | 
            -
                    statement += `);`;
         | 
| 23935 | 
            -
                    return statement;
         | 
| 23936 | 
            -
                  }
         | 
| 23937 | 
            -
                };
         | 
| 23938 | 
            -
                PgAlterViewDropWithOptionConvertor = class extends Convertor {
         | 
| 23939 | 
            -
                  can(statement, dialect7) {
         | 
| 23940 | 
            -
                    return statement.type === "alter_view_drop_with_option" && dialect7 === "postgresql";
         | 
| 23941 | 
            -
                  }
         | 
| 23942 | 
            -
                  convert(st) {
         | 
| 23943 | 
            -
                    const { schema: schema5, name, materialized, with: withOptions } = st;
         | 
| 23944 | 
            -
                    let statement = `ALTER${materialized ? " MATERIALIZED" : ""} VIEW "${schema5}"."${name}" RESET (`;
         | 
| 23945 | 
            -
                    const options = [];
         | 
| 23946 | 
            -
                    Object.entries(withOptions).forEach(([key, value]) => {
         | 
| 23947 | 
            -
                      options.push(`${key.snake_case()}`);
         | 
| 23948 | 
            -
                    });
         | 
| 23949 | 
            -
                    statement += options.join(", ");
         | 
| 23950 | 
            -
                    statement += ");";
         | 
| 23951 | 
            -
                    return statement;
         | 
| 23952 | 
            -
                  }
         | 
| 23953 | 
            -
                };
         | 
| 23954 | 
            -
                PgAlterViewAlterTablespaceConvertor = class extends Convertor {
         | 
| 23955 | 
            -
                  can(statement, dialect7) {
         | 
| 23956 | 
            -
                    return statement.type === "alter_view_alter_tablespace" && dialect7 === "postgresql";
         | 
| 23957 | 
            -
                  }
         | 
| 23958 | 
            -
                  convert(st) {
         | 
| 23959 | 
            -
                    const { schema: schema5, name, toTablespace } = st;
         | 
| 23960 | 
            -
                    const statement = `ALTER MATERIALIZED VIEW "${schema5}"."${name}" SET TABLESPACE ${toTablespace};`;
         | 
| 23961 | 
            -
                    return statement;
         | 
| 23962 | 
            -
                  }
         | 
| 23963 | 
            -
                };
         | 
| 23964 | 
            -
                PgAlterViewAlterUsingConvertor = class extends Convertor {
         | 
| 23965 | 
            -
                  can(statement, dialect7) {
         | 
| 23966 | 
            -
                    return statement.type === "alter_view_alter_using" && dialect7 === "postgresql";
         | 
| 23967 | 
            -
                  }
         | 
| 23968 | 
            -
                  convert(st) {
         | 
| 23969 | 
            -
                    const { schema: schema5, name, toUsing } = st;
         | 
| 23970 | 
            -
                    const statement = `ALTER MATERIALIZED VIEW "${schema5}"."${name}" SET ACCESS METHOD "${toUsing}";`;
         | 
| 23971 | 
            -
                    return statement;
         | 
| 23972 | 
            -
                  }
         | 
| 23973 | 
            -
                };
         | 
| 23974 23248 | 
             
                PgAlterTableAlterColumnSetGenerated = class extends Convertor {
         | 
| 23975 23249 | 
             
                  can(statement, dialect7) {
         | 
| 23976 23250 | 
             
                    return statement.type === "alter_table_alter_column_set_identity" && dialect7 === "postgresql";
         | 
| @@ -25309,14 +24583,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo | |
| 25309 24583 | 
             
                convertors.push(new SQLiteCreateTableConvertor());
         | 
| 25310 24584 | 
             
                convertors.push(new SQLiteRecreateTableConvertor());
         | 
| 25311 24585 | 
             
                convertors.push(new LibSQLRecreateTableConvertor());
         | 
| 25312 | 
            -
                convertors.push(new PgCreateViewConvertor());
         | 
| 25313 | 
            -
                convertors.push(new PgDropViewConvertor());
         | 
| 25314 | 
            -
                convertors.push(new PgRenameViewConvertor());
         | 
| 25315 | 
            -
                convertors.push(new PgAlterViewSchemaConvertor());
         | 
| 25316 | 
            -
                convertors.push(new PgAlterViewAddWithOptionConvertor());
         | 
| 25317 | 
            -
                convertors.push(new PgAlterViewDropWithOptionConvertor());
         | 
| 25318 | 
            -
                convertors.push(new PgAlterViewAlterTablespaceConvertor());
         | 
| 25319 | 
            -
                convertors.push(new PgAlterViewAlterUsingConvertor());
         | 
| 25320 24586 | 
             
                convertors.push(new CreateTypeEnumConvertor());
         | 
| 25321 24587 | 
             
                convertors.push(new CreatePgSequenceConvertor());
         | 
| 25322 24588 | 
             
                convertors.push(new DropPgSequenceConvertor());
         | 
| @@ -25651,7 +24917,7 @@ var init_sqlitePushUtils = __esm({ | |
| 25651 24917 | 
             
            });
         | 
| 25652 24918 |  | 
| 25653 24919 | 
             
            // src/jsonStatements.ts
         | 
| 25654 | 
            -
            var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql | 
| 24920 | 
            +
            var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
         | 
| 25655 24921 | 
             
            var init_jsonStatements = __esm({
         | 
| 25656 24922 | 
             
              "src/jsonStatements.ts"() {
         | 
| 25657 24923 | 
             
                "use strict";
         | 
| @@ -26990,81 +26256,6 @@ var init_jsonStatements = __esm({ | |
| 26990 26256 | 
             
                    };
         | 
| 26991 26257 | 
             
                  });
         | 
| 26992 26258 | 
             
                };
         | 
| 26993 | 
            -
                preparePgCreateViewJson = (name, schema5, definition, materialized, withNoData = false, withOption, using, tablespace) => {
         | 
| 26994 | 
            -
                  return {
         | 
| 26995 | 
            -
                    type: "create_view",
         | 
| 26996 | 
            -
                    name,
         | 
| 26997 | 
            -
                    schema: schema5,
         | 
| 26998 | 
            -
                    definition,
         | 
| 26999 | 
            -
                    with: withOption,
         | 
| 27000 | 
            -
                    materialized,
         | 
| 27001 | 
            -
                    withNoData,
         | 
| 27002 | 
            -
                    using,
         | 
| 27003 | 
            -
                    tablespace
         | 
| 27004 | 
            -
                  };
         | 
| 27005 | 
            -
                };
         | 
| 27006 | 
            -
                preparePgDropViewJson = (name, schema5, materialized) => {
         | 
| 27007 | 
            -
                  return {
         | 
| 27008 | 
            -
                    type: "drop_view",
         | 
| 27009 | 
            -
                    name,
         | 
| 27010 | 
            -
                    schema: schema5,
         | 
| 27011 | 
            -
                    materialized
         | 
| 27012 | 
            -
                  };
         | 
| 27013 | 
            -
                };
         | 
| 27014 | 
            -
                preparePgRenameViewJson = (to, from, schema5, materialized) => {
         | 
| 27015 | 
            -
                  return {
         | 
| 27016 | 
            -
                    type: "rename_view",
         | 
| 27017 | 
            -
                    nameTo: to,
         | 
| 27018 | 
            -
                    nameFrom: from,
         | 
| 27019 | 
            -
                    schema: schema5,
         | 
| 27020 | 
            -
                    materialized
         | 
| 27021 | 
            -
                  };
         | 
| 27022 | 
            -
                };
         | 
| 27023 | 
            -
                preparePgAlterViewAlterSchemaJson = (to, from, name, materialized) => {
         | 
| 27024 | 
            -
                  return {
         | 
| 27025 | 
            -
                    type: "alter_view_alter_schema",
         | 
| 27026 | 
            -
                    fromSchema: from,
         | 
| 27027 | 
            -
                    toSchema: to,
         | 
| 27028 | 
            -
                    name,
         | 
| 27029 | 
            -
                    materialized
         | 
| 27030 | 
            -
                  };
         | 
| 27031 | 
            -
                };
         | 
| 27032 | 
            -
                preparePgAlterViewAddWithOptionJson = (name, schema5, materialized, withOption) => {
         | 
| 27033 | 
            -
                  return {
         | 
| 27034 | 
            -
                    type: "alter_view_add_with_option",
         | 
| 27035 | 
            -
                    name,
         | 
| 27036 | 
            -
                    schema: schema5,
         | 
| 27037 | 
            -
                    materialized,
         | 
| 27038 | 
            -
                    with: withOption
         | 
| 27039 | 
            -
                  };
         | 
| 27040 | 
            -
                };
         | 
| 27041 | 
            -
                preparePgAlterViewDropWithOptionJson = (name, schema5, materialized, withOption) => {
         | 
| 27042 | 
            -
                  return {
         | 
| 27043 | 
            -
                    type: "alter_view_drop_with_option",
         | 
| 27044 | 
            -
                    name,
         | 
| 27045 | 
            -
                    schema: schema5,
         | 
| 27046 | 
            -
                    materialized,
         | 
| 27047 | 
            -
                    with: withOption
         | 
| 27048 | 
            -
                  };
         | 
| 27049 | 
            -
                };
         | 
| 27050 | 
            -
                preparePgAlterViewAlterTablespaceJson = (name, schema5, materialized, to) => {
         | 
| 27051 | 
            -
                  return {
         | 
| 27052 | 
            -
                    type: "alter_view_alter_tablespace",
         | 
| 27053 | 
            -
                    name,
         | 
| 27054 | 
            -
                    schema: schema5,
         | 
| 27055 | 
            -
                    materialized,
         | 
| 27056 | 
            -
                    toTablespace: to
         | 
| 27057 | 
            -
                  };
         | 
| 27058 | 
            -
                };
         | 
| 27059 | 
            -
                preparePgAlterViewAlterUsingJson = (name, schema5, materialized, to) => {
         | 
| 27060 | 
            -
                  return {
         | 
| 27061 | 
            -
                    type: "alter_view_alter_using",
         | 
| 27062 | 
            -
                    name,
         | 
| 27063 | 
            -
                    schema: schema5,
         | 
| 27064 | 
            -
                    materialized,
         | 
| 27065 | 
            -
                    toUsing: to
         | 
| 27066 | 
            -
                  };
         | 
| 27067 | 
            -
                };
         | 
| 27068 26259 | 
             
              }
         | 
| 27069 26260 | 
             
            });
         | 
| 27070 26261 |  | 
| @@ -27350,7 +26541,7 @@ var init_statementCombiner = __esm({ | |
| 27350 26541 | 
             
            });
         | 
| 27351 26542 |  | 
| 27352 26543 | 
             
            // src/snapshotsDiffer.ts
         | 
| 27353 | 
            -
            var makeChanged, makeSelfOrChanged, makePatched, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme,  | 
| 26544 | 
            +
            var makeChanged, makeSelfOrChanged, makePatched, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, diffResultSchemeMysql, diffResultSchemeSQLite, schemaChangeFor, nameChangeFor, nameSchemaChangeFor, columnChangeFor, applyPgSnapshotsDiff, applyMysqlSnapshotsDiff, applySqliteSnapshotsDiff, applyLibSQLSnapshotsDiff;
         | 
| 27354 26545 | 
             
            var init_snapshotsDiffer = __esm({
         | 
| 27355 26546 | 
             
              "src/snapshotsDiffer.ts"() {
         | 
| 27356 26547 | 
             
                "use strict";
         | 
| @@ -27498,42 +26689,10 @@ var init_snapshotsDiffer = __esm({ | |
| 27498 26689 | 
             
                    })
         | 
| 27499 26690 | 
             
                  )
         | 
| 27500 26691 | 
             
                }).strict();
         | 
| 27501 | 
            -
                alteredViewSchema = objectType({
         | 
| 27502 | 
            -
                  name: stringType(),
         | 
| 27503 | 
            -
                  schema: stringType(),
         | 
| 27504 | 
            -
                  deletedWithOption: mergedViewWithOption.optional(),
         | 
| 27505 | 
            -
                  addedWithOption: mergedViewWithOption.optional(),
         | 
| 27506 | 
            -
                  alteredWith: objectType({
         | 
| 27507 | 
            -
                    addedWith: mergedViewWithOption.optional(),
         | 
| 27508 | 
            -
                    deletedWith: mergedViewWithOption.optional(),
         | 
| 27509 | 
            -
                    alterWith: mergedViewWithOption.optional()
         | 
| 27510 | 
            -
                  }).strict(),
         | 
| 27511 | 
            -
                  alteredSchema: objectType({
         | 
| 27512 | 
            -
                    __old: stringType(),
         | 
| 27513 | 
            -
                    __new: stringType()
         | 
| 27514 | 
            -
                  }).strict().optional(),
         | 
| 27515 | 
            -
                  alteredDefinition: objectType({
         | 
| 27516 | 
            -
                    __old: stringType(),
         | 
| 27517 | 
            -
                    __new: stringType()
         | 
| 27518 | 
            -
                  }).strict().optional(),
         | 
| 27519 | 
            -
                  alteredExisting: objectType({
         | 
| 27520 | 
            -
                    __old: booleanType(),
         | 
| 27521 | 
            -
                    __new: booleanType()
         | 
| 27522 | 
            -
                  }).strict().optional(),
         | 
| 27523 | 
            -
                  alteredTablespace: objectType({
         | 
| 27524 | 
            -
                    __old: stringType(),
         | 
| 27525 | 
            -
                    __new: stringType()
         | 
| 27526 | 
            -
                  }).strict().optional(),
         | 
| 27527 | 
            -
                  alteredUsing: objectType({
         | 
| 27528 | 
            -
                    __old: stringType(),
         | 
| 27529 | 
            -
                    __new: stringType()
         | 
| 27530 | 
            -
                  }).strict().optional()
         | 
| 27531 | 
            -
                }).strict();
         | 
| 27532 26692 | 
             
                diffResultScheme = objectType({
         | 
| 27533 26693 | 
             
                  alteredTablesWithColumns: alteredTableScheme.array(),
         | 
| 27534 26694 | 
             
                  alteredEnums: changedEnumSchema.array(),
         | 
| 27535 | 
            -
                  alteredSequences: sequenceSquashed.array() | 
| 27536 | 
            -
                  alteredViews: alteredViewSchema.array()
         | 
| 26695 | 
            +
                  alteredSequences: sequenceSquashed.array()
         | 
| 27537 26696 | 
             
                }).strict();
         | 
| 27538 26697 | 
             
                diffResultSchemeMysql = objectType({
         | 
| 27539 26698 | 
             
                  alteredTablesWithColumns: alteredTableScheme.array(),
         | 
| @@ -27588,7 +26747,7 @@ var init_snapshotsDiffer = __esm({ | |
| 27588 26747 | 
             
                  }
         | 
| 27589 26748 | 
             
                  return column7;
         | 
| 27590 26749 | 
             
                };
         | 
| 27591 | 
            -
                applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2,  | 
| 26750 | 
            +
                applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
         | 
| 27592 26751 | 
             
                  const schemasDiff = diffSchemasOrTables(json1.schemas, json2.schemas);
         | 
| 27593 26752 | 
             
                  const {
         | 
| 27594 26753 | 
             
                    created: createdSchemas,
         | 
| @@ -27816,16 +26975,6 @@ var init_snapshotsDiffer = __esm({ | |
| 27816 26975 | 
             
                      return [tableKey2, tableValue];
         | 
| 27817 26976 | 
             
                    }
         | 
| 27818 26977 | 
             
                  );
         | 
| 27819 | 
            -
                  const viewsDiff = diffSchemasOrTables(json1.views, json2.views);
         | 
| 27820 | 
            -
                  const {
         | 
| 27821 | 
            -
                    created: createdViews,
         | 
| 27822 | 
            -
                    deleted: deletedViews,
         | 
| 27823 | 
            -
                    renamed: renamedViews,
         | 
| 27824 | 
            -
                    moved: movedViews
         | 
| 27825 | 
            -
                  } = await viewsResolver2({
         | 
| 27826 | 
            -
                    created: viewsDiff.added,
         | 
| 27827 | 
            -
                    deleted: viewsDiff.deleted
         | 
| 27828 | 
            -
                  });
         | 
| 27829 26978 | 
             
                  const diffResult = applyJsonDiff(columnsPatchedSnap1, json2);
         | 
| 27830 26979 | 
             
                  const typedResult = diffResultScheme.parse(diffResult);
         | 
| 27831 26980 | 
             
                  const jsonStatements = [];
         | 
| @@ -28078,137 +27227,6 @@ var init_snapshotsDiffer = __esm({ | |
| 28078 27227 | 
             
                  const createTables = createdTables.map((it) => {
         | 
| 28079 27228 | 
             
                    return preparePgCreateTableJson(it, curFull);
         | 
| 28080 27229 | 
             
                  });
         | 
| 28081 | 
            -
                  const createViews = [];
         | 
| 28082 | 
            -
                  const dropViews = [];
         | 
| 28083 | 
            -
                  const renameViews = [];
         | 
| 28084 | 
            -
                  const alterViews = [];
         | 
| 28085 | 
            -
                  createViews.push(
         | 
| 28086 | 
            -
                    ...createdViews.filter((it) => !it.isExisting).map((it) => {
         | 
| 28087 | 
            -
                      return preparePgCreateViewJson(
         | 
| 28088 | 
            -
                        it.name,
         | 
| 28089 | 
            -
                        it.schema,
         | 
| 28090 | 
            -
                        it.definition,
         | 
| 28091 | 
            -
                        it.materialized,
         | 
| 28092 | 
            -
                        it.withNoData,
         | 
| 28093 | 
            -
                        it.with,
         | 
| 28094 | 
            -
                        it.using,
         | 
| 28095 | 
            -
                        it.tablespace
         | 
| 28096 | 
            -
                      );
         | 
| 28097 | 
            -
                    })
         | 
| 28098 | 
            -
                  );
         | 
| 28099 | 
            -
                  dropViews.push(
         | 
| 28100 | 
            -
                    ...deletedViews.filter((it) => !it.isExisting).map((it) => {
         | 
| 28101 | 
            -
                      return preparePgDropViewJson(it.name, it.schema, it.materialized);
         | 
| 28102 | 
            -
                    })
         | 
| 28103 | 
            -
                  );
         | 
| 28104 | 
            -
                  renameViews.push(
         | 
| 28105 | 
            -
                    ...renamedViews.filter((it) => !it.to.isExisting).map((it) => {
         | 
| 28106 | 
            -
                      return preparePgRenameViewJson(it.to.name, it.from.name, it.to.schema, it.to.materialized);
         | 
| 28107 | 
            -
                    })
         | 
| 28108 | 
            -
                  );
         | 
| 28109 | 
            -
                  alterViews.push(
         | 
| 28110 | 
            -
                    ...movedViews.filter((it) => !json2.views[`${it.schemaTo}.${it.name}`].isExisting).map((it) => {
         | 
| 28111 | 
            -
                      return preparePgAlterViewAlterSchemaJson(
         | 
| 28112 | 
            -
                        it.schemaTo,
         | 
| 28113 | 
            -
                        it.schemaFrom,
         | 
| 28114 | 
            -
                        it.name,
         | 
| 28115 | 
            -
                        json2.views[`${it.schemaTo}.${it.name}`].materialized
         | 
| 28116 | 
            -
                      );
         | 
| 28117 | 
            -
                    })
         | 
| 28118 | 
            -
                  );
         | 
| 28119 | 
            -
                  const alteredViews = typedResult.alteredViews.filter((it) => !json2.views[`${it.schema}.${it.name}`].isExisting);
         | 
| 28120 | 
            -
                  for (const alteredView of alteredViews) {
         | 
| 28121 | 
            -
                    const viewKey = `${alteredView.schema}.${alteredView.name}`;
         | 
| 28122 | 
            -
                    const { materialized, with: withOption, definition, withNoData, using, tablespace } = json2.views[viewKey];
         | 
| 28123 | 
            -
                    if (alteredView.alteredExisting || alteredView.alteredDefinition && action !== "push") {
         | 
| 28124 | 
            -
                      dropViews.push(preparePgDropViewJson(alteredView.name, alteredView.schema, materialized));
         | 
| 28125 | 
            -
                      createViews.push(
         | 
| 28126 | 
            -
                        preparePgCreateViewJson(
         | 
| 28127 | 
            -
                          alteredView.name,
         | 
| 28128 | 
            -
                          alteredView.schema,
         | 
| 28129 | 
            -
                          definition,
         | 
| 28130 | 
            -
                          materialized,
         | 
| 28131 | 
            -
                          withNoData,
         | 
| 28132 | 
            -
                          withOption,
         | 
| 28133 | 
            -
                          using,
         | 
| 28134 | 
            -
                          tablespace
         | 
| 28135 | 
            -
                        )
         | 
| 28136 | 
            -
                      );
         | 
| 28137 | 
            -
                      continue;
         | 
| 28138 | 
            -
                    }
         | 
| 28139 | 
            -
                    if (alteredView.addedWithOption) {
         | 
| 28140 | 
            -
                      alterViews.push(
         | 
| 28141 | 
            -
                        preparePgAlterViewAddWithOptionJson(
         | 
| 28142 | 
            -
                          alteredView.name,
         | 
| 28143 | 
            -
                          alteredView.schema,
         | 
| 28144 | 
            -
                          materialized,
         | 
| 28145 | 
            -
                          alteredView.addedWithOption
         | 
| 28146 | 
            -
                        )
         | 
| 28147 | 
            -
                      );
         | 
| 28148 | 
            -
                    }
         | 
| 28149 | 
            -
                    if (alteredView.deletedWithOption) {
         | 
| 28150 | 
            -
                      alterViews.push(
         | 
| 28151 | 
            -
                        preparePgAlterViewDropWithOptionJson(
         | 
| 28152 | 
            -
                          alteredView.name,
         | 
| 28153 | 
            -
                          alteredView.schema,
         | 
| 28154 | 
            -
                          materialized,
         | 
| 28155 | 
            -
                          alteredView.deletedWithOption
         | 
| 28156 | 
            -
                        )
         | 
| 28157 | 
            -
                      );
         | 
| 28158 | 
            -
                    }
         | 
| 28159 | 
            -
                    if (alteredView.alteredWith) {
         | 
| 28160 | 
            -
                      if (alteredView.alteredWith.addedWith) {
         | 
| 28161 | 
            -
                        alterViews.push(
         | 
| 28162 | 
            -
                          preparePgAlterViewAddWithOptionJson(
         | 
| 28163 | 
            -
                            alteredView.name,
         | 
| 28164 | 
            -
                            alteredView.schema,
         | 
| 28165 | 
            -
                            materialized,
         | 
| 28166 | 
            -
                            alteredView.alteredWith.addedWith
         | 
| 28167 | 
            -
                          )
         | 
| 28168 | 
            -
                        );
         | 
| 28169 | 
            -
                      }
         | 
| 28170 | 
            -
                      if (alteredView.alteredWith.deletedWith) {
         | 
| 28171 | 
            -
                        alterViews.push(
         | 
| 28172 | 
            -
                          preparePgAlterViewDropWithOptionJson(
         | 
| 28173 | 
            -
                            alteredView.name,
         | 
| 28174 | 
            -
                            alteredView.schema,
         | 
| 28175 | 
            -
                            materialized,
         | 
| 28176 | 
            -
                            alteredView.alteredWith.deletedWith
         | 
| 28177 | 
            -
                          )
         | 
| 28178 | 
            -
                        );
         | 
| 28179 | 
            -
                      }
         | 
| 28180 | 
            -
                      if (alteredView.alteredWith.alterWith) {
         | 
| 28181 | 
            -
                        alterViews.push(
         | 
| 28182 | 
            -
                          preparePgAlterViewAddWithOptionJson(
         | 
| 28183 | 
            -
                            alteredView.name,
         | 
| 28184 | 
            -
                            alteredView.schema,
         | 
| 28185 | 
            -
                            materialized,
         | 
| 28186 | 
            -
                            alteredView.alteredWith.alterWith
         | 
| 28187 | 
            -
                          )
         | 
| 28188 | 
            -
                        );
         | 
| 28189 | 
            -
                      }
         | 
| 28190 | 
            -
                    }
         | 
| 28191 | 
            -
                    if (alteredView.alteredTablespace) {
         | 
| 28192 | 
            -
                      alterViews.push(
         | 
| 28193 | 
            -
                        preparePgAlterViewAlterTablespaceJson(
         | 
| 28194 | 
            -
                          alteredView.name,
         | 
| 28195 | 
            -
                          alteredView.schema,
         | 
| 28196 | 
            -
                          materialized,
         | 
| 28197 | 
            -
                          alteredView.alteredTablespace.__new
         | 
| 28198 | 
            -
                        )
         | 
| 28199 | 
            -
                      );
         | 
| 28200 | 
            -
                    }
         | 
| 28201 | 
            -
                    if (alteredView.alteredUsing) {
         | 
| 28202 | 
            -
                      alterViews.push(
         | 
| 28203 | 
            -
                        preparePgAlterViewAlterUsingJson(
         | 
| 28204 | 
            -
                          alteredView.name,
         | 
| 28205 | 
            -
                          alteredView.schema,
         | 
| 28206 | 
            -
                          materialized,
         | 
| 28207 | 
            -
                          alteredView.alteredUsing.__new
         | 
| 28208 | 
            -
                        )
         | 
| 28209 | 
            -
                      );
         | 
| 28210 | 
            -
                    }
         | 
| 28211 | 
            -
                  }
         | 
| 28212 27230 | 
             
                  jsonStatements.push(...createSchemas);
         | 
| 28213 27231 | 
             
                  jsonStatements.push(...renameSchemas);
         | 
| 28214 27232 | 
             
                  jsonStatements.push(...createEnums);
         | 
| @@ -28220,9 +27238,6 @@ var init_snapshotsDiffer = __esm({ | |
| 28220 27238 | 
             
                  jsonStatements.push(...renameSequences);
         | 
| 28221 27239 | 
             
                  jsonStatements.push(...jsonAlterSequences);
         | 
| 28222 27240 | 
             
                  jsonStatements.push(...createTables);
         | 
| 28223 | 
            -
                  jsonStatements.push(...dropViews);
         | 
| 28224 | 
            -
                  jsonStatements.push(...renameViews);
         | 
| 28225 | 
            -
                  jsonStatements.push(...alterViews);
         | 
| 28226 27241 | 
             
                  jsonStatements.push(...jsonDropTables);
         | 
| 28227 27242 | 
             
                  jsonStatements.push(...jsonSetTableSchemas);
         | 
| 28228 27243 | 
             
                  jsonStatements.push(...jsonRenameTables);
         | 
| @@ -28242,7 +27257,6 @@ var init_snapshotsDiffer = __esm({ | |
| 28242 27257 | 
             
                  jsonStatements.push(...jsonAlteredCompositePKs);
         | 
| 28243 27258 | 
             
                  jsonStatements.push(...jsonAddedUniqueConstraints);
         | 
| 28244 27259 | 
             
                  jsonStatements.push(...jsonAlteredUniqueConstraints);
         | 
| 28245 | 
            -
                  jsonStatements.push(...createViews);
         | 
| 28246 27260 | 
             
                  jsonStatements.push(...dropEnums);
         | 
| 28247 27261 | 
             
                  jsonStatements.push(...dropSequences);
         | 
| 28248 27262 | 
             
                  jsonStatements.push(...dropSchemas);
         | 
| @@ -30521,10 +29535,9 @@ __export(migrate_exports, { | |
| 30521 29535 | 
             
              schemasResolver: () => schemasResolver,
         | 
| 30522 29536 | 
             
              sequencesResolver: () => sequencesResolver,
         | 
| 30523 29537 | 
             
              tablesResolver: () => tablesResolver,
         | 
| 30524 | 
            -
              viewsResolver: () => viewsResolver,
         | 
| 30525 29538 | 
             
              writeResult: () => writeResult
         | 
| 30526 29539 | 
             
            });
         | 
| 30527 | 
            -
            var import_fs5, import_hanji3, import_path4, schemasResolver, tablesResolver,  | 
| 29540 | 
            +
            var import_fs5, import_hanji3, import_path4, schemasResolver, tablesResolver, sequencesResolver, enumsResolver, columnsResolver, prepareAndMigratePg, preparePgPush, prepareMySQLPush, prepareAndMigrateMysql, prepareAndMigrateSqlite, prepareAndMigrateLibSQL, prepareSQLitePush, prepareLibSQLPush, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
         | 
| 30528 29541 | 
             
            var init_migrate = __esm({
         | 
| 30529 29542 | 
             
              "src/cli/commands/migrate.ts"() {
         | 
| 30530 29543 | 
             
                "use strict";
         | 
| @@ -30571,24 +29584,6 @@ var init_migrate = __esm({ | |
| 30571 29584 | 
             
                    throw e2;
         | 
| 30572 29585 | 
             
                  }
         | 
| 30573 29586 | 
             
                };
         | 
| 30574 | 
            -
                viewsResolver = async (input) => {
         | 
| 30575 | 
            -
                  try {
         | 
| 30576 | 
            -
                    const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
         | 
| 30577 | 
            -
                      input.created,
         | 
| 30578 | 
            -
                      input.deleted,
         | 
| 30579 | 
            -
                      "view"
         | 
| 30580 | 
            -
                    );
         | 
| 30581 | 
            -
                    return {
         | 
| 30582 | 
            -
                      created,
         | 
| 30583 | 
            -
                      deleted,
         | 
| 30584 | 
            -
                      moved,
         | 
| 30585 | 
            -
                      renamed
         | 
| 30586 | 
            -
                    };
         | 
| 30587 | 
            -
                  } catch (e2) {
         | 
| 30588 | 
            -
                    console.error(e2);
         | 
| 30589 | 
            -
                    throw e2;
         | 
| 30590 | 
            -
                  }
         | 
| 30591 | 
            -
                };
         | 
| 30592 29587 | 
             
                sequencesResolver = async (input) => {
         | 
| 30593 29588 | 
             
                  try {
         | 
| 30594 29589 | 
             
                    const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
         | 
| @@ -30677,7 +29672,6 @@ var init_migrate = __esm({ | |
| 30677 29672 | 
             
                      sequencesResolver,
         | 
| 30678 29673 | 
             
                      tablesResolver,
         | 
| 30679 29674 | 
             
                      columnsResolver,
         | 
| 30680 | 
            -
                      viewsResolver,
         | 
| 30681 29675 | 
             
                      validatedPrev,
         | 
| 30682 29676 | 
             
                      validatedCur
         | 
| 30683 29677 | 
             
                    );
         | 
| @@ -30712,7 +29706,6 @@ var init_migrate = __esm({ | |
| 30712 29706 | 
             
                    sequencesResolver,
         | 
| 30713 29707 | 
             
                    tablesResolver,
         | 
| 30714 29708 | 
             
                    columnsResolver,
         | 
| 30715 | 
            -
                    viewsResolver,
         | 
| 30716 29709 | 
             
                    validatedPrev,
         | 
| 30717 29710 | 
             
                    validatedCur,
         | 
| 30718 29711 | 
             
                    "push"
         | 
| @@ -35534,20 +34527,20 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 35534 34527 | 
             
                        ;
         | 
| 35535 34528 | 
             
                      ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
         | 
| 35536 34529 | 
             
                    }
         | 
| 35537 | 
            -
                    respondWithNewView( | 
| 34530 | 
            +
                    respondWithNewView(view) {
         | 
| 35538 34531 | 
             
                      if (!IsReadableStreamBYOBRequest(this)) {
         | 
| 35539 34532 | 
             
                        throw byobRequestBrandCheckException("respondWithNewView");
         | 
| 35540 34533 | 
             
                      }
         | 
| 35541 | 
            -
                      assertRequiredArgument( | 
| 35542 | 
            -
                      if (!ArrayBuffer.isView( | 
| 34534 | 
            +
                      assertRequiredArgument(view, 1, "respondWithNewView");
         | 
| 34535 | 
            +
                      if (!ArrayBuffer.isView(view)) {
         | 
| 35543 34536 | 
             
                        throw new TypeError("You can only respond with array buffer views");
         | 
| 35544 34537 | 
             
                      }
         | 
| 35545 34538 | 
             
                      if (this._associatedReadableByteStreamController === void 0) {
         | 
| 35546 34539 | 
             
                        throw new TypeError("This BYOB request has been invalidated");
         | 
| 35547 34540 | 
             
                      }
         | 
| 35548 | 
            -
                      if (IsDetachedBuffer( | 
| 34541 | 
            +
                      if (IsDetachedBuffer(view.buffer))
         | 
| 35549 34542 | 
             
                        ;
         | 
| 35550 | 
            -
                      ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,  | 
| 34543 | 
            +
                      ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
         | 
| 35551 34544 | 
             
                    }
         | 
| 35552 34545 | 
             
                  }
         | 
| 35553 34546 | 
             
                  Object.defineProperties(ReadableStreamBYOBRequest.prototype, {
         | 
| @@ -35648,8 +34641,8 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 35648 34641 | 
             
                        const entry = this._queue.shift();
         | 
| 35649 34642 | 
             
                        this._queueTotalSize -= entry.byteLength;
         | 
| 35650 34643 | 
             
                        ReadableByteStreamControllerHandleQueueDrain(this);
         | 
| 35651 | 
            -
                        const  | 
| 35652 | 
            -
                        readRequest._chunkSteps( | 
| 34644 | 
            +
                        const view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
         | 
| 34645 | 
            +
                        readRequest._chunkSteps(view);
         | 
| 35653 34646 | 
             
                        return;
         | 
| 35654 34647 | 
             
                      }
         | 
| 35655 34648 | 
             
                      const autoAllocateChunkSize = this._autoAllocateChunkSize;
         | 
| @@ -35815,19 +34808,19 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 35815 34808 | 
             
                      }
         | 
| 35816 34809 | 
             
                    }
         | 
| 35817 34810 | 
             
                  }
         | 
| 35818 | 
            -
                  function ReadableByteStreamControllerPullInto(controller,  | 
| 34811 | 
            +
                  function ReadableByteStreamControllerPullInto(controller, view, readIntoRequest) {
         | 
| 35819 34812 | 
             
                    const stream = controller._controlledReadableByteStream;
         | 
| 35820 34813 | 
             
                    let elementSize = 1;
         | 
| 35821 | 
            -
                    if ( | 
| 35822 | 
            -
                      elementSize =  | 
| 34814 | 
            +
                    if (view.constructor !== DataView) {
         | 
| 34815 | 
            +
                      elementSize = view.constructor.BYTES_PER_ELEMENT;
         | 
| 35823 34816 | 
             
                    }
         | 
| 35824 | 
            -
                    const ctor =  | 
| 35825 | 
            -
                    const buffer = TransferArrayBuffer( | 
| 34817 | 
            +
                    const ctor = view.constructor;
         | 
| 34818 | 
            +
                    const buffer = TransferArrayBuffer(view.buffer);
         | 
| 35826 34819 | 
             
                    const pullIntoDescriptor = {
         | 
| 35827 34820 | 
             
                      buffer,
         | 
| 35828 34821 | 
             
                      bufferByteLength: buffer.byteLength,
         | 
| 35829 | 
            -
                      byteOffset:  | 
| 35830 | 
            -
                      byteLength:  | 
| 34822 | 
            +
                      byteOffset: view.byteOffset,
         | 
| 34823 | 
            +
                      byteLength: view.byteLength,
         | 
| 35831 34824 | 
             
                      bytesFilled: 0,
         | 
| 35832 34825 | 
             
                      elementSize,
         | 
| 35833 34826 | 
             
                      viewConstructor: ctor,
         | 
| @@ -35995,9 +34988,9 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 35995 34988 | 
             
                  function ReadableByteStreamControllerGetBYOBRequest(controller) {
         | 
| 35996 34989 | 
             
                    if (controller._byobRequest === null && controller._pendingPullIntos.length > 0) {
         | 
| 35997 34990 | 
             
                      const firstDescriptor = controller._pendingPullIntos.peek();
         | 
| 35998 | 
            -
                      const  | 
| 34991 | 
            +
                      const view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
         | 
| 35999 34992 | 
             
                      const byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
         | 
| 36000 | 
            -
                      SetUpReadableStreamBYOBRequest(byobRequest, controller,  | 
| 34993 | 
            +
                      SetUpReadableStreamBYOBRequest(byobRequest, controller, view);
         | 
| 36001 34994 | 
             
                      controller._byobRequest = byobRequest;
         | 
| 36002 34995 | 
             
                    }
         | 
| 36003 34996 | 
             
                    return controller._byobRequest;
         | 
| @@ -36030,29 +35023,29 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 36030 35023 | 
             
                    firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
         | 
| 36031 35024 | 
             
                    ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
         | 
| 36032 35025 | 
             
                  }
         | 
| 36033 | 
            -
                  function ReadableByteStreamControllerRespondWithNewView(controller,  | 
| 35026 | 
            +
                  function ReadableByteStreamControllerRespondWithNewView(controller, view) {
         | 
| 36034 35027 | 
             
                    const firstDescriptor = controller._pendingPullIntos.peek();
         | 
| 36035 35028 | 
             
                    const state = controller._controlledReadableByteStream._state;
         | 
| 36036 35029 | 
             
                    if (state === "closed") {
         | 
| 36037 | 
            -
                      if ( | 
| 35030 | 
            +
                      if (view.byteLength !== 0) {
         | 
| 36038 35031 | 
             
                        throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream");
         | 
| 36039 35032 | 
             
                      }
         | 
| 36040 35033 | 
             
                    } else {
         | 
| 36041 | 
            -
                      if ( | 
| 35034 | 
            +
                      if (view.byteLength === 0) {
         | 
| 36042 35035 | 
             
                        throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");
         | 
| 36043 35036 | 
             
                      }
         | 
| 36044 35037 | 
             
                    }
         | 
| 36045 | 
            -
                    if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !==  | 
| 35038 | 
            +
                    if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
         | 
| 36046 35039 | 
             
                      throw new RangeError("The region specified by view does not match byobRequest");
         | 
| 36047 35040 | 
             
                    }
         | 
| 36048 | 
            -
                    if (firstDescriptor.bufferByteLength !==  | 
| 35041 | 
            +
                    if (firstDescriptor.bufferByteLength !== view.buffer.byteLength) {
         | 
| 36049 35042 | 
             
                      throw new RangeError("The buffer of view has different capacity than byobRequest");
         | 
| 36050 35043 | 
             
                    }
         | 
| 36051 | 
            -
                    if (firstDescriptor.bytesFilled +  | 
| 35044 | 
            +
                    if (firstDescriptor.bytesFilled + view.byteLength > firstDescriptor.byteLength) {
         | 
| 36052 35045 | 
             
                      throw new RangeError("The region specified by view is larger than byobRequest");
         | 
| 36053 35046 | 
             
                    }
         | 
| 36054 | 
            -
                    const viewByteLength =  | 
| 36055 | 
            -
                    firstDescriptor.buffer = TransferArrayBuffer( | 
| 35047 | 
            +
                    const viewByteLength = view.byteLength;
         | 
| 35048 | 
            +
                    firstDescriptor.buffer = TransferArrayBuffer(view.buffer);
         | 
| 36056 35049 | 
             
                    ReadableByteStreamControllerRespondInternal(controller, viewByteLength);
         | 
| 36057 35050 | 
             
                  }
         | 
| 36058 35051 | 
             
                  function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
         | 
| @@ -36098,9 +35091,9 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 36098 35091 | 
             
                    }
         | 
| 36099 35092 | 
             
                    SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize);
         | 
| 36100 35093 | 
             
                  }
         | 
| 36101 | 
            -
                  function SetUpReadableStreamBYOBRequest(request, controller,  | 
| 35094 | 
            +
                  function SetUpReadableStreamBYOBRequest(request, controller, view) {
         | 
| 36102 35095 | 
             
                    request._associatedReadableByteStreamController = controller;
         | 
| 36103 | 
            -
                    request._view =  | 
| 35096 | 
            +
                    request._view = view;
         | 
| 36104 35097 | 
             
                  }
         | 
| 36105 35098 | 
             
                  function byobRequestBrandCheckException(name) {
         | 
| 36106 35099 | 
             
                    return new TypeError(`ReadableStreamBYOBRequest.prototype.${name} can only be used on a ReadableStreamBYOBRequest`);
         | 
| @@ -36176,20 +35169,20 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 36176 35169 | 
             
                     *
         | 
| 36177 35170 | 
             
                     * If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.
         | 
| 36178 35171 | 
             
                     */
         | 
| 36179 | 
            -
                    read( | 
| 35172 | 
            +
                    read(view) {
         | 
| 36180 35173 | 
             
                      if (!IsReadableStreamBYOBReader(this)) {
         | 
| 36181 35174 | 
             
                        return promiseRejectedWith(byobReaderBrandCheckException("read"));
         | 
| 36182 35175 | 
             
                      }
         | 
| 36183 | 
            -
                      if (!ArrayBuffer.isView( | 
| 35176 | 
            +
                      if (!ArrayBuffer.isView(view)) {
         | 
| 36184 35177 | 
             
                        return promiseRejectedWith(new TypeError("view must be an array buffer view"));
         | 
| 36185 35178 | 
             
                      }
         | 
| 36186 | 
            -
                      if ( | 
| 35179 | 
            +
                      if (view.byteLength === 0) {
         | 
| 36187 35180 | 
             
                        return promiseRejectedWith(new TypeError("view must have non-zero byteLength"));
         | 
| 36188 35181 | 
             
                      }
         | 
| 36189 | 
            -
                      if ( | 
| 35182 | 
            +
                      if (view.buffer.byteLength === 0) {
         | 
| 36190 35183 | 
             
                        return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`));
         | 
| 36191 35184 | 
             
                      }
         | 
| 36192 | 
            -
                      if (IsDetachedBuffer( | 
| 35185 | 
            +
                      if (IsDetachedBuffer(view.buffer))
         | 
| 36193 35186 | 
             
                        ;
         | 
| 36194 35187 | 
             
                      if (this._ownerReadableStream === void 0) {
         | 
| 36195 35188 | 
             
                        return promiseRejectedWith(readerLockException("read from"));
         | 
| @@ -36205,7 +35198,7 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 36205 35198 | 
             
                        _closeSteps: (chunk) => resolvePromise({ value: chunk, done: true }),
         | 
| 36206 35199 | 
             
                        _errorSteps: (e2) => rejectPromise(e2)
         | 
| 36207 35200 | 
             
                      };
         | 
| 36208 | 
            -
                      ReadableStreamBYOBReaderRead(this,  | 
| 35201 | 
            +
                      ReadableStreamBYOBReaderRead(this, view, readIntoRequest);
         | 
| 36209 35202 | 
             
                      return promise;
         | 
| 36210 35203 | 
             
                    }
         | 
| 36211 35204 | 
             
                    /**
         | 
| @@ -36251,13 +35244,13 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 36251 35244 | 
             
                    }
         | 
| 36252 35245 | 
             
                    return x2 instanceof ReadableStreamBYOBReader;
         | 
| 36253 35246 | 
             
                  }
         | 
| 36254 | 
            -
                  function ReadableStreamBYOBReaderRead(reader,  | 
| 35247 | 
            +
                  function ReadableStreamBYOBReaderRead(reader, view, readIntoRequest) {
         | 
| 36255 35248 | 
             
                    const stream = reader._ownerReadableStream;
         | 
| 36256 35249 | 
             
                    stream._disturbed = true;
         | 
| 36257 35250 | 
             
                    if (stream._state === "errored") {
         | 
| 36258 35251 | 
             
                      readIntoRequest._errorSteps(stream._storedError);
         | 
| 36259 35252 | 
             
                    } else {
         | 
| 36260 | 
            -
                      ReadableByteStreamControllerPullInto(stream._readableStreamController,  | 
| 35253 | 
            +
                      ReadableByteStreamControllerPullInto(stream._readableStreamController, view, readIntoRequest);
         | 
| 36261 35254 | 
             
                    }
         | 
| 36262 35255 | 
             
                  }
         | 
| 36263 35256 | 
             
                  function byobReaderBrandCheckException(name) {
         | 
| @@ -37806,7 +36799,7 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 37806 36799 | 
             
                      };
         | 
| 37807 36800 | 
             
                      ReadableStreamDefaultReaderRead(reader, readRequest);
         | 
| 37808 36801 | 
             
                    }
         | 
| 37809 | 
            -
                    function pullWithBYOBReader( | 
| 36802 | 
            +
                    function pullWithBYOBReader(view, forBranch2) {
         | 
| 37810 36803 | 
             
                      if (IsReadableStreamDefaultReader(reader)) {
         | 
| 37811 36804 | 
             
                        ReadableStreamReaderGenericRelease(reader);
         | 
| 37812 36805 | 
             
                        reader = AcquireReadableStreamBYOBReader(stream);
         | 
| @@ -37872,7 +36865,7 @@ var require_ponyfill_es2018 = __commonJS({ | |
| 37872 36865 | 
             
                          reading = false;
         | 
| 37873 36866 | 
             
                        }
         | 
| 37874 36867 | 
             
                      };
         | 
| 37875 | 
            -
                      ReadableStreamBYOBReaderRead(reader,  | 
| 36868 | 
            +
                      ReadableStreamBYOBReaderRead(reader, view, readIntoRequest);
         | 
| 37876 36869 | 
             
                    }
         | 
| 37877 36870 | 
             
                    function pull1Algorithm() {
         | 
| 37878 36871 | 
             
                      if (reading) {
         | 
| @@ -52731,15 +51724,15 @@ var require_dist_cjs36 = __commonJS({ | |
| 52731 51724 | 
             
                      throw new Error("Int64 buffers must be exactly 8 bytes");
         | 
| 52732 51725 | 
             
                    }
         | 
| 52733 51726 | 
             
                  }
         | 
| 52734 | 
            -
                  static fromNumber( | 
| 52735 | 
            -
                    if ( | 
| 52736 | 
            -
                      throw new Error(`${ | 
| 51727 | 
            +
                  static fromNumber(number3) {
         | 
| 51728 | 
            +
                    if (number3 > 9223372036854776e3 || number3 < -9223372036854776e3) {
         | 
| 51729 | 
            +
                      throw new Error(`${number3} is too large (or, if negative, too small) to represent as an Int64`);
         | 
| 52737 51730 | 
             
                    }
         | 
| 52738 51731 | 
             
                    const bytes = new Uint8Array(8);
         | 
| 52739 | 
            -
                    for (let i2 = 7, remaining = Math.abs(Math.round( | 
| 51732 | 
            +
                    for (let i2 = 7, remaining = Math.abs(Math.round(number3)); i2 > -1 && remaining > 0; i2--, remaining /= 256) {
         | 
| 52740 51733 | 
             
                      bytes[i2] = remaining;
         | 
| 52741 51734 | 
             
                    }
         | 
| 52742 | 
            -
                    if ( | 
| 51735 | 
            +
                    if (number3 < 0) {
         | 
| 52743 51736 | 
             
                      negate(bytes);
         | 
| 52744 51737 | 
             
                    }
         | 
| 52745 51738 | 
             
                    return new _Int642(bytes);
         | 
| @@ -64170,16 +63163,16 @@ var require_map_stream = __commonJS({ | |
| 64170 63163 | 
             
                  var writeQueue = {};
         | 
| 64171 63164 | 
             
                  stream.writable = true;
         | 
| 64172 63165 | 
             
                  stream.readable = true;
         | 
| 64173 | 
            -
                  function queueData(data,  | 
| 63166 | 
            +
                  function queueData(data, number3) {
         | 
| 64174 63167 | 
             
                    var nextToWrite = lastWritten + 1;
         | 
| 64175 | 
            -
                    if ( | 
| 63168 | 
            +
                    if (number3 === nextToWrite) {
         | 
| 64176 63169 | 
             
                      if (data !== void 0) {
         | 
| 64177 63170 | 
             
                        stream.emit.apply(stream, ["data", data]);
         | 
| 64178 63171 | 
             
                      }
         | 
| 64179 63172 | 
             
                      lastWritten++;
         | 
| 64180 63173 | 
             
                      nextToWrite++;
         | 
| 64181 63174 | 
             
                    } else {
         | 
| 64182 | 
            -
                      writeQueue[ | 
| 63175 | 
            +
                      writeQueue[number3] = data;
         | 
| 64183 63176 | 
             
                    }
         | 
| 64184 63177 | 
             
                    if (writeQueue.hasOwnProperty(nextToWrite)) {
         | 
| 64185 63178 | 
             
                      var dataToWrite = writeQueue[nextToWrite];
         | 
| @@ -64194,21 +63187,21 @@ var require_map_stream = __commonJS({ | |
| 64194 63187 | 
             
                        end();
         | 
| 64195 63188 | 
             
                    }
         | 
| 64196 63189 | 
             
                  }
         | 
| 64197 | 
            -
                  function next(err2, data,  | 
| 63190 | 
            +
                  function next(err2, data, number3) {
         | 
| 64198 63191 | 
             
                    if (destroyed)
         | 
| 64199 63192 | 
             
                      return;
         | 
| 64200 63193 | 
             
                    inNext = true;
         | 
| 64201 63194 | 
             
                    if (!err2 || self2.opts.failures) {
         | 
| 64202 | 
            -
                      queueData(data,  | 
| 63195 | 
            +
                      queueData(data, number3);
         | 
| 64203 63196 | 
             
                    }
         | 
| 64204 63197 | 
             
                    if (err2) {
         | 
| 64205 63198 | 
             
                      stream.emit.apply(stream, [errorEventName, err2]);
         | 
| 64206 63199 | 
             
                    }
         | 
| 64207 63200 | 
             
                    inNext = false;
         | 
| 64208 63201 | 
             
                  }
         | 
| 64209 | 
            -
                  function wrappedMapper(input,  | 
| 63202 | 
            +
                  function wrappedMapper(input, number3, callback) {
         | 
| 64210 63203 | 
             
                    return mapper.call(null, input, function(err2, data) {
         | 
| 64211 | 
            -
                      callback(err2, data,  | 
| 63204 | 
            +
                      callback(err2, data, number3);
         | 
| 64212 63205 | 
             
                    });
         | 
| 64213 63206 | 
             
                  }
         | 
| 64214 63207 | 
             
                  stream.write = function(data) {
         | 
| @@ -78040,7 +77033,7 @@ var init_selector_ui = __esm({ | |
| 78040 77033 | 
             
            });
         | 
| 78041 77034 |  | 
| 78042 77035 | 
             
            // src/cli/commands/libSqlPushUtils.ts
         | 
| 78043 | 
            -
            var  | 
| 77036 | 
            +
            var getOldTableName3, _moveDataStatements2, libSqlLogSuggestionsAndReturn;
         | 
| 78044 77037 | 
             
            var init_libSqlPushUtils = __esm({
         | 
| 78045 77038 | 
             
              "src/cli/commands/libSqlPushUtils.ts"() {
         | 
| 78046 77039 | 
             
                "use strict";
         | 
| @@ -78048,7 +77041,7 @@ var init_libSqlPushUtils = __esm({ | |
| 78048 77041 | 
             
                init_utils();
         | 
| 78049 77042 | 
             
                init_sqliteSchema();
         | 
| 78050 77043 | 
             
                init_sqlgenerator();
         | 
| 78051 | 
            -
                 | 
| 77044 | 
            +
                getOldTableName3 = (tableName, meta) => {
         | 
| 78052 77045 | 
             
                  for (const key of Object.keys(meta.tables)) {
         | 
| 78053 77046 | 
             
                    const value = meta.tables[key];
         | 
| 78054 77047 | 
             
                    if (`"${tableName}"` === value) {
         | 
| @@ -78203,7 +77196,7 @@ var init_libSqlPushUtils = __esm({ | |
| 78203 77196 | 
             
                    } else if (statement.type === "recreate_table") {
         | 
| 78204 77197 | 
             
                      const tableName = statement.tableName;
         | 
| 78205 77198 | 
             
                      let dataLoss = false;
         | 
| 78206 | 
            -
                      const oldTableName =  | 
| 77199 | 
            +
                      const oldTableName = getOldTableName3(tableName, meta);
         | 
| 78207 77200 | 
             
                      const prevColumnNames = Object.keys(json1.tables[oldTableName].columns);
         | 
| 78208 77201 | 
             
                      const currentColumnNames = Object.keys(json2.tables[tableName].columns);
         | 
| 78209 77202 | 
             
                      const { removedColumns, addedColumns } = findAddedAndRemoved(
         | 
| @@ -81881,30 +80874,6 @@ var init_introspect_pg = __esm({ | |
| 81881 80874 | 
             
                    },
         | 
| 81882 80875 | 
             
                    { pg: [] }
         | 
| 81883 80876 | 
             
                  );
         | 
| 81884 | 
            -
                  Object.values(schema5.views).forEach((it) => {
         | 
| 81885 | 
            -
                    if (it.schema && it.schema !== "public" && it.schema !== "") {
         | 
| 81886 | 
            -
                      imports.pg.push("pgSchema");
         | 
| 81887 | 
            -
                    } else if (it.schema === "public") {
         | 
| 81888 | 
            -
                      it.materialized ? imports.pg.push("pgMaterializedView") : imports.pg.push("pgView");
         | 
| 81889 | 
            -
                    }
         | 
| 81890 | 
            -
                    Object.values(it.columns).forEach(() => {
         | 
| 81891 | 
            -
                      const columnImports = Object.values(it.columns).map((col) => {
         | 
| 81892 | 
            -
                        let patched = (importsPatch2[col.type] || col.type).replace("[]", "");
         | 
| 81893 | 
            -
                        patched = patched === "double precision" ? "doublePrecision" : patched;
         | 
| 81894 | 
            -
                        patched = patched.startsWith("varchar(") ? "varchar" : patched;
         | 
| 81895 | 
            -
                        patched = patched.startsWith("char(") ? "char" : patched;
         | 
| 81896 | 
            -
                        patched = patched.startsWith("numeric(") ? "numeric" : patched;
         | 
| 81897 | 
            -
                        patched = patched.startsWith("time(") ? "time" : patched;
         | 
| 81898 | 
            -
                        patched = patched.startsWith("timestamp(") ? "timestamp" : patched;
         | 
| 81899 | 
            -
                        patched = patched.startsWith("vector(") ? "vector" : patched;
         | 
| 81900 | 
            -
                        patched = patched.startsWith("geometry(") ? "geometry" : patched;
         | 
| 81901 | 
            -
                        return patched;
         | 
| 81902 | 
            -
                      }).filter((type) => {
         | 
| 81903 | 
            -
                        return pgImportsList.has(type);
         | 
| 81904 | 
            -
                      });
         | 
| 81905 | 
            -
                      imports.pg.push(...columnImports);
         | 
| 81906 | 
            -
                    });
         | 
| 81907 | 
            -
                  });
         | 
| 81908 80877 | 
             
                  Object.values(schema5.sequences).forEach((it) => {
         | 
| 81909 80878 | 
             
                    if (it.schema && it.schema !== "public" && it.schema !== "") {
         | 
| 81910 80879 | 
             
                      imports.pg.push("pgSchema");
         | 
| @@ -81999,28 +80968,6 @@ var init_introspect_pg = __esm({ | |
| 81999 80968 | 
             
                    statement += ");";
         | 
| 82000 80969 | 
             
                    return statement;
         | 
| 82001 80970 | 
             
                  });
         | 
| 82002 | 
            -
                  const viewsStatements = Object.values(schema5.views).map((it) => {
         | 
| 82003 | 
            -
                    const viewSchema = schemas[it.schema];
         | 
| 82004 | 
            -
                    const paramName = paramNameFor(it.name, viewSchema);
         | 
| 82005 | 
            -
                    const func = viewSchema ? it.materialized ? `${viewSchema}.materializedView` : `${viewSchema}.view` : it.materialized ? "pgMaterializedView" : "pgView";
         | 
| 82006 | 
            -
                    const withOption = it.with ?? "";
         | 
| 82007 | 
            -
                    const as = `sql\`${it.definition}\``;
         | 
| 82008 | 
            -
                    const tablespace = it.tablespace ?? "";
         | 
| 82009 | 
            -
                    const columns = createTableColumns3(
         | 
| 82010 | 
            -
                      "",
         | 
| 82011 | 
            -
                      Object.values(it.columns),
         | 
| 82012 | 
            -
                      [],
         | 
| 82013 | 
            -
                      enumTypes,
         | 
| 82014 | 
            -
                      schemas,
         | 
| 82015 | 
            -
                      casing2,
         | 
| 82016 | 
            -
                      schema5.internal
         | 
| 82017 | 
            -
                    );
         | 
| 82018 | 
            -
                    let statement = `export const ${withCasing2(paramName, casing2)} = ${func}("${it.name}", {${columns}})`;
         | 
| 82019 | 
            -
                    statement += tablespace ? `.tablespace("${tablespace}")` : "";
         | 
| 82020 | 
            -
                    statement += withOption ? `.with(${JSON.stringify(withOption)})` : "";
         | 
| 82021 | 
            -
                    statement += `.as(${as});`;
         | 
| 82022 | 
            -
                    return statement;
         | 
| 82023 | 
            -
                  }).join("\n\n");
         | 
| 82024 80971 | 
             
                  const uniquePgImports = ["pgTable", ...new Set(imports.pg)];
         | 
| 82025 80972 | 
             
                  const importsTs = `import { ${uniquePgImports.join(
         | 
| 82026 80973 | 
             
                    ", "
         | 
| @@ -82033,8 +80980,6 @@ var init_introspect_pg = __esm({ | |
| 82033 80980 | 
             
                  decalrations += sequencesStatements;
         | 
| 82034 80981 | 
             
                  decalrations += "\n";
         | 
| 82035 80982 | 
             
                  decalrations += tableStatements.join("\n\n");
         | 
| 82036 | 
            -
                  decalrations += "\n";
         | 
| 82037 | 
            -
                  decalrations += viewsStatements;
         | 
| 82038 80983 | 
             
                  const file = importsTs + decalrations;
         | 
| 82039 80984 | 
             
                  const schemaEntry = `
         | 
| 82040 80985 | 
             
                {
         | 
| @@ -82593,7 +81538,6 @@ var init_introspect = __esm({ | |
| 82593 81538 | 
             
                      sequencesResolver,
         | 
| 82594 81539 | 
             
                      tablesResolver,
         | 
| 82595 81540 | 
             
                      columnsResolver,
         | 
| 82596 | 
            -
                      viewsResolver,
         | 
| 82597 81541 | 
             
                      dryPg,
         | 
| 82598 81542 | 
             
                      schema5
         | 
| 82599 81543 | 
             
                    );
         | 
| @@ -86315,7 +85259,7 @@ init_utils2(); | |
| 86315 85259 | 
             
            var version2 = async () => {
         | 
| 86316 85260 | 
             
              const { npmVersion } = await ormCoreVersions();
         | 
| 86317 85261 | 
             
              const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
         | 
| 86318 | 
            -
              const envVersion = "0.25.0- | 
| 85262 | 
            +
              const envVersion = "0.25.0-b8bf113";
         | 
| 86319 85263 | 
             
              const kitVersion = envVersion ? `v${envVersion}` : "--";
         | 
| 86320 85264 | 
             
              const versions = `drizzle-kit: ${kitVersion}
         | 
| 86321 85265 | 
             
            ${ormVersion}`;
         |