diff --git a/server/migrations/20250913202342-add-source-metadata-to-collections.js b/server/migrations/20250913202342-add-source-metadata-to-collections.js new file mode 100644 index 0000000000..cddd4e259b --- /dev/null +++ b/server/migrations/20250913202342-add-source-metadata-to-collections.js @@ -0,0 +1,14 @@ +"use strict"; + +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.addColumn("collections", "sourceMetadata", { + type: Sequelize.JSONB, + allowNull: true, + }); + }, + + async down(queryInterface) { + await queryInterface.removeColumn("collections", "sourceMetadata"); + }, +}; diff --git a/server/models/Collection.ts b/server/models/Collection.ts index a9f033f43d..c1f63386bc 100644 --- a/server/models/Collection.ts +++ b/server/models/Collection.ts @@ -45,7 +45,11 @@ import { AfterSave, } from "sequelize-typescript"; import isUUID from "validator/lib/isUUID"; -import type { CollectionSort, ProsemirrorData } from "@shared/types"; +import type { + CollectionSort, + ProsemirrorData, + SourceMetadata, +} from "@shared/types"; import { CollectionPermission, NavigationNode } from "@shared/types"; import { UrlHelper } from "@shared/utils/UrlHelper"; import { sortNavigationNodes } from "@shared/utils/collections"; @@ -306,6 +310,10 @@ class Collection extends ParanoidModel< @Column(DataType.BOOLEAN) commenting: boolean | null; + @AllowNull + @Column(DataType.JSONB) + sourceMetadata: SourceMetadata | null; + // getters /**