Categories
Mastering Development

Elixir: Looping through a map, comparing it to itself, and updating it

I have a map of a billiard ball table, as follows: ball_map = %{ "cue" => {"x":-15.0, "z": 0.0, "velocity_x": 0.0, "velocity_z": 0.0, "is_idle": true}, "ball_1" => {"x":15.0, "z": 0.0, "velocity_x": 0.0, "velocity_z": 0.0, "is_idle": true}, "ball_2" => {"x":17.0, "z": 1.1, "velocity_x": 0.0, "velocity_z": 0.0, "is_idle": true}, "ball_3" => {"x":17.0, "z": -1.1, "velocity_x": 0.0, "velocity_z": […]

Categories
Mastering Development

How to work around Django’s lack of composite keys in this complicated case?

I can’t seem to figure out how to work around the lack of composite keys in Django for the following case. I’m going to write the schema I’d like using SQLite3 dialect: PRAGMA foreign_keys = ON; CREATE TABLE A ( id_a INT PRIMARY KEY, name_a TEXT ) WITHOUT ROWID; CREATE TABLE B ( id_b INT […]