mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 15:10:01 +00:00
Patch db_migrate.py to always use the 'db' command
This means you can (have to) use the Flask-Migrate commands directly: "./db_migrate.py stamp head" etc instead of "./db_migrate.py db stamp head"
This commit is contained in:
parent
2d04cf3525
commit
79dae38f37
|
@ -55,6 +55,6 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if database_empty:
|
if database_empty:
|
||||||
print('Remember to run the following to mark the database up-to-date for Alembic:')
|
print('Remember to run the following to mark the database up-to-date for Alembic:')
|
||||||
print('./db_migrate.py db stamp head')
|
print('./db_migrate.py stamp head')
|
||||||
# Technically we should be able to do this here, but when you have
|
# Technically we should be able to do this here, but when you have
|
||||||
# Flask-Migrate and Flask-SQA and everything... I didn't get it working.
|
# Flask-Migrate and Flask-SQA and everything... I didn't get it working.
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
from nyaa import app, db
|
from nyaa import app, db
|
||||||
from flask_script import Manager
|
from flask_script import Manager
|
||||||
from flask_migrate import Migrate, MigrateCommand
|
from flask_migrate import Migrate, MigrateCommand
|
||||||
|
@ -10,4 +11,12 @@ manager = Manager(app)
|
||||||
manager.add_command("db", MigrateCommand)
|
manager.add_command("db", MigrateCommand)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
# Patch sys.argv to default to 'db'
|
||||||
|
argv_contents = sys.argv[:]
|
||||||
|
|
||||||
|
sys.argv.clear()
|
||||||
|
sys.argv.append(argv_contents[0])
|
||||||
|
sys.argv.append('db')
|
||||||
|
sys.argv.extend(argv_contents[1:])
|
||||||
|
|
||||||
manager.run()
|
manager.run()
|
||||||
|
|
Loading…
Reference in a new issue