Add best_buddy column to character_buddies table

This commit is contained in:
Ben 2019-08-19 02:17:14 +01:00
parent abaa5234d9
commit c7a2dafae9
2 changed files with 3 additions and 1 deletions

View File

@ -735,6 +735,7 @@ DROP TABLE IF EXISTS character_buddy;
CREATE TABLE character_buddy (
penguin_id INT NOT NULL,
character_id SMALLINT NOT NULL,
best_buddy BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (penguin_id, character_id),
CONSTRAINT character_buddy_ibfk_1 FOREIGN KEY (penguin_id) REFERENCES penguin (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT character_buddy_ibfk_2 FOREIGN KEY (character_id) REFERENCES character (id) ON DELETE CASCADE ON UPDATE CASCADE

View File

@ -41,4 +41,5 @@ class CharacterBuddy(db.Model):
penguin_id = db.Column(db.ForeignKey('penguin.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
nullable=False)
character_id = db.Column(db.ForeignKey('character.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
nullable=False)
nullable=False)
best_buddy = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))