Remove unused column in item

This commit is contained in:
eikek
2022-06-11 13:03:14 +02:00
parent 1611df81ed
commit aeeb54fcc3
9 changed files with 6 additions and 17 deletions

View File

@ -7841,8 +7841,6 @@ components:
$ref: "#/components/schemas/IdName" $ref: "#/components/schemas/IdName"
concEquipment: concEquipment:
$ref: "#/components/schemas/IdName" $ref: "#/components/schemas/IdName"
inReplyTo:
$ref: "#/components/schemas/IdName"
folder: folder:
$ref: "#/components/schemas/IdName" $ref: "#/components/schemas/IdName"
dueDate: dueDate:

View File

@ -136,7 +136,6 @@ trait Conversions {
data.corrPerson.map(p => IdName(p.pid, p.name)), data.corrPerson.map(p => IdName(p.pid, p.name)),
data.concPerson.map(p => IdName(p.pid, p.name)), data.concPerson.map(p => IdName(p.pid, p.name)),
data.concEquip.map(e => IdName(e.eid, e.name)), data.concEquip.map(e => IdName(e.eid, e.name)),
data.inReplyTo.map(mkIdName),
data.folder.map(mkIdName), data.folder.map(mkIdName),
data.item.dueDate, data.item.dueDate,
data.item.notes, data.item.notes,

View File

@ -0,0 +1 @@
alter table "item" drop column "inreplyto";

View File

@ -0,0 +1,2 @@
alter table `item` drop foreign key item_ibfk_1;
alter table `item` drop column `inreplyto` cascade;

View File

@ -0,0 +1 @@
alter table "item" drop column "inreplyto";

View File

@ -15,7 +15,6 @@ case class ItemData(
corrPerson: Option[RPerson], corrPerson: Option[RPerson],
concPerson: Option[RPerson], concPerson: Option[RPerson],
concEquip: Option[REquipment], concEquip: Option[REquipment],
inReplyTo: Option[IdRef],
folder: Option[IdRef], folder: Option[IdRef],
tags: Vector[RTag], tags: Vector[RTag],
attachments: Vector[(RAttachment, RFileMeta)], attachments: Vector[(RAttachment, RFileMeta)],

View File

@ -74,12 +74,9 @@ object QItem extends FtsSupport {
} }
def findItem(id: Ident, collective: Ident): ConnectionIO[Option[ItemData]] = { def findItem(id: Ident, collective: Ident): ConnectionIO[Option[ItemData]] = {
val ref = RItem.as("ref")
val cq = val cq =
Select( Select(
select(i.all, org.all, pers0.all, pers1.all, equip.all) select(i.all, org.all, pers0.all, pers1.all, equip.all)
.append(ref.id.s)
.append(ref.name.s)
.append(f.id.s) .append(f.id.s)
.append(f.name.s), .append(f.name.s),
from(i) from(i)
@ -87,7 +84,6 @@ object QItem extends FtsSupport {
.leftJoin(pers0, pers0.pid === i.corrPerson) .leftJoin(pers0, pers0.pid === i.corrPerson)
.leftJoin(pers1, pers1.pid === i.concPerson) .leftJoin(pers1, pers1.pid === i.concPerson)
.leftJoin(equip, equip.eid === i.concEquipment) .leftJoin(equip, equip.eid === i.concEquipment)
.leftJoin(ref, ref.id === i.inReplyTo)
.leftJoin(f, f.id === i.folder), .leftJoin(f, f.id === i.folder),
i.id === id i.id === id
).build ).build
@ -100,7 +96,6 @@ object QItem extends FtsSupport {
Option[RPerson], Option[RPerson],
Option[RPerson], Option[RPerson],
Option[REquipment], Option[REquipment],
Option[IdRef],
Option[IdRef] Option[IdRef]
) )
] ]
@ -122,7 +117,7 @@ object QItem extends FtsSupport {
cfs <- customfields cfs <- customfields
rel <- related rel <- related
} yield data.map(d => } yield data.map(d =>
ItemData(d._1, d._2, d._3, d._4, d._5, d._6, d._7, ts, att, srcs, arch, cfs, rel) ItemData(d._1, d._2, d._3, d._4, d._5, d._6, ts, att, srcs, arch, cfs, rel)
) )
} }

View File

@ -30,7 +30,6 @@ case class RItem(
corrPerson: Option[Ident], corrPerson: Option[Ident],
concPerson: Option[Ident], concPerson: Option[Ident],
concEquipment: Option[Ident], concEquipment: Option[Ident],
inReplyTo: Option[Ident],
dueDate: Option[Timestamp], dueDate: Option[Timestamp],
created: Timestamp, created: Timestamp,
updated: Timestamp, updated: Timestamp,
@ -63,7 +62,6 @@ object RItem {
None, None,
None, None,
None, None,
None,
now, now,
now, now,
None, None,
@ -85,7 +83,6 @@ object RItem {
val corrPerson = Column[Ident]("corrperson", this) val corrPerson = Column[Ident]("corrperson", this)
val concPerson = Column[Ident]("concperson", this) val concPerson = Column[Ident]("concperson", this)
val concEquipment = Column[Ident]("concequipment", this) val concEquipment = Column[Ident]("concequipment", this)
val inReplyTo = Column[Ident]("inreplyto", this)
val dueDate = Column[Timestamp]("duedate", this) val dueDate = Column[Timestamp]("duedate", this)
val created = Column[Timestamp]("created", this) val created = Column[Timestamp]("created", this)
val updated = Column[Timestamp]("updated", this) val updated = Column[Timestamp]("updated", this)
@ -103,7 +100,6 @@ object RItem {
corrPerson, corrPerson,
concPerson, concPerson,
concEquipment, concEquipment,
inReplyTo,
dueDate, dueDate,
created, created,
updated, updated,
@ -123,7 +119,7 @@ object RItem {
T, T,
T.all, T.all,
fr"${v.id},${v.cid},${v.name},${v.itemDate},${v.source},${v.direction},${v.state}," ++ fr"${v.id},${v.cid},${v.name},${v.itemDate},${v.source},${v.direction},${v.state}," ++
fr"${v.corrOrg},${v.corrPerson},${v.concPerson},${v.concEquipment},${v.inReplyTo},${v.dueDate}," ++ fr"${v.corrOrg},${v.corrPerson},${v.concPerson},${v.concEquipment},${v.dueDate}," ++
fr"${v.created},${v.updated},${v.notes},${v.folderId}" fr"${v.created},${v.updated},${v.notes},${v.folderId}"
) )
@ -145,7 +141,6 @@ object RItem {
T.corrPerson.setTo(item.corrPerson), T.corrPerson.setTo(item.corrPerson),
T.concPerson.setTo(item.concPerson), T.concPerson.setTo(item.concPerson),
T.concEquipment.setTo(item.concEquipment), T.concEquipment.setTo(item.concEquipment),
T.inReplyTo.setTo(item.inReplyTo),
T.dueDate.setTo(item.dueDate), T.dueDate.setTo(item.dueDate),
T.notes.setTo(item.notes), T.notes.setTo(item.notes),
T.folder.setTo(item.folderId), T.folder.setTo(item.folderId),

View File

@ -187,7 +187,6 @@ class TempFtsOpsTest extends DatabaseTest {
None, None,
None, None,
None, None,
None,
ts, ts,
ts, ts,
None, None,