Add sourceMetadata column to collections (#10165)

This adds the sourceMetadata column to the collections table to match
the one on documents. The column is defined as JSONB and allows null values.

Changes:
- Added migration to create sourceMetadata column on collections table
- Added sourceMetadata field to Collection model with SourceMetadata type
- Imported SourceMetadata type in Collection model

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
This commit is contained in:
codegen-sh[bot] authored and GitHub committed 2025-09-13 20:28:29 -04:00
1 parent 3ab3117e11
commit c40ccd32f5
2 files changed
+23 -1

No files matched your search

@@ -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");
},
};
+9 -1
View File
@@ -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
/**