from app import Story, Paragraph, db
|
|
from config import C
|
|
|
|
db.drop_all()
|
|
db.create_all()
|
|
|
|
for idx, (title, text, avatar) in zip(range(1, 11), C.BEGIN_WORDS):
|
|
s = Story(id=idx, title=title, text=text, tail=idx, is_tree=(idx == 10),
|
|
avatar="/ordinary/static/img/" + avatar)
|
|
p = Paragraph(id=idx, text=text, story_id=idx, is_chosen=True,
|
|
author="初始设定")
|
|
db.session.add(s)
|
|
db.session.add(p)
|
|
|
|
db.session.commit()
|