Opened 8 years ago

Closed 7 years ago

#1028 closed enhancement (fixed)

Federated models

Reported by: Jessica Tallon Owned by:
Priority: major Milestone:
Component: programming Keywords: federation, models, pump.io
Cc: Elrond Parent Tickets:

Description

As we progress with federation new models are required to hold data we didn't need to store before and certain data shouldn't be required anymore. I have come up with example models which I think will work well as well as a generic foreign key implementation.

I've attached the org-mode file for future reference but I've uploaded the exported HTML version to:

https://theperplexingpariah.co.uk/GMG/new_models.html

Subtickets

Attachments (2)

new_models.org (11.7 KB) - added by Jessica Tallon 8 years ago.
new models org file
new_models_r1.org (11.5 KB) - added by Jessica Tallon 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Jessica Tallon

Attachment: new_models.org added

new models org file

comment:1 Changed 8 years ago by Elrond

Okay, …

General: I think, the code snippets serve as "Show the idea, from programmer to programmer". So I will not do a code review, but an idea review. If you want a code review, let me know.

Note: All those X = Column(Integer, ForeignKey("core__activity_intermediators.id")) are another form of a generic foreign key. I don't know yet, what this statement effects. I just wanted to make this clear and obvious. It might mean, that some thing might need to be refactored. At a second look: The new "Activity" uses new-generic-foreign-key. So is this old thing still needed?

"We don't need referential integrity" is a quick thing. I don't want to buy this one so easily and simple. You know, I like referential integrity. Let's assume, you're right -- I really guess, you are. What I would like people to do: If they do not enforce RI, I would like them to add a comment explaining why this is good.

Why those non classy ..._link_table = Table(... declarations? To be honest, I have a hard time reading them. Is there a reason for this?

I don't see an answer to the special lists yet. But I don't have one myself either.

comment:2 Changed 8 years ago by Jessica Tallon

You're right the code is just an example to show the idea, a code review will be needed later once I implement this properly.

The Activity models can now use the new GenericForeignKey and we can remove the ActivityIntermediatory model. I've updated the document to reflect that.

The reason we don't need referential integrity in most places is because of the way delete works on most things now. The new models bring a new way of handling deletions which is when a delete occurs we remove the bulk of the data leaving a shell object and other data such as comments remain. This choice has been made because of how the pump.io API currently works and if comments could be valuable in their own right (conclusion: they are).

The non-classy link table definitions should be classes and I've converted those.

Changed 8 years ago by Jessica Tallon

Attachment: new_models_r1.org added

comment:3 Changed 8 years ago by Jessica Tallon

Owner: set to Jessica Tallon
Status: newin_progress

comment:4 Changed 7 years ago by Jessica Tallon

Owner: Jessica Tallon deleted
Resolution: fixed
Status: in_progressclosed

Done, there were several commits about a month ago which more or less wrapped this up.

Note: See TracTickets for help on using tickets.