Ghetto migrate solution, in case you re-run db_create, it won't add categories again

This commit is contained in:
Yara Naika 2017-05-13 23:51:29 -07:00
parent 3bdff6246f
commit b147cfeb81
1 changed files with 26 additions and 25 deletions

View File

@ -5,8 +5,9 @@ from nyaa import app, db, models
db.create_all()
# Insert categories
# Insert categories and insert if it doesn't eixst
existing_cats = models.MainCategory.query.all()
if not existing_cats:
if app.config['SITE_FLAVOR'] == 'nyaa':
CATEGORIES = [
('Anime', ['Anime Music Video', 'English-translated', 'Non-English-translated', 'Raw']),