Skip to content

Commit

Permalink
Election Day: Remove obsolete table and migration command.
Browse files Browse the repository at this point in the history
LINK: OGC-1478
  • Loading branch information
msom authored Apr 17, 2024
1 parent ebd814e commit 1dea349
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 56 deletions.
38 changes: 0 additions & 38 deletions src/onegov/ballot/models/election_compound/association.py

This file was deleted.

6 changes: 6 additions & 0 deletions src/onegov/ballot/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,3 +882,9 @@ def add_compound_id_to_elections(context: UpgradeContext) -> None:
nullable=True
)
)


@upgrade_task('Drop election compound assocations')
def drop_election_compound_assocations(context: UpgradeContext) -> None:
if context.has_table('election_compound_associations'):
context.operations.drop_table('election_compound_associations')
18 changes: 0 additions & 18 deletions src/onegov/election_day/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import click
import os

from onegov.ballot.models import Election
from onegov.ballot.models.election_compound.association import \
ElectionCompoundAssociation
from onegov.core.cli import abort
from onegov.core.cli import command_group
from onegov.core.cli import pass_group_context
Expand Down Expand Up @@ -204,18 +201,3 @@ def generate(request: 'ElectionDayRequest', app: 'ElectionDayApp') -> None:
archive.update_all(request)

return generate


# todo: remove me after migration
@cli.command('migrate-election-compounds')
def migrate_election_compounds() -> 'Processor':
def migrate(request: 'ElectionDayRequest', app: 'ElectionDayApp') -> None:
click.secho(f'Updating {app.schema}', fg='yellow')
session = request.session
for association in session.query(ElectionCompoundAssociation):
election = session.query(Election).filter_by(
id=association.election_id
).one()
election.election_compound_id = association.election_compound_id

return migrate

0 comments on commit 1dea349

Please sign in to comment.