from sqlalchemy import ForeignKey, PrimaryKeyConstraint

from app.extensions.db import db

class Subscriptions(db.Model):
    chat_id = db.Column(db.Integer, ForeignKey('users.chat_id', ondelete='CASCADE'), nullable=False) #Добавляем внешний ключ с ondelete
    region_id = db.Column(db.Integer, nullable=False)
    active = db.Column(db.Boolean, default=True)
    skip = db.Column(db.Boolean, default=False)
    disaster_only = db.Column(db.Boolean, default=False)
    __table_args__ = (
        PrimaryKeyConstraint('chat_id', 'region_id'),
    )