"""Add disabled_rules_sync_ts field to wordpress_site table.

Tracks when disabled-rules.php was last written for each site.
"""

from peewee import FloatField


def migrate(migrator, database, fake=False, **kwargs):
    WordpressSite = migrator.orm["wordpress_site"]
    migrator.add_fields(
        WordpressSite,
        disabled_rules_sync_ts=FloatField(null=True, default=None),
    )


def rollback(migrator, database, fake=False, **kwargs):
    WordpressSite = migrator.orm["wordpress_site"]
    migrator.remove_fields(WordpressSite, "disabled_rules_sync_ts")
