SQL structure
Closed this issue · 4 comments
Could I see an working example of what the SQL structure could be for each table in the example?
or just a list of columns for each table would help.
Hi, in example listed in docs for has many relation it will be
article
table:
id, title, banner, text, author_id
photo
table:
id, img_path, author_id
comments
table:
id, comment, author_id, external_id, type
where external_id
is id
of the record in either photo
or article
table
and type
is the type of entity to which current comment relates (photo or article)
it specified by polymorphicType
attribute in behavior configuration
Perfect. Totally makes sense now. Thank you.
For many-to-many would it be as follows:
taggable_tag
table:
id, tag_id, external_id, type
tag
table:
id, tag_name
article
table:
id, title, banner, text, author_id
photo
table:
id, img_path, author_id
yes, it's correct