mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-09 17:20:17 +00:00
Made some changes to naming in both the classes and the tables of the database to conform the correct naming scheme
This commit is contained in:
parent
7e29a590a2
commit
32b8a58c3a
@@ -8,7 +8,7 @@ from ..database import Base
|
||||
|
||||
|
||||
class Entry(Base):
|
||||
__tablename__ = "Entry"
|
||||
__tablename__ = "entries"
|
||||
id = Column(Integer, primary_key=True)
|
||||
title = Column(String)
|
||||
text = Column(String)
|
||||
@@ -17,12 +17,10 @@ class Entry(Base):
|
||||
"Photo",
|
||||
secondary=photo_entry_association,
|
||||
back_populates="entries")
|
||||
fk_TravelDiary_id = Column(Integer, ForeignKey("TravelDiary.id"))
|
||||
fk_travel_diary_id = Column(Integer, ForeignKey("travel_diaries.id"))
|
||||
def __init__(self, title: str, text: str, date: str, travel_diary_id: int, **kw: Any):
|
||||
super().__init__(**kw)
|
||||
self.title = title
|
||||
self.text = text
|
||||
self.date = date
|
||||
self.fk_TravelDiary_id = travel_diary_id
|
||||
|
||||
|
||||
self.fk_travel_diary_id = travel_diary_id
|
||||
|
||||
@@ -8,17 +8,18 @@ from ..database import Base
|
||||
|
||||
|
||||
class Photo(Base):
|
||||
__tablename__ = "photo"
|
||||
__tablename__ = "photos"
|
||||
id = Column(Integer, primary_key=True)
|
||||
filepath = Column(String)
|
||||
name = Column(String)
|
||||
addition_date = Column(String)
|
||||
caption = Column(String)
|
||||
entries:relationship = relationship(
|
||||
entries = relationship(
|
||||
"Entry",
|
||||
secondary=photo_entry_association,
|
||||
back_populates="photos"
|
||||
)
|
||||
|
||||
def __init__(self, filepath, name, addition_date=None, caption=None, entries=None, **kw: Any):
|
||||
super().__init__(**kw)
|
||||
self.filepath = filepath
|
||||
@@ -26,4 +27,3 @@ class Photo(Base):
|
||||
self.addition_date = addition_date
|
||||
self.caption = caption
|
||||
self.entries = entries
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ from ..database import Base
|
||||
|
||||
photo_entry_association = Table('photo_entry_association', Base.metadata,
|
||||
Column('id', Integer, primary_key=True, autoincrement=True),
|
||||
Column('fk_Photo_id', Integer, ForeignKey('photo.id')),
|
||||
Column('fk_Entry_id', Integer, ForeignKey('Entry.id')))
|
||||
Column('fk_photo_id', Integer, ForeignKey('photos.id')),
|
||||
Column('fk_entry_id', Integer, ForeignKey('entries.id')))
|
||||
|
||||
@@ -5,7 +5,7 @@ from sqlalchemy import Column, String, Integer
|
||||
from ..database import Base
|
||||
|
||||
class TravelDiary(Base):
|
||||
__tablename__ = "TravelDiary"
|
||||
__tablename__ = "travel_diaries"
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user