simon-brooke / youyesyet

Web-app to support canvassers in the forthcoming independence referendum in Scotland
GNU General Public License v2.0
3 stars 0 forks source link

Dwelling table #41

Closed simon-brooke closed 7 years ago

simon-brooke commented 7 years ago

From the start I've been aware of the issue of blocks of flats and tenements - multiple dwellings in a single building - and the necessity of representing them in the UI. But nothing in the present database schema supports this functionality.

We need a table which represents a building. The present address table more accurately represents a household, although whether there's a need to rename the table is debatable. But for orthogonality, there must be a one-to-one-or-many relationship between buildings and addresses/households, and for orthogonality each address/household should be assigned to a building, even if it is the only address/household in that building.

simon-brooke commented 7 years ago

OK, decided to reframe this slightly. The existing address table takes the place of the proposed building table, and the new table introduced is the dwelling table. There is a one-to-one-or-many relationship between addresses and dwellings, and one-to-one-or-many relationship between dwellings and electors.

Where an address comprises only one dwelling (true of most homes with their own street door, there is nevertheless a dwelling record.