# sales_file

## Description

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

```sql
CREATE TABLE `sales_file` (
  `sales_file_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
  `file_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `accounting_period_id` smallint unsigned NOT NULL,
  `row_count` int unsigned DEFAULT NULL,
  `main_url` varchar(180) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `amount_usd` decimal(20,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 (`sales_file_id`),
  UNIQUE KEY `uidx_main_url` (`main_url`),
  KEY `idx_acct_period_id` (`accounting_period_id`),
  CONSTRAINT `fk_sales_file_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) |         |
| amount_usd           | decimal(20,2)      |         | true     |                  |          |                                           |         |
| created_at           | datetime           |         | false    |                  |          |                                           |         |
| created_by           | varchar(255)       |         | false    |                  |          |                                           |         |
| file_name            | varchar(255)       |         | false    |                  |          |                                           |         |
| last_modified        | datetime           |         | false    |                  |          |                                           |         |
| last_modified_by     | varchar(255)       |         | false    |                  |          |                                           |         |
| main_url             | varchar(180)       |         | true     |                  |          |                                           |         |
| row_count            | int unsigned       |         | true     |                  |          |                                           |         |
| sales_file_id        | mediumint unsigned |         | false    | auto_increment   |          |                                           |         |

## Constraints

| Name                      | Type        | Definition                                                                             |
| ------------------------- | ----------- | -------------------------------------------------------------------------------------- |
| PRIMARY                   | PRIMARY KEY | PRIMARY KEY (sales_file_id)                                                            |
| fk_sales_file_acct_period | FOREIGN KEY | FOREIGN KEY (accounting_period_id) REFERENCES accounting_period (accounting_period_id) |
| uidx_main_url             | UNIQUE      | UNIQUE KEY uidx_main_url (main_url)                                                    |

## Indexes

| Name               | Definition                                                |
| ------------------ | --------------------------------------------------------- |
| PRIMARY            | PRIMARY KEY (sales_file_id) USING BTREE                   |
| idx_acct_period_id | KEY idx_acct_period_id (accounting_period_id) USING BTREE |
| uidx_main_url      | UNIQUE KEY uidx_main_url (main_url) USING BTREE           |

## Relations

![er](sales_file.svg)

---

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