)]}'
{"ironic/db/sqlalchemy/models.py":[{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"1db502650367f2cab07cbe71a82f8e6bd5e47fd5","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    )"},{"line_number":111,"context_line":"    node_id \u003d Column(Integer, ForeignKey(\u0027nodes.id\u0027), primary_key\u003dTrue,"},{"line_number":112,"context_line":"                     nullable\u003dFalse)"},{"line_number":113,"context_line":"    key \u003d Column(String(255), nullable\u003dFalse, primary_key\u003dTrue)"},{"line_number":114,"context_line":"    value \u003d Column(db_types.JsonEncodedType, nullable\u003dTrue)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9a8ffd7b_707697d8","line":113,"updated":"2015-12-02 17:50:29.000000000","message":"\"key\" is a reserved word in SQL, and should be avoided as a column name as a matter of convention, even though this will technically work. I suggest \"property\" as the column name, which incidentally also matches the table name :)\n\nAlso, the primary key should not contain a VARCHAR field.\n\nMany Nodes will have the same properties; storing each property as a VARCHAR is not normalized. Instead, we should have a separate table for properties, and a cross-join table here.\n\nSo I suggest this:\n\n\"properties\" (id INT PRIMARY KEY, property VARCHAR, UNIQUE(property))\n\n\"node_properties\" (node_id INT, property_id INT, PRIMARY KEY (node_id, property_id), INDEX (property_id))","commit_id":"7e5a87455e4190eae7bbbdb7529f47fd954fdce1"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"2c101315ae9a4f2688e3e2a4dc26c5a41335e55b","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    node_id \u003d Column(Integer, ForeignKey(\u0027nodes.id\u0027), primary_key\u003dTrue,"},{"line_number":112,"context_line":"                     nullable\u003dFalse)"},{"line_number":113,"context_line":"    key \u003d Column(String(255), nullable\u003dFalse, primary_key\u003dTrue)"},{"line_number":114,"context_line":"    value \u003d Column(db_types.JsonEncodedType, nullable\u003dTrue)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"class Node(Base):"}],"source_content_type":"text/x-python","patch_set":1,"id":"9a8ffd7b_93e465e0","line":114,"updated":"2015-12-02 17:54:42.000000000","message":"We\u0027ll want to add a prefix index on \u0027value\u0027 to enable searching, eg,\n\n  SELECT node_id WHERE\n    property_id\u003d(SELECT id FROM properties WHERE property\u003d\u0027cpu_arch\u0027) AND\n    value \u003d \u0027x86_64\u0027\n\nStoring value as a JsonEncodedType will prevent this optimization, however, I see why it\u0027s necessary to handle nested dicts.\n\nHrmm...","commit_id":"7e5a87455e4190eae7bbbdb7529f47fd954fdce1"}]}
