card_starter_deck database model

This commit is contained in:
Ben 2020-03-03 00:56:18 +00:00
parent 922e817e8d
commit 646b9f0e4f
2 changed files with 60 additions and 25 deletions

View File

@ -161,6 +161,22 @@ COMMENT ON COLUMN card.color IS 'Card color';
COMMENT ON COLUMN card.value IS 'Value of card'; COMMENT ON COLUMN card.value IS 'Value of card';
COMMENT ON COLUMN card.description IS 'Play description'; COMMENT ON COLUMN card.description IS 'Play description';
DROP TABLE IF EXISTS card_starter_deck;
CREATE TABLE card_starter_deck (
item_id INT NOT NULL,
card_id INT NOT NULL,
quantity SMALLINT NOT NULL DEFAULT 1,
PRIMARY KEY (item_id, card_id),
CONSTRAINT card_starter_deck_ibfk_1 FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT card_starter_deck_ibfk_2 FOREIGN KEY (card_id) REFERENCES card(id) ON DELETE CASCADE ON UPDATE CASCADE
);
COMMENT ON TABLE card_starter_deck IS 'Jitsu card starter decks';
COMMENT ON COLUMN card_starter_deck.item_id IS 'Starter deck item ID';
COMMENT ON COLUMN card_starter_deck.card_id IS 'Starter deck card ID';
COMMENT ON COLUMN card_starter_deck.quantity IS 'Card quantity';
DROP TABLE IF EXISTS stamp_group; DROP TABLE IF EXISTS stamp_group;
CREATE TABLE stamp_group ( CREATE TABLE stamp_group (
id INT NOT NULL, id INT NOT NULL,
@ -7273,31 +7289,40 @@ INSERT INTO card (id, name, set_id, power_id, element, color, value, description
(803, 'Mobile Water 1', 8, 0, 'w', 'b', 8, ''), (803, 'Mobile Water 1', 8, 0, 'w', 'b', 8, ''),
(804, 'Mobile Fire Power Card 1', 8, 2, 'f', 'p', 11, 'When this is scored, your card gets +2 for the next round'); (804, 'Mobile Fire Power Card 1', 8, 2, 'f', 'p', 11, 'When this is scored, your card gets +2 for the next round');
INSERT INTO flooring (id, name, cost) VALUES INSERT INTO card_starter_deck (item_id, card_id, quantity) VALUES
(0, 'Floor Removal', 20), (821, 1, 1),
(1, 'Terracotta Tile', 680), (821, 6, 1),
(2, 'Maple Hardwood', 620), (821, 9, 1),
(3, 'Green Carpet', 530), (821, 14, 1),
(4, 'Burgundy Carpet', 530), (821, 17, 1),
(5, 'Black & White Tile', 510), (821, 20, 1),
(6, 'Linoleum', 540), (821, 22, 1),
(7, 'Dance Floor', 1000), (821, 23, 1),
(8, 'Painted Dance Steps', 280), (821, 26, 1),
(9, 'Bamboo Floor', 370), (821, 73, 1),
(10, 'Dirt & Leaves', 400), (821, 89, 1),
(11, 'Blue Turf', 530), (821, 81, 1),
(12, 'Whirlpool', 750), (8006, 3, 1),
(13, 'Cherry Hardwood', 620), (8006, 18, 1),
(14, 'Phony Lawn', 700), (8006, 216, 1),
(15, 'Black Carpet', 530), (8006, 222, 1),
(16, 'Dark Stone Tile', 800), (8006, 229, 1),
(17, 'Pink Carpet', 530), (8006, 303, 1),
(18, 'Sand Floor', 400), (8006, 304, 1),
(19, 'Sunny Sky Floor', 530), (8006, 314, 1),
(20, 'Cobblestone', 1200), (8006, 319, 1),
(21, 'Snowy Floor', 400), (8006, 250, 1),
(22, 'Lime Green Carpet', 530), (8006, 352, 1),
(23, 'Woven Rice Mat', 750); (8010, 202, 1),
(8010, 204, 1),
(8010, 305, 1),
(8010, 15, 1),
(8010, 13, 1),
(8010, 312, 1),
(8010, 218, 1),
(8010, 220, 1),
(8010, 29, 1),
(8010, 90, 1);
INSERT INTO flooring (id, name, cost, patched, legacy_inventory, vanilla_inventory) VALUES INSERT INTO flooring (id, name, cost, patched, legacy_inventory, vanilla_inventory) VALUES
(0, 'Floor Removal', 20, FALSE, FALSE, FALSE), (0, 'Floor Removal', 20, FALSE, FALSE, FALSE),

View File

@ -14,6 +14,16 @@ class Card(db.Model):
description = db.Column(db.String(255), nullable=False, server_default=db.text("''::character varying")) description = db.Column(db.String(255), nullable=False, server_default=db.text("''::character varying"))
class CardStarterDeck(db.Model):
__tablename__ = 'card_starter_deck'
item_id = db.Column(db.ForeignKey('item.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
nullable=False, index=True)
card_id = db.Column(db.ForeignKey('card.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
nullable=False)
quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1"))
class PenguinCard(db.Model): class PenguinCard(db.Model):
__tablename__ = 'penguin_card' __tablename__ = 'penguin_card'