add missing fields for comic

This commit is contained in:
Thomas Peetz
2025-05-19 15:14:29 +02:00
parent edcaed1b1a
commit bd86379d07
5 changed files with 9 additions and 5 deletions
+1
View File
@@ -15,6 +15,7 @@ class Publisher(Base):
last_modified_date: Mapped[datetime] = mapped_column(default=func.now())
version: Mapped[int] = mapped_column(default=0)
name = Column(String, unique=True)
weblink = Column(String, nullable=True)
parent_publisher_id: Mapped[Optional[str]] = mapped_column(ForeignKey('publisher.id'))
parent_publisher: Mapped[Optional['Publisher']] = relationship("Publisher", back_populates="imprints", remote_side=[id])
imprints: Mapped[List['Publisher']] = relationship('Publisher', back_populates="parent_publisher")
+1
View File
@@ -14,6 +14,7 @@ class Publisher(Base):
last_modified_date: Mapped[datetime] = mapped_column(default=func.now())
version: Mapped[int] = mapped_column(default=0)
name = Column(String, unique=True)
weblink = Column(String, nullable=True)
parent_publisher_id: Mapped[Optional[str]] = mapped_column(ForeignKey('publisher.id'))
parent_publisher: Mapped[Optional['Publisher']] = relationship("Publisher", back_populates="imprints", remote_side=[id])
imprints: Mapped[List['Publisher']] = relationship('Publisher', back_populates="parent_publisher")
+1 -1
View File
@@ -9,7 +9,7 @@ class MetaDataTableResponse(BaseModel):
class MetaDataColumnResponse(BaseModel):
id: str
name: str
label: str
label: str | None
order: PositiveInt
ref_column: str | None
column_type: str
@@ -179,14 +179,15 @@ public class SetupModuleAdmin implements ApplicationListener<ContextRefreshedEve
metaDataService.getColumn(artistTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(artistTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(artistTable, "name", "name", "TEXT", "UNIQUE", 5, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(artistTable, "weblink", "weblink", "TEXT", null, 9, Boolean.TRUE, "Link", Boolean.FALSE, null);
metaDataService.getColumn(artistTable, "weblink", "weblink", "TEXT", null, 6, Boolean.TRUE, "Link", Boolean.FALSE, null);
MetaDataTable publisherTable = metaDataService.getTable("publisher");
metaDataService.getColumn(publisherTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(publisherTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(publisherTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(publisherTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(publisherTable, "name", "name", "TEXT", "UNIQUE", 5, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(publisherTable, "parent_publisher_id", "parent_publisher_id", "TEXT", null, 6, Boolean.TRUE, "Parent Company", Boolean.FALSE, null, "name");
metaDataService.getColumn(publisherTable, "weblink", "weblink", "TEXT", null, 6, Boolean.TRUE, "Link", Boolean.FALSE, null);
metaDataService.getColumn(publisherTable, "parent_publisher_id", "parent_publisher_id", "TEXT", null, 7, Boolean.TRUE, "Parent Company", Boolean.FALSE, null, "name");
MetaDataTable comicTable = metaDataService.getTable("comic");
metaDataService.getColumn(comicTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "ID", Boolean.FALSE, null);
metaDataService.getColumn(comicTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
@@ -122,11 +122,11 @@ public class MetaDataService {
checkColumnValues(table, column, columnName, columnSyncName, columnType, columnModifier, columnOrder, isShown, columnLabel, showFilter, filterLabel, refColumn);
} else {
log.info("Column {} of table {} not found, will create it", columnName, table.getTableName());
//addColumn(table,columnName,columnSyncName,columnType,columnModifier,columnOrder,isShown);
addColumn(table,columnName,columnSyncName,columnType,columnModifier,columnOrder,isShown, refColumn);
}
}
private void addColumn(MetaDataTable table, String columnName, String columnSyncName, String columnType, String columnModifier, Integer columnOrder, Boolean isShown) {
private void addColumn(MetaDataTable table, String columnName, String columnSyncName, String columnType, String columnModifier, Integer columnOrder, Boolean isShown, String refColumn) {
MetaDataColumn column = new MetaDataColumn();
column.setTable(table);
column.setColumnName(columnName);
@@ -135,6 +135,7 @@ public class MetaDataService {
column.setColumnModifier(columnModifier);
column.setColumnOrder(columnOrder);
column.setIsShown(isShown);
column.setRefColumn(refColumn);
saveMetaDataColumn(column);
}