[DB] Fix Doctrine errors due to lack of column uniqueness
So, Doctrine doesn't like that `GSActorTag.tag` is not unique, even though composite key `[tagger, tag]` is. `tag` can't unique, but doctrine doesn't understand this. This seems like a Doctrine bug that should be investigated. For now we'll just not mark it as a foreign key
This commit is contained in:
parent
2e490756b9
commit
2174f288d1
@ -296,6 +296,9 @@ class GSActor extends Entity
|
|||||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||||
],
|
],
|
||||||
'primary key' => ['id'],
|
'primary key' => ['id'],
|
||||||
|
'unique keys' => [
|
||||||
|
'gsactor_nickname_uniq' => ['nickname'],
|
||||||
|
],
|
||||||
'indexes' => [
|
'indexes' => [
|
||||||
'gsactor_nickname_idx' => ['nickname'],
|
'gsactor_nickname_idx' => ['nickname'],
|
||||||
],
|
],
|
||||||
|
@ -133,7 +133,8 @@ class GSActorCircle extends Entity
|
|||||||
'description' => 'a gsactor can have lists of gsactors, to separate their timeline',
|
'description' => 'a gsactor can have lists of gsactors, to separate their timeline',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'tagger' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'many to one', 'name' => 'gsactor_list_tagger_fkey', 'not null' => true, 'description' => 'user making the tag'],
|
'tagger' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'many to one', 'name' => 'gsactor_list_tagger_fkey', 'not null' => true, 'description' => 'user making the tag'],
|
||||||
'tag' => ['type' => 'varchar', 'foreign key' => true, 'length' => 64, 'target' => 'GSActorTag.tag', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'gsactor tag'], // Join with GSActorTag
|
'tag' => ['type' => 'varchar', 'length' => 64 //, 'foreign key' => true, 'target' => 'GSActorTag.tag', 'multiplicity' => 'many to one' // so, Doctrine doesn't like that the target is not unique, even though the pair is
|
||||||
|
, 'not null' => true, 'description' => 'gsactor tag', ], // Join with GSActorTag
|
||||||
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
|
'description' => ['type' => 'text', 'description' => 'description of the people tag'],
|
||||||
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
|
'private' => ['type' => 'bool', 'default' => false, 'description' => 'is this tag private'],
|
||||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||||
|
@ -95,8 +95,9 @@ class GSActorTagFollow extends Entity
|
|||||||
return [
|
return [
|
||||||
'name' => 'gsactor_tag_follow',
|
'name' => 'gsactor_tag_follow',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'gsactor_tag' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActorTag.tag', 'multiplicity' => 'one to one', 'name' => 'gsactor_tag_follow_gsactor_tag_fkey', 'not null' => true, 'description' => 'foreign key to gsactor_tag'],
|
|
||||||
'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'name' => 'gsactor_tag_follow_gsactor_id_fkey', 'not null' => true, 'description' => 'foreign key to gsactor table'],
|
'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'name' => 'gsactor_tag_follow_gsactor_id_fkey', 'not null' => true, 'description' => 'foreign key to gsactor table'],
|
||||||
|
'gsactor_tag' => ['type' => 'int', // 'foreign key' => true, 'target' => 'GSActorTag.tag', 'multiplicity' => 'one to one', // tag can't unique, but doctrine doesn't understand this
|
||||||
|
'name' => 'gsactor_tag_follow_gsactor_tag_fkey', 'not null' => true, 'description' => 'foreign key to gsactor_tag', ],
|
||||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
'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'],
|
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user