Database / Planning

compact_block_member

One farmer's PLI (land and crop) enrolled in a compact block.

Table factsheetagri_db
Written by
  • Saved with compact_block
  • Compact block farmer selection
  • CompactBlockMemberDeleteRH
Read by
  • Compact block screens
  • PLI picker (blocks PLIs already in another block)
Filled from
GET gateway/portfolio-service/api/v1/compact-block/filter
Sync
appId is a client UUID primary key. syncStatus starts at SYNC_DONE for downloaded rows, becomes SYNC_NOT_INITIALIZED when the row is created or edited on the device, and goes back to SYNC_DONE when the response handler writes the server id. opId holds the id of the last queued library operation. Sync entity COMPACT_BLOCK_MEMBER.
Source
data/src/main/java/org/mindtree/app/agricultor/data/entity/CompactBlockMember.kt

Columns

ColumnTypeNullKeyMeaning
assetCheckSumTEXTYesContent hash of a land asset. Links this row to the land before the land has a server id.
assetCodeTEXTYesSurvey number of the land.
assetIdINTEGERYesFK → farmerassets.idAsset id. Link by convention only, no FK constraint.
idINTEGERYesServer id. Null or 0 until the row is synced.
joiningDateTEXTYesDate joined the block.
leavingDateTEXTYesDate left the block.
titleIdTEXTYesFK → compact_block.titleIdStable business key shared by all versions of the record. Link by convention only, no FK constraint.
notesTEXTYesNo description in code.
owningEntityIdTEXTYesFK → ie_flat_entity.iEOLTPIdFarmer server id (= ie_flat_entity.iEOLTPId), stored as text. Link by convention only, no FK constraint.
owningEntityTypeTEXTYesOwner type, normally the farmer (IE) entity type.
activeINTEGERYesSoft-delete flag (1 = active).
inActiveReasonTEXTYesReason given when the row was deactivated.
shgIdTEXTYesSHG of the farmer.
voTEXTYesVO of the farmer.
uuidTEXTYesIndexStable business UUID, also sent to the server. Index: unique.
portfolioLineItemTitleIdTEXTYesFK → portfolio_portfoliolineitem.titleIdPortfolio line item title id. Link by convention only, no FK constraint.
portfolioLineItemIdINTEGERYesFK → portfolio_portfoliolineitem.idPortfolio line item id. Link by convention only, no FK constraint.
portfolioIdINTEGERYesFK → portfolio.idPortfolio id. Link by convention only, no FK constraint.
createdByAppINTEGERYesAudit: app that created/last changed the row.
lastModifiedByAppINTEGERYesAudit: app that created/last changed the row.
createdFromDeviceTEXTYesAudit: device id that created/last changed the row.
lastUpdatedFromDeviceTEXTYesAudit: device id that created/last changed the row.
appIdTEXTNoPKClient-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed.
opIdTEXTYesId of the last queued operation in the library queue (SYNC_QUEUE_DB).
syncStatusTEXTNoSYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default).

Notes

  • getCompactBlockMemberListNotInTitleId returns active members of other blocks so that one PLI cannot join two blocks.
  • Missing index on titleId (the join column of the relation) and portfolioLineItemTitleId.