Skip to content

Commit

Permalink
Create file.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH committed May 11, 2024
1 parent 400f33a commit 914f686
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/models/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# File model
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship

Base = declarative_base()

class File(Base):
__tablename__ = 'files'
id = Column(Integer, primary_key=True)
name = Column(String)
content = Column(String)
user_id = Column(Integer, ForeignKey('users.id'))
user = relationship('User', backref='files')

def __init__(self, name, content, user):
self.name = name
self.content = content
self.user = user

0 comments on commit 914f686

Please sign in to comment.