gitenberg-dev / giten_site

django repo for running the GITenberg website
http://www.gitenberg.org
40 stars 5 forks source link

update Django data model to reflect the new database schema #60

Closed bdr99 closed 6 years ago

bdr99 commented 6 years ago

This PR implements the new data model that we have designed for the website. There are separate tables for books, authors, covers, and external links. This will allow us to implement some of our planned features such as "Other Books By This Author".

eshellman commented 6 years ago

looks good. you could write a data migration that pulls data out of yaml and into the new fields - or is there another plan for data loading?

bdr99 commented 6 years ago

@eshellman Our plan for data loading is to create a URL endpoint that takes in the information for a new or updated book (via an HTTP POST request) and adds it to the database. The backend component would post books to this URL endpoint as they are retrieved from the queuing system.

eshellman commented 6 years ago

Plan sounds good. A data migration is probably not what you want. But an django management command that moves data from yaml to the new db fields could be useful. (the make_yaml management command is how the data got there in the first place)

  1. it would immediately populate this fields on production, allowing us to see how the new searches work. The sooner you start working with real data, the sooner you discover bugs and other things that you want to change.
  2. it might be useful in the future for data synching.
bdr99 commented 6 years ago

We addressed this as part of https://github.com/gitenberg-dev/giten_site/pull/62, so this should be ready to be merged now.

eshellman commented 6 years ago

OK, let me try this in my environment

eshellman commented 6 years ago

I think you're trying to duplicate what the django ORM already does. Book.book_id is there to have a place to put the gutenberg book number, not to be the primary key for the book table.