# accounting_run

## Description

<details>
<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE `accounting_run` (
  `accounting_run_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
  `accounting_period_id` smallint unsigned NOT NULL,
  `run_controller_id` mediumint unsigned NOT NULL,
  `run_status` enum('No Action Taken','Waiting to Run','Running','Error','Complete','Invalid','Committing','Committed','Skipped','Sent to Workstation','Export Payments') COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'No Action Taken',
  `start_date` datetime DEFAULT NULL,
  `end_date` datetime DEFAULT NULL,
  `summary_export_url` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `created_by` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `last_modified_by` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `last_modified` datetime NOT NULL,
  PRIMARY KEY (`accounting_run_id`),
  KEY `idx_acct_period_id` (`accounting_period_id`),
  KEY `idx_run_ctrl_id` (`run_controller_id`),
  CONSTRAINT `fk_acc_run_run_ctrl` FOREIGN KEY (`run_controller_id`) REFERENCES `run_controller` (`run_controller_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_acct_run_acct_period` FOREIGN KEY (`accounting_period_id`) REFERENCES `accounting_period` (`accounting_period_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=[Redacted by tbls] DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
```

</details>

## Columns

| Name                 | Type                                                                                                                                                       | Default         | Nullable | Extra Definition | Children                                                                                                                                                                    | Parents                                   | Comment |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | ------- |
| accounting_period_id | smallint unsigned                                                                                                                                          |                 | false    |                  |                                                                                                                                                                             | [accounting_period](accounting_period.md) |         |
| accounting_run_id    | mediumint unsigned                                                                                                                                         |                 | false    | auto_increment   | [ledger_accounting_run_balance](ledger_accounting_run_balance.md) [ledger_accounting_run_vat](ledger_accounting_run_vat.md) [ledger_reserve_taken](ledger_reserve_taken.md) |                                           |         |
| created_at           | datetime                                                                                                                                                   |                 | false    |                  |                                                                                                                                                                             |                                           |         |
| created_by           | varchar(255)                                                                                                                                               |                 | false    |                  |                                                                                                                                                                             |                                           |         |
| end_date             | datetime                                                                                                                                                   |                 | true     |                  |                                                                                                                                                                             |                                           |         |
| last_modified        | datetime                                                                                                                                                   |                 | false    |                  |                                                                                                                                                                             |                                           |         |
| last_modified_by     | varchar(255)                                                                                                                                               |                 | false    |                  |                                                                                                                                                                             |                                           |         |
| run_controller_id    | mediumint unsigned                                                                                                                                         |                 | false    |                  |                                                                                                                                                                             | [run_controller](run_controller.md)       |         |
| run_status           | enum('No Action Taken','Waiting to Run','Running','Error','Complete','Invalid','Committing','Committed','Skipped','Sent to Workstation','Export Payments') | No Action Taken | false    |                  |                                                                                                                                                                             |                                           |         |
| start_date           | datetime                                                                                                                                                   |                 | true     |                  |                                                                                                                                                                             |                                           |         |
| summary_export_url   | varchar(255)                                                                                                                                               |                 | true     |                  |                                                                                                                                                                             |                                           |         |

## Constraints

| Name                    | Type        | Definition                                                                             |
| ----------------------- | ----------- | -------------------------------------------------------------------------------------- |
| PRIMARY                 | PRIMARY KEY | PRIMARY KEY (accounting_run_id)                                                        |
| fk_acc_run_run_ctrl     | FOREIGN KEY | FOREIGN KEY (run_controller_id) REFERENCES run_controller (run_controller_id)          |
| fk_acct_run_acct_period | FOREIGN KEY | FOREIGN KEY (accounting_period_id) REFERENCES accounting_period (accounting_period_id) |

## Indexes

| Name               | Definition                                                |
| ------------------ | --------------------------------------------------------- |
| PRIMARY            | PRIMARY KEY (accounting_run_id) USING BTREE               |
| idx_acct_period_id | KEY idx_acct_period_id (accounting_period_id) USING BTREE |
| idx_run_ctrl_id    | KEY idx_run_ctrl_id (run_controller_id) USING BTREE       |

## Relations

![er](accounting_run.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
