[DB] Change foreign key specification to new format
This commit is contained in:
@@ -256,28 +256,21 @@ class Note extends Entity
|
||||
return [
|
||||
'name' => 'note',
|
||||
'fields' => [
|
||||
'id' => ['type' => 'serial', 'not null' => true],
|
||||
'gsactor_id' => ['type' => 'int', 'not null' => true, 'description' => 'who made the note'],
|
||||
'content' => ['type' => 'text', 'description' => 'note content'],
|
||||
'rendered' => ['type' => 'text', 'description' => 'rendered note content if not local, so we can keep the microtags'],
|
||||
'reply_to' => ['type' => 'int', 'description' => 'note replied to, null if root of a conversation'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'was this note generated by a local actor'],
|
||||
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'source of note, like "web", "im", or "clientname"'],
|
||||
'conversation' => ['type' => 'int', 'description' => 'the local conversation id'],
|
||||
'repeat_of' => ['type' => 'int', 'description' => 'note this is a repeat of'],
|
||||
'scope' => ['type' => 'int', 'not null' => true, 'default' => NoteScope::PUBLIC, 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = followers; 16 = messages; null = default'],
|
||||
'id' => ['type' => 'serial', 'not null' => true],
|
||||
'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'mutiplicity' => 'one to one', 'not null' => true, 'description' => 'who made the note'],
|
||||
'content' => ['type' => 'text', 'description' => 'note content'],
|
||||
'rendered' => ['type' => 'text', 'description' => 'rendered note content, so we can keep the microtags (if not local)'],
|
||||
'reply_to' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'mutiplicity' => 'one to one', 'description' => 'note replied to, null if root of a conversation'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'was this note generated by a local actor'],
|
||||
'source' => ['type' => 'varchar', 'foreign key' => true, 'length' => 32, 'target' => 'NoteSource.source', 'mutiplicity' => 'one to one', 'description' => 'fkey to source of note, like "web", "im", or "clientname"'],
|
||||
'conversation' => ['type' => 'int', 'foreign key' => true, 'target' => 'Conversation.id', 'mutiplicity' => 'one to one', 'description' => 'the local conversation id'],
|
||||
'repeat_of' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'mutiplicity' => 'one to one', 'description' => 'note this is a repeat of'],
|
||||
'scope' => ['type' => 'int', 'not null' => true, 'default' => NoteScope::PUBLIC, 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = followers; 16 = messages; null = default'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||
],
|
||||
'primary key' => ['id'],
|
||||
'foreign keys' => [
|
||||
'note_gsactor_id_fkey' => ['gsactor', ['gsactor_id' => 'id']],
|
||||
'note_reply_to_fkey' => ['note', ['reply_to' => 'id']],
|
||||
'note_note_source_fkey' => ['note_source', ['source' => 'code']],
|
||||
'note_conversation_fkey' => ['conversation', ['conversation' => 'id']],
|
||||
'note_repeat_of_fkey' => ['note', ['repeat_of' => 'id']],
|
||||
],
|
||||
'indexes' => [
|
||||
'primary key' => ['id'],
|
||||
'indexes' => [
|
||||
'note_created_id_is_local_idx' => ['created', 'is_local'],
|
||||
'note_gsactor_created_idx' => ['gsactor_id', 'created'],
|
||||
'note_is_local_created_gsactor_idx' => ['is_local', 'created', 'gsactor_id'],
|
||||
|
Reference in New Issue
Block a user