-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdb_models.py
More file actions
31 lines (22 loc) · 868 Bytes
/
db_models.py
File metadata and controls
31 lines (22 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
This program is free software: you can redistribute it under the terms
of the GNU General Public License, v. 3.0. If a copy of the GNU General
Public License was not distributed with this file, see <https://www.gnu.org/licenses/>.
"""
import datetime
from peewee import Model, CharField, DateTimeField
from db import connect
database = connect()
class Publications(Model):
"""Model representing the Publications Table."""
country_code = CharField(null=True)
platform_name = CharField()
source = CharField()
status = CharField()
gateway_client = CharField(null=True)
date_created = DateTimeField(default=datetime.datetime.now)
class Meta:
"""Meta class to define database connection and table name."""
database = database
table_name = "publications"
database.create_tables([Publications], safe=True)