orchid-orm 1.69.0 → 1.69.2

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.
@@ -777,9 +777,9 @@ const processIndexesAndExcludes = (config, changeTableData, ast, compareExpressi
777
777
  const processItems = ({ config, changeTableData, codeComparableItems, codeItems, skipCodeItems, holdCodeItems, wait, ast, compareExpressions }, key) => {
778
778
  const { changeTableAst: { shape } } = changeTableData;
779
779
  const dbItems = changeTableData.dbTableData[key];
780
- for (const dbItem of dbItems) {
780
+ for (let dbItem of dbItems) {
781
781
  if (dbItem.columns.some((column) => "column" in column && checkForColumnAddOrDrop(shape, column.column))) continue;
782
- normalizeItem(dbItem);
782
+ dbItem = normalizeItem(dbItem);
783
783
  const { found, rename, foundAndHasSql } = findMatchingItem(dbItem, codeComparableItems, codeItems, skipCodeItems, changeTableData.codeTable.table, config, key);
784
784
  const { columns: dbColumns } = dbItem;
785
785
  if (!foundAndHasSql) {
@@ -894,24 +894,30 @@ const collectCodeComparableItems = (config, codeItems) => {
894
894
  };
895
895
  };
896
896
  const collectCodeComparableItemsType = (config, codeItems, key) => {
897
- return codeItems[key].map((codeItem) => {
898
- normalizeItem(codeItem.options);
897
+ return codeItems[key].map((codeItem, i) => {
898
+ const options = normalizeItem(codeItem.options);
899
+ codeItems[key][i] = {
900
+ ...codeItem,
901
+ options
902
+ };
899
903
  return itemToComparable({
900
- ...codeItem.options,
901
- include: codeItem.options.include === void 0 ? void 0 : config.snakeCase ? (0, pqb_internal.toArray)(codeItem.options.include).map(pqb_internal.toSnakeCase) : (0, pqb_internal.toArray)(codeItem.options.include),
904
+ ...options,
905
+ include: options.include === void 0 ? void 0 : config.snakeCase ? (0, pqb_internal.toArray)(options.include).map(pqb_internal.toSnakeCase) : (0, pqb_internal.toArray)(options.include),
902
906
  columns: codeItem.columns,
903
- name: codeItem.options.name,
907
+ name: options.name,
904
908
  columnKeys: codeItem.columnKeys,
905
909
  includeKeys: codeItem.includeKeys
906
910
  });
907
911
  });
908
912
  };
909
913
  const normalizeItem = (item) => {
914
+ item = { ...item };
910
915
  if (item.using) item.using = item.using.toLowerCase();
911
916
  if (item.using === "btree") item.using = void 0;
912
917
  if (!item.unique) item.unique = void 0;
913
918
  if (item.nullsNotDistinct === false) item.nullsNotDistinct = void 0;
914
919
  if (item.exclude) for (let i = 0; i < item.columns.length; i++) item.columns[i].with = item.exclude[i];
920
+ return item;
915
921
  };
916
922
  const itemToComparable = (index) => {
917
923
  let hasExpression = false;