Total Complexity | 0 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | """Provides Upload status models |
||
2 | """ |
||
3 | 1 | from datetime import datetime |
|
4 | 1 | from sqlalchemy import Column, String, DateTime |
|
5 | 1 | from sqlalchemy.ext.declarative import declarative_base |
|
6 | 1 | from sqlalchemy.dialects.mysql import INTEGER |
|
7 | 1 | from sqlalchemy.sql.functions import current_timestamp |
|
8 | |||
9 | 1 | Base = declarative_base() |
|
10 | |||
11 | |||
12 | 1 | class UploadedFilesModel(Base): |
|
13 | """Create Uploaded Files Model |
||
14 | """ |
||
15 | |||
16 | 1 | __tablename__ = "uploaded_files" |
|
17 | |||
18 | 1 | id = Column("id", INTEGER(unsigned=True), primary_key=True, autoincrement=True) |
|
19 | 1 | name = Column("name", String(64), index=True) |
|
20 | 1 | file_path = Column("file_path", String(255), index=True, unique=True) |
|
21 | 1 | file_type = Column("file_type", String(64)) |
|
22 | 1 | last_index = Column("last_index", INTEGER(unsigned=True), nullable=False) |
|
23 | 1 | created_at = Column( |
|
24 | "created_at", |
||
25 | DateTime, |
||
26 | default=datetime.now(), |
||
27 | server_default=current_timestamp(), |
||
28 | nullable=False, |
||
29 | ) |
||
30 | 1 | updated_at = Column( |
|
31 | "updated_at", |
||
32 | DateTime, |
||
33 | default=datetime.now(), |
||
34 | onupdate=datetime.now(), |
||
35 | nullable=False, |
||
36 | ) |
||
37 |