From 0b2f4bcceaea37c56739d2927d81e3a29773eae2 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 18 Mar 2019 15:49:46 +0000 Subject: [PATCH] New buddy list data model --- Houdini/Data/Buddy.py | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Houdini/Data/Buddy.py diff --git a/Houdini/Data/Buddy.py b/Houdini/Data/Buddy.py new file mode 100644 index 0000000..1ebdc98 --- /dev/null +++ b/Houdini/Data/Buddy.py @@ -0,0 +1,47 @@ +from Houdini.Data import db + + +class BuddyList(db.Model): + __tablename__ = 'buddy_list' + + PenguinID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False) + BuddyID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False, index=True) + BestBuddy = db.Column(db.Boolean, nullable=False, server_default=db.text("false")) + + +t_buddy_request = db.Table( + 'buddy_request', db, + db.Column('PenguinID', db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False), + db.Column('RequesterID', db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False) +) + + +t_ignore_list = db.Table( + 'ignore_list', db, + db.Column('PenguinID', db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False), + db.Column('IgnoreID', db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False, index=True) +) + + +class Character(db.Model): + __tablename__ = 'character' + + ID = db.Column(db.Integer, primary_key=True) + Name = db.Column(db.String(30), nullable=False) + GiftID = db.Column(db.ForeignKey('item.ID', ondelete='CASCADE', onupdate='CASCADE')) + StampID = db.Column(db.ForeignKey('stamp.ID', ondelete='CASCADE', onupdate='CASCADE')) + + +t_character_buddy = db.Table( + 'character_buddy', db, + db.Column('PenguinID', db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False), + db.Column('CharacterID', db.ForeignKey('character.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False) +) \ No newline at end of file