Skip to content
Snippets Groups Projects
Commit 2e44d01c authored by Ivan Procaccini's avatar Ivan Procaccini
Browse files

Feat: Add CLI command to populate db with dev data

parent 8a1ce984
No related branches found
No related tags found
No related merge requests found
......@@ -58,10 +58,10 @@ def create_app(test_configuration=None):
)
# Register CLI commands ####################################
from .cli import create_all, drop_all
from .cli import populate_dev, drop_all
with app.app_context():
app.cli.add_command(create_all)
app.cli.add_command(populate_dev)
app.cli.add_command(drop_all)
# Register blueprints ####################################
......
......@@ -2,12 +2,13 @@ import click
from flask.cli import with_appcontext
from .database import db
from .factories import ProjectFactory
@click.command("create_all", help="Create all tables in the app's database.")
@click.command("populate_dev", help="Create a few projects in the database.")
@with_appcontext
def create_all():
db.create_all()
def populate_dev():
ProjectFactory.create_batch(size=4, proposer="adumble")
@click.command("drop_all", help="Drop all tables in the specified database.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment