File size: 780 Bytes
b7a7f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import TYPE_CHECKING

from sqlalchemy import Column, Integer, String, ForeignKey, ARRAY, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from core.db import Base


if TYPE_CHECKING:
    from .user import User  # noqa: F401
    from .course import Course  # noqa: F401


class PersonalNote(Base):
    id = Column(Integer, primary_key=True)
    last_updated_time = Column(DateTime, default=func.now(), onupdate=func.now())
    user_id = Column(Integer, ForeignKey("user.id", ondelete="cascade"))
    user = relationship("User", backref="personalnote", foreign_keys=[user_id])
    tags = Column(ARRAY(String(length=32)))
    title = Column(String(length=128))
    content = Column(String(length=32768))
    __tablename__ = "personalnote"