[DB] Change foreign key specification to new format

This commit is contained in:
2021-02-22 21:34:59 +00:00
parent ea0aca4b00
commit 1712782cc5
33 changed files with 195 additions and 293 deletions

View File

@@ -83,16 +83,12 @@ class FileToNote extends Entity
return [
'name' => 'file_to_note',
'fields' => [
'file_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of file'],
'note_id' => ['type' => 'int', 'not null' => true, 'description' => 'id of the note it belongs to'],
'file_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'File.id', 'mutiplicity' => 'one to one', 'name' => 'file_to_note_file_id_fkey', 'not null' => true, 'description' => 'id of file'],
'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'mutiplicity' => 'one to one', 'name' => 'file_to_note_note_id_fkey', 'not null' => true, 'description' => 'id of the note it belongs to'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['file_id', 'note_id'],
'foreign keys' => [
'file_to_note_file_id_fkey' => ['file', ['file_id' => 'id']],
'file_to_note_note_id_fkey' => ['note', ['note_id' => 'id']],
],
'indexes' => [
'primary key' => ['file_id', 'note_id'],
'indexes' => [
'file_id_idx' => ['file_id'],
'note_id_idx' => ['note_id'],
],