PLJean / django-flashcard

Flash card web app for memorization implemented in Django, Javascript, and jQuery
18 stars 3 forks source link

Ship with a default database #17

Open cshaley opened 7 years ago

cshaley commented 7 years ago

This is a really great idea for a simple django application. But getting started is difficult because it doesn't come with a default database or a script to setup the database.

I think it should ship with a sqlite3 database with one or more sample flashcard sets already installed. Something like the below to generate the db, except with additional table creation constraints like primary key and foreign key.

import sqlite3
conn = sqlite3.connect('db.sqlite3')
cursor = conn.cursor()
cursor.execute("CREATE TABLE flashcard_set(id integer PRIMARY KEY, name text, color text);"
cursor.execute("CREATE TABLE flashcard_card(id integer, set_id text, front text, back text);")
PLJean commented 7 years ago

That's a pretty good idea, and I'm going to implement this in the next couple of days. Thanks for the starter code. Now that I think of it, a default database seems like the obvious thing to do. Thanks Charlie!