aboutsummaryrefslogtreecommitdiff
blob: 0eff797d8b57f87e3520ae25cb9ca6ede3515471 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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),
)
Powered by cgit v1.2.3 (git 2.41.0)