blob: 0eff797d8b57f87e3520ae25cb9ca6ede3515471 (
plain) (
tree)
|
|
import os
import sys
from playhouse.migrate import *
if os.getenv("DB_DRIVER") == "psql":
db = PostgresqlDatabase(os.getenv("DB_NAME"), user=os.getenv("DB_USER"), password=os.getenv("DB_PASS"),
host=os.getenv("DB_HOST"), port=os.getenv("DB_PORT"))
migrator = PostgresqlMigrator(db)
elif os.getenv("DB_DRIVER") == "sqlite3":
db = SqliteDatabase("database/photos.db")
migrator = SqliteMigrator(db)
else:
print("No DB_DRIVER specified")
sys.exit(1)
model = CharField(max_length=256, default="")
# Run the migration, specifying the database table, field name and field.
migrate(
migrator.add_column('photo', 'model', model),
)
|