migrate from supabase to postgres
This commit is contained in:
+8
-9
@@ -1,19 +1,18 @@
|
||||
from pydantic import BaseModel
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
import json
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from infra.db.base import Base
|
||||
|
||||
class DiscordNoiTu(BaseModel):
|
||||
id: Optional[int] = None
|
||||
word: str
|
||||
meaning: Optional[str] = None
|
||||
class DiscordNoiTu(Base):
|
||||
__tablename__ = "dictionary_vietnamese_two_words"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
word = Column(String(255), nullable=False, unique=True)
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'word': self.word,
|
||||
'meaning': self.meaning,
|
||||
}
|
||||
|
||||
def to_json(self):
|
||||
import json
|
||||
return json.dumps(self.to_dict())
|
||||
Reference in New Issue
Block a user