orchid-orm 1.69.1 → 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.
@@ -754,9 +754,9 @@ const processIndexesAndExcludes = (config, changeTableData, ast, compareExpressi
754
754
  const processItems = ({ config, changeTableData, codeComparableItems, codeItems, skipCodeItems, holdCodeItems, wait, ast, compareExpressions }, key) => {
755
755
  const { changeTableAst: { shape } } = changeTableData;
756
756
  const dbItems = changeTableData.dbTableData[key];
757
- for (const dbItem of dbItems) {
757
+ for (let dbItem of dbItems) {
758
758
  if (dbItem.columns.some((column) => "column" in column && checkForColumnAddOrDrop(shape, column.column))) continue;
759
- normalizeItem(dbItem);
759
+ dbItem = normalizeItem(dbItem);
760
760
  const { found, rename, foundAndHasSql } = findMatchingItem(dbItem, codeComparableItems, codeItems, skipCodeItems, changeTableData.codeTable.table, config, key);
761
761
  const { columns: dbColumns } = dbItem;
762
762
  if (!foundAndHasSql) {
@@ -871,24 +871,30 @@ const collectCodeComparableItems = (config, codeItems) => {
871
871
  };
872
872
  };
873
873
  const collectCodeComparableItemsType = (config, codeItems, key) => {
874
- return codeItems[key].map((codeItem) => {
875
- normalizeItem(codeItem.options);
874
+ return codeItems[key].map((codeItem, i) => {
875
+ const options = normalizeItem(codeItem.options);
876
+ codeItems[key][i] = {
877
+ ...codeItem,
878
+ options
879
+ };
876
880
  return itemToComparable({
877
- ...codeItem.options,
878
- include: codeItem.options.include === void 0 ? void 0 : config.snakeCase ? toArray(codeItem.options.include).map(toSnakeCase) : toArray(codeItem.options.include),
881
+ ...options,
882
+ include: options.include === void 0 ? void 0 : config.snakeCase ? toArray(options.include).map(toSnakeCase) : toArray(options.include),
879
883
  columns: codeItem.columns,
880
- name: codeItem.options.name,
884
+ name: options.name,
881
885
  columnKeys: codeItem.columnKeys,
882
886
  includeKeys: codeItem.includeKeys
883
887
  });
884
888
  });
885
889
  };
886
890
  const normalizeItem = (item) => {
891
+ item = { ...item };
887
892
  if (item.using) item.using = item.using.toLowerCase();
888
893
  if (item.using === "btree") item.using = void 0;
889
894
  if (!item.unique) item.unique = void 0;
890
895
  if (item.nullsNotDistinct === false) item.nullsNotDistinct = void 0;
891
896
  if (item.exclude) for (let i = 0; i < item.columns.length; i++) item.columns[i].with = item.exclude[i];
897
+ return item;
892
898
  };
893
899
  const itemToComparable = (index) => {
894
900
  let hasExpression = false;