Created
March 29, 2018 13:51
-
-
Save andrejewski/0e6544c4fc722976ce130038eef08e55 to your computer and use it in GitHub Desktop.
Scratch of how to solve the polymorphic association problem generically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| select table_name | |
| from information_schema.tables | |
| where table_type = 'BASE TABLE' and table_schema = 'public'; | |
| resources { | |
| id serial primary key, | |
| type text not null | |
| } | |
| comments { | |
| id integer primary key references resources (id), | |
| parent_id integer not null references resources (id), | |
| root_id integer references comments (id), | |
| content text not null | |
| } | |
| tags { | |
| id integer primary key references resources (id), | |
| parent_id integer not null references resources (id), | |
| name text not null | |
| } | |
| audits { | |
| id integer primary key references resources (id), | |
| target_id integer not null references resources (id), | |
| actor_id integer not null references users (id), | |
| action_type text not null, | |
| action_data jsonb not null, | |
| ip_address text not null | |
| } | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment