aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bot/migrations/0001-add_exif.py')
-rw-r--r--bot/migrations/0001-add_exif.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/bot/migrations/0001-add_exif.py b/bot/migrations/0001-add_exif.py
new file mode 100644
index 0000000..0eff797
--- /dev/null
+++ b/bot/migrations/0001-add_exif.py
@@ -0,0 +1,22 @@
1import os
2import sys
3from playhouse.migrate import *
4
5
6if os.getenv("DB_DRIVER") == "psql":
7 db = PostgresqlDatabase(os.getenv("DB_NAME"), user=os.getenv("DB_USER"), password=os.getenv("DB_PASS"),
8 host=os.getenv("DB_HOST"), port=os.getenv("DB_PORT"))
9 migrator = PostgresqlMigrator(db)
10elif os.getenv("DB_DRIVER") == "sqlite3":
11 db = SqliteDatabase("database/photos.db")
12 migrator = SqliteMigrator(db)
13else:
14 print("No DB_DRIVER specified")
15 sys.exit(1)
16
17model = CharField(max_length=256, default="")
18
19# Run the migration, specifying the database table, field name and field.
20migrate(
21 migrator.add_column('photo', 'model', model),
22)
Powered by cgit v1.2.3 (git 2.41.0)