Faction cancels assault

Submitted by Brutus5000 on Sat, 07/23/2016 - 23:57

Abort battle and revert all transactions

Input data
  • <battle id>
  • <faction id>

Only the attacking faction is allowed to cancel the assault:

SELECT attacking_faction FROM battles WHERE id = <battle id> AND status = 'I'

ASSERT HAT attacking_faction = <faction id>

Database transaction

UPDATE battles SET status = 'C' AND endet_at = NOW()

DELETE FROM battle_participants WHERE fk_battle = <battle id>

DELECT FROM unit_transaction_details WHERE fk_unit_transation = (SELECT id FROM unit_transaction WHERE fk_battle = <battle id>)

DELETE FROM unit_transactions WHERE fk_battle = <battle id>

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.