from typing import Text
from sqlalchemy import Column,Integer,String,ForeignKey,Boolean
# from sqlalchemy.sql.schema import ForeignKey
from .database import Base
from sqlalchemy.orm import relationship

class Blog(Base):
    __tablename__ = 'blog'
    id = Column(Integer,primary_key=True,index=True)
    title = Column(String)
    body = Column(String)
    user_id = Column(Integer,ForeignKey('User.id'))

    creator = relationship('User',back_populates='blogs')

class User(Base):
    __tablename__ = 'User'
    id = Column(Integer,primary_key=True,index=True)
    username = Column(String)
    password = Column(String)
    email = Column(String)

    blogs = relationship('Blog',back_populates='creator')



