Gregniuki commited on
Commit
fbb097f
1 Parent(s): c209774

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +16 -3
models.py CHANGED
@@ -1,5 +1,7 @@
1
- from sqlalchemy import Column, Integer, String, Boolean, ARRAY
2
- from sqlalchemy.ext.declarative import declarative_base
 
 
3
 
4
  Base = declarative_base()
5
 
@@ -14,5 +16,16 @@ class User(Base):
14
  selected_tts_models = Column(ARRAY(String), default=['default.onnx']) # Set the default value to 'default.onnx'
15
 
16
  # Define other user fields as needed
17
-
 
18
  # Define other database models as needed
 
 
 
 
 
 
 
 
 
 
 
1
+ from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
2
+ from sqlalchemy.orm import relationship
3
+ from sqlalchemy.sql import func
4
+ from .database import Base
5
 
6
  Base = declarative_base()
7
 
 
16
  selected_tts_models = Column(ARRAY(String), default=['default.onnx']) # Set the default value to 'default.onnx'
17
 
18
  # Define other user fields as needed
19
+ # Add the relationship with VerificationToken
20
+ verification_tokens = relationship("VerificationToken", back_populates="user")
21
  # Define other database models as needed
22
+ class VerificationToken(Base):
23
+ __tablename__ = "verification_tokens"
24
+
25
+ id = Column(Integer, primary_key=True, index=True)
26
+ token = Column(String, unique=True, index=True)
27
+ user_id = Column(Integer, ForeignKey('users.id'), nullable=False)
28
+ created_at = Column(DateTime(timezone=True), server_default=func.now())
29
+
30
+ # Define a relationship with the User model
31
+ user = relationship("User", back_populates="verification_tokens")