-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActivityPub: Sprint 2 #3216
base: dev
Are you sure you want to change the base?
ActivityPub: Sprint 2 #3216
Conversation
@benwerd The following describes the Annotations schema, and what I've considered: CREATE TABLE IF NOT EXISTS `annotations` (
`uuid` varchar(255) NOT NULL,
`_id` varchar(36) NOT NULL,
`siteid` varchar(36),
`owner` varchar(255) NOT NULL,
`entity_subtype` varchar(64) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`contents` longblob NOT NULL,
`publish_status` varchar(255) NOT NULL DEFAULT 'published',
`entity_id` varchar(255) NOT NULL,
`parent_id` varchar(255),
PRIMARY KEY (`uuid`),
UNIQUE KEY `_id` (`_id`),
KEY `siteid` (`siteid`),
FOREIGN KEY (owner) REFERENCES entities(uuid),
KEY `entity_subtype` (`entity_subtype`),
KEY `publish_status` (`publish_status`),
FOREIGN KEY (entity_id) REFERENCES entities(uuid),
FOREIGN KEY (parent_id) REFERENCES annotations(uuid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; A migration script (stored procedure), would iterate each Entity row containing a (JSON) I'm proposing 2 new columns here, Where an Annotation originates from a remote site (webmentions, activitypub), I would create a new Any thoughts, concerns, suggestions? |
@mediaformat I think this looks great, and I very much see the need to make this migration. But I do have a big caveat: Because not everyone is using the same database engine, I don't think migration should be a stored procedure. Or we should test the stored procedure for each of MySQL and Postgres, and create a command line tool for SQLite and MongoDB. I think, actually, the latter is preferable. It's imperative that the revised annotations methods use the database abstraction layer (presumably adding inherited methods for each db engine) rather than going straight to the SQL. So here's what I'd suggest:
Does that seem reasonable? |
@benwerd Totally reasonable! |
@@ -2670,6 +2671,12 @@ function getAnnotationSubtype($uuid) | |||
*/ | |||
function getAnnotation($uuid) | |||
{ | |||
// Prioritize Annotation methods | |||
$annotation = Annotation::getByUUID($uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overriding the internals here allow us to keep using the same getAnnotation()
calls used in templates.
*/ | ||
static function getFromX($class, $search = array(), $fields = array(), $limit = 10, $offset = 0, $readGroups = []) | ||
{ | ||
$result = \Idno\Core\Idno::site()->db()->getObject($search['uuid'], static::$retrieve_collection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result here is a different object than was previously received, notably missing are the owner_name
, owner_url
, owner_image
.
I think it would make sense to use JOIN
s here to recreate the expected structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benwerd Started on the Annotation methods, appreciate any early feedback.
ActivityPub: Sprint 2
http-foundation
Request methods for use withlandrok/activitypub
Other
parseURLs
closureHere's why I did it:
Checklist: