Skip to content

Commit 9c2bb1c

Browse files
committed
makes prefix field optional
1 parent 5a19dbf commit 9c2bb1c

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""drops required constraint of prefix
2+
3+
Revision ID: 6b3a877ee8e4
4+
Revises: d8fb062b42d6
5+
Create Date: 2023-04-18 01:24:48.681012
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '6b3a877ee8e4'
14+
down_revision = 'd8fb062b42d6'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.alter_column('s3_file_metadata', 'prefix',
22+
existing_type=sa.VARCHAR(),
23+
nullable=True)
24+
# ### end Alembic commands ###
25+
26+
27+
def downgrade():
28+
# ### commands auto generated by Alembic - please adjust! ###
29+
op.alter_column('s3_file_metadata', 'prefix',
30+
existing_type=sa.VARCHAR(),
31+
nullable=False)
32+
# ### end Alembic commands ###

src/labs/models/s3.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
44
"""
5+
from typing import Optional
56
from uuid import uuid4
67
from datetime import timedelta
78
from typing import Union
@@ -54,8 +55,12 @@ class S3FileMetadata(
5455

5556
__tablename__ = "s3_file_metadata"
5657

58+
# This is the unique key for this object store in the associated bucket
59+
# which is automatically assigned to the metadata, you do not have to
60+
# worry about it simply deal with the wrapped methods provided by this class
5761
s3_key: Mapped[str]
58-
prefix: Mapped[str]
62+
# Prefix where you want the object to be stored e.g images, files
63+
prefix: Mapped[Optional[str]]
5964

6065
file_name: Mapped[str]
6166
file_size: Mapped[int]

0 commit comments

Comments
 (0)