aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-03-10 20:29:16 -0800
committerclarkzjw <[email protected]>2023-03-10 20:29:16 -0800
commit8332a935ab85c451a7481b05b9709bcd466dbe01 (patch)
tree2ce45347f1836882a098958cb9699b9b6f6111e9 /bot/migrations/0001-add_exif.py
parent15ed2a825c760b3ae946d8b7a57a063f8bf393c9 (diff)
downloadphoto-8332a935ab85c451a7481b05b9709bcd466dbe01.tar.gz
add caption and exif
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)