Remove scheduled_notifications

All code has been removed for ScheduledNotifications. This PR just
removes the table, it has never been used.
This commit is contained in:
Rebecca Law
2021-06-07 09:36:41 +01:00
parent 29a13a8fae
commit 94c4a8f238
2 changed files with 32 additions and 10 deletions

View File

@@ -1776,16 +1776,6 @@ class NotificationHistory(db.Model, HistoryModel):
self.status = original.status
class ScheduledNotification(db.Model):
__tablename__ = 'scheduled_notifications'
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
notification_id = db.Column(UUID(as_uuid=True), db.ForeignKey('notifications.id'), index=True, nullable=False)
notification = db.relationship('Notification', uselist=False)
scheduled_for = db.Column(db.DateTime, index=False, nullable=False)
pending = db.Column(db.Boolean, nullable=False, default=True)
INVITE_PENDING = 'pending'
INVITE_ACCEPTED = 'accepted'
INVITE_CANCELLED = 'cancelled'

View File

@@ -0,0 +1,32 @@
"""
Revision ID: 0358_remove_sched_notifications
Revises: 0357_validate_constraint
Create Date: 2021-06-07 09:09:06.376862
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = '0358_remove_sched_notifications'
down_revision = '0357_validate_constraint'
def upgrade():
op.drop_index('ix_scheduled_notifications_notification_id', table_name='scheduled_notifications')
op.drop_table('scheduled_notifications')
def downgrade():
op.create_table('scheduled_notifications',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('notification_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('scheduled_for', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('pending', sa.BOOLEAN(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['notification_id'], ['notifications.id'],
name='scheduled_notifications_notification_id_fkey'),
sa.PrimaryKeyConstraint('id', name='scheduled_notifications_pkey')
)
op.create_index('ix_scheduled_notifications_notification_id', 'scheduled_notifications', ['notification_id'],
unique=False)