I have a many-to-many relationship between User & Role, with a role_user table. My migrations are setup as so (simplified): users table: public function up() { Schema::create(‘users’, …
Tag: foreign-key-relationship
How to Implement Referential Integrity in Subtypes
I have the following tables in a relational database: Basically, ReadingSwitch and ReadingValue are subtypes of Reading and SwitchSensor and AnalogSensor are subtypes of Sensor. A reading can either be a SwitchReading or ValueReading value – it cannot be both, and a Sensor can either be an AnalogSensor or a SwitchSensor. The only way I’ve come across to do this