Browse Source

fix(nocodb): cache fix + migration rename

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
084115e9bc
  1. 8
      packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts
  2. 0
      packages/nocodb/src/meta/migrations/v2/nc_041_calendar_view.ts
  3. 22
      packages/nocodb/src/models/CalendarViewColumn.ts
  4. 9
      packages/nocodb/src/models/FormViewColumn.ts

8
packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts

@ -27,7 +27,7 @@ import * as nc_037_rename_project_and_base from '~/meta/migrations/v2/nc_037_ren
import * as nc_038_formula_parsed_tree_column from '~/meta/migrations/v2/nc_038_formula_parsed_tree_column';
import * as nc_039_sqlite_alter_column_types from '~/meta/migrations/v2/nc_039_sqlite_alter_column_types';
import * as nc_040_form_view_alter_column_types from '~/meta/migrations/v2/nc_040_form_view_alter_column_types';
import * as nc_041_calander_view from '~/meta/migrations/v2/nc_041_calander_view';
import * as nc_041_calendar_view from '~/meta/migrations/v2/nc_041_calendar_view';
// Create a custom migration source class
export default class XcMigrationSourcev2 {
@ -66,7 +66,7 @@ export default class XcMigrationSourcev2 {
'nc_038_formula_parsed_tree_column',
'nc_039_sqlite_alter_column_types',
'nc_040_form_view_alter_column_types',
'nc_041_calander_view',
'nc_041_calendar_view',
]);
}
@ -134,8 +134,8 @@ export default class XcMigrationSourcev2 {
return nc_039_sqlite_alter_column_types;
case 'nc_040_form_view_alter_column_types':
return nc_040_form_view_alter_column_types;
case 'nc_041_calander_view':
return nc_041_calander_view;
case 'nc_041_calendar_view':
return nc_041_calendar_view;
}
}
}

0
packages/nocodb/src/meta/migrations/v2/nc_041_calander_view.ts → packages/nocodb/src/meta/migrations/v2/nc_041_calendar_view.ts

22
packages/nocodb/src/models/CalendarViewColumn.ts

@ -41,11 +41,12 @@ export default class CalendarViewColumn {
viewColumn.meta && typeof viewColumn.meta === 'string'
? JSON.parse(viewColumn.meta)
: viewColumn.meta;
await NocoCache.set(
`${CacheScope.CALENDAR_VIEW_COLUMN}:${calendarViewColumnId}`,
viewColumn,
);
}
await NocoCache.set(
`${CacheScope.CALENDAR_VIEW_COLUMN}:${calendarViewColumnId}`,
viewColumn,
);
return viewColumn && new CalendarViewColumn(viewColumn);
}
@ -90,18 +91,19 @@ export default class CalendarViewColumn {
id,
);
// if cache is not present skip pushing it into the list to avoid unexpected behaviour
const { list } = await NocoCache.getList(CacheScope.CALENDAR_VIEW_COLUMN, [
column.fk_view_id,
]);
{
const view = await View.get(column.fk_view_id, ncMeta);
await View.clearSingleQueryCache(view.fk_model_id, [view]);
}
if (list?.length)
return this.get(id, ncMeta).then(async (viewColumn) => {
await NocoCache.appendToList(
CacheScope.CALENDAR_VIEW_COLUMN,
[column.fk_view_id],
`${CacheScope.CALENDAR_VIEW_COLUMN}:${id}`,
);
return this.get(id, ncMeta);
return viewColumn;
});
}
public static async list(

9
packages/nocodb/src/models/FormViewColumn.ts

@ -49,11 +49,12 @@ export default class FormViewColumn implements FormColumnType {
viewColumn.meta && typeof viewColumn.meta === 'string'
? JSON.parse(viewColumn.meta)
: viewColumn.meta;
await NocoCache.set(
`${CacheScope.FORM_VIEW_COLUMN}:${formViewColumnId}`,
viewColumn,
);
}
await NocoCache.set(
`${CacheScope.FORM_VIEW_COLUMN}:${formViewColumnId}`,
viewColumn,
);
return viewColumn && new FormViewColumn(viewColumn);
}

Loading…
Cancel
Save