# account_tax_info_history

## Description

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

```sql
CREATE TABLE `account_tax_info_history` (
  `account_tax_info_history_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
  `account_tax_info_id` mediumint unsigned NOT NULL,
  `account_id` mediumint unsigned NOT NULL,
  `country_of_tax_residence` char(3) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `is_sba_signed` tinyint(1) DEFAULT '0',
  `is_vat_exempt` tinyint(1) NOT NULL DEFAULT '1',
  `is_tax_treaty_claimed` tinyint(1) NOT NULL DEFAULT '0',
  `tax_employment_type` enum('Business','Employed Individual','Self-Employed Individual (< 2 years)','Self-Employed Individual (>= 2 years)','Individual','Small Business that is not required to register for EU VAT') COLLATE utf8mb4_general_ci DEFAULT NULL,
  `certificate_of_residence_expiration_date` date DEFAULT NULL,
  `is_wht_applicable` tinyint(1) NOT NULL DEFAULT '1',
  `is_resident_of_spanish_islands` tinyint(1) DEFAULT NULL,
  `wht_rate_override` decimal(5,2) 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 (`account_tax_info_history_id`),
  KEY `fk_account_tax_info_history_account` (`account_id`),
  KEY `fk_account_tax_info_id` (`account_tax_info_id`),
  CONSTRAINT `fk_account_tax_info_history_account` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `fk_account_tax_info_id` FOREIGN KEY (`account_tax_info_id`) REFERENCES `account_tax_info` (`account_tax_info_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 |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------- | ---------------- | -------- | --------------------------------------- | ------- |
| account_id                               | mediumint unsigned                                                                                                                                                                              |         | false    |                  |          | [account](account.md)                   |         |
| account_tax_info_history_id              | mediumint unsigned                                                                                                                                                                              |         | false    | auto_increment   |          |                                         |         |
| account_tax_info_id                      | mediumint unsigned                                                                                                                                                                              |         | false    |                  |          | [account_tax_info](account_tax_info.md) |         |
| certificate_of_residence_expiration_date | date                                                                                                                                                                                            |         | true     |                  |          |                                         |         |
| country_of_tax_residence                 | char(3)                                                                                                                                                                                         |         | true     |                  |          |                                         |         |
| created_at                               | datetime                                                                                                                                                                                        |         | false    |                  |          |                                         |         |
| created_by                               | varchar(255)                                                                                                                                                                                    |         | false    |                  |          |                                         |         |
| is_resident_of_spanish_islands           | tinyint(1)                                                                                                                                                                                      |         | true     |                  |          |                                         |         |
| is_sba_signed                            | tinyint(1)                                                                                                                                                                                      | 0       | true     |                  |          |                                         |         |
| is_tax_treaty_claimed                    | tinyint(1)                                                                                                                                                                                      | 0       | false    |                  |          |                                         |         |
| is_vat_exempt                            | tinyint(1)                                                                                                                                                                                      | 1       | false    |                  |          |                                         |         |
| is_wht_applicable                        | tinyint(1)                                                                                                                                                                                      | 1       | false    |                  |          |                                         |         |
| last_modified                            | datetime                                                                                                                                                                                        |         | false    |                  |          |                                         |         |
| last_modified_by                         | varchar(255)                                                                                                                                                                                    |         | false    |                  |          |                                         |         |
| tax_employment_type                      | enum('Business','Employed Individual','Self-Employed Individual (< 2 years)','Self-Employed Individual (>= 2 years)','Individual','Small Business that is not required to register for EU VAT') |         | true     |                  |          |                                         |         |
| wht_rate_override                        | decimal(5,2)                                                                                                                                                                                    |         | true     |                  |          |                                         |         |

## Constraints

| Name                                | Type        | Definition                                                                          |
| ----------------------------------- | ----------- | ----------------------------------------------------------------------------------- |
| PRIMARY                             | PRIMARY KEY | PRIMARY KEY (account_tax_info_history_id)                                           |
| fk_account_tax_info_history_account | FOREIGN KEY | FOREIGN KEY (account_id) REFERENCES account (account_id)                            |
| fk_account_tax_info_id              | FOREIGN KEY | FOREIGN KEY (account_tax_info_id) REFERENCES account_tax_info (account_tax_info_id) |

## Indexes

| Name                                | Definition                                                       |
| ----------------------------------- | ---------------------------------------------------------------- |
| PRIMARY                             | PRIMARY KEY (account_tax_info_history_id) USING BTREE            |
| fk_account_tax_info_history_account | KEY fk_account_tax_info_history_account (account_id) USING BTREE |
| fk_account_tax_info_id              | KEY fk_account_tax_info_id (account_tax_info_id) USING BTREE     |

## Relations

![er](account_tax_info_history.svg)

---

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