# account_contract_vat_detail

## Description

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

```sql
CREATE TABLE `account_contract_vat_detail` (
  `account_contract_vat_detail_id` int NOT NULL AUTO_INCREMENT,
  `account_id` mediumint unsigned NOT NULL,
  `contract_id` mediumint unsigned NOT NULL,
  `company_code` varchar(8) DEFAULT NULL,
  `is_vat_eligible` tinyint(1) NOT NULL DEFAULT '0',
  `vat_country` varchar(60) DEFAULT NULL,
  `is_vat_registered` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` datetime DEFAULT NULL,
  `created_by` varchar(255) NOT NULL,
  `last_modified_by` varchar(255) NOT NULL,
  `last_modified` datetime DEFAULT NULL,
  PRIMARY KEY (`account_contract_vat_detail_id`),
  UNIQUE KEY `account_id_2` (`account_id`,`contract_id`),
  KEY `account_id` (`account_id`),
  KEY `contract_id` (`contract_id`),
  CONSTRAINT `fk_vat_detail_account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`account_id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_vat_detail_contract_id` FOREIGN KEY (`contract_id`) REFERENCES `contract` (`contract_id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=[Redacted by tbls] DEFAULT CHARSET=utf8mb3
```

</details>

## Columns

| Name                           | Type               | Default | Nullable | Extra Definition | Children | Parents                 | Comment |
| ------------------------------ | ------------------ | ------- | -------- | ---------------- | -------- | ----------------------- | ------- |
| account_contract_vat_detail_id | int                |         | false    | auto_increment   |          |                         |         |
| account_id                     | mediumint unsigned |         | false    |                  |          | [account](account.md)   |         |
| company_code                   | varchar(8)         |         | true     |                  |          |                         |         |
| contract_id                    | mediumint unsigned |         | false    |                  |          | [contract](contract.md) |         |
| created_at                     | datetime           |         | true     |                  |          |                         |         |
| created_by                     | varchar(255)       |         | false    |                  |          |                         |         |
| is_vat_eligible                | tinyint(1)         | 0       | false    |                  |          |                         |         |
| is_vat_registered              | tinyint(1)         | 0       | false    |                  |          |                         |         |
| last_modified                  | datetime           |         | true     |                  |          |                         |         |
| last_modified_by               | varchar(255)       |         | false    |                  |          |                         |         |
| vat_country                    | varchar(60)        |         | true     |                  |          |                         |         |

## Constraints

| Name                      | Type        | Definition                                                  |
| ------------------------- | ----------- | ----------------------------------------------------------- |
| PRIMARY                   | PRIMARY KEY | PRIMARY KEY (account_contract_vat_detail_id)                |
| account_id_2              | UNIQUE      | UNIQUE KEY account_id_2 (account_id, contract_id)           |
| fk_vat_detail_account_id  | FOREIGN KEY | FOREIGN KEY (account_id) REFERENCES account (account_id)    |
| fk_vat_detail_contract_id | FOREIGN KEY | FOREIGN KEY (contract_id) REFERENCES contract (contract_id) |

## Indexes

| Name         | Definition                                                    |
| ------------ | ------------------------------------------------------------- |
| PRIMARY      | PRIMARY KEY (account_contract_vat_detail_id) USING BTREE      |
| account_id   | KEY account_id (account_id) USING BTREE                       |
| account_id_2 | UNIQUE KEY account_id_2 (account_id, contract_id) USING BTREE |
| contract_id  | KEY contract_id (contract_id) USING BTREE                     |

## Relations

![er](account_contract_vat_detail.svg)

---

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