github.com/abayer/test-infra@v0.0.5/velodrome/sql/README.md (about)

     1  Overview
     2  ========
     3  
     4  This defines the model that `Fetcher` uses to save the data in the database, and
     5  that `Transform` reads in order to generate the metrics.
     6  
     7  The database and the tables are automatically created on the first connection by
     8  [Gorm](https://github.com/jinzhu/gorm). The mapping between the Go objects here
     9  and the database rows is also done by Gorm.
    10  
    11  Schema
    12  ======
    13  
    14  Here is what the final schema looks like:
    15  
    16  List of tables in the `github` database:
    17  ```
    18  +------------------+
    19  | Tables_in_github |
    20  +------------------+
    21  | comments         |
    22  | issue_events     |
    23  | issues           |
    24  | labels           |
    25  +------------------+
    26  ```
    27  
    28  `comments` table:
    29  ```
    30  +--------------------+--------------+------+-----+---------+----------------+
    31  | Field              | Type         | Null | Key | Default | Extra          |
    32  +--------------------+--------------+------+-----+---------+----------------+
    33  | id                 | int(11)      | NO   | PRI | NULL    | auto_increment |
    34  | issue_id           | int(11)      | YES  |     | NULL    |                |
    35  | body               | text         | YES  |     | NULL    |                |
    36  | user               | varchar(255) | YES  |     | NULL    |                |
    37  | comment_created_at | timestamp    | YES  |     | NULL    |                |
    38  | comment_updated_at | timestamp    | YES  |     | NULL    |                |
    39  | pull_request       | tinyint(1)   | YES  |     | NULL    |                |
    40  +--------------------+--------------+------+-----+---------+----------------+
    41  ```
    42  
    43  `issue_events` table:
    44  ```
    45  +------------------+--------------+------+-----+---------+----------------+
    46  | Field            | Type         | Null | Key | Default | Extra          |
    47  +------------------+--------------+------+-----+---------+----------------+
    48  | id               | int(11)      | NO   | PRI | NULL    | auto_increment |
    49  | label            | varchar(255) | YES  |     | NULL    |                |
    50  | event            | varchar(255) | YES  |     | NULL    |                |
    51  | event_created_at | timestamp    | YES  |     | NULL    |                |
    52  | issue_id         | int(11)      | YES  |     | NULL    |                |
    53  | assignee_id      | varchar(255) | YES  |     | NULL    |                |
    54  | actor_id         | varchar(255) | YES  |     | NULL    |                |
    55  | assignee         | varchar(255) | YES  |     | NULL    |                |
    56  | actor            | varchar(255) | YES  |     | NULL    |                |
    57  +------------------+--------------+------+-----+---------+----------------+
    58  ```
    59  
    60  `issues` table:
    61  ```
    62  +------------------+---------------+------+-----+---------+----------------+
    63  | Field            | Type          | Null | Key | Default | Extra          |
    64  +------------------+---------------+------+-----+---------+----------------+
    65  | id               | int(11)       | NO   | PRI | NULL    | auto_increment |
    66  | title            | varchar(1000) | YES  |     | NULL    |                |
    67  | body             | text          | YES  |     | NULL    |                |
    68  | user             | varchar(255)  | YES  |     | NULL    |                |
    69  | assignee         | varchar(255)  | YES  |     | NULL    |                |
    70  | state            | varchar(255)  | YES  |     | NULL    |                |
    71  | comments         | int(11)       | YES  |     | NULL    |                |
    72  | is_pr            | tinyint(1)    | YES  |     | NULL    |                |
    73  | issue_closed_at  | timestamp     | YES  |     | NULL    |                |
    74  | issue_created_at | timestamp     | YES  |     | NULL    |                |
    75  | issue_updated_at | timestamp     | YES  |     | NULL    |                |
    76  +------------------+---------------+------+-----+---------+----------------+
    77  ```
    78  
    79  And `labels` table:
    80  ```
    81  +----------+--------------+------+-----+---------+-------+
    82  | Field    | Type         | Null | Key | Default | Extra |
    83  +----------+--------------+------+-----+---------+-------+
    84  | issue_id | int(11)      | YES  | MUL | NULL    |       |
    85  | name     | varchar(255) | YES  |     | NULL    |       |
    86  +----------+--------------+------+-----+---------+-------+
    87  ```
    88  
    89  And `assignees` table:
    90  ```
    91  +------------+--------------+------+-----+---------+-------+
    92  | Field      | Type         | Null | Key | Default | Extra |
    93  +------------+--------------+------+-----+---------+-------+
    94  | repository | varchar(255) | YES  |     | NULL    |       |
    95  | issue_id   | varchar(255) | YES  |     | NULL    |       |
    96  | name       | varchar(255) | YES  |     | NULL    |       |
    97  +------------+--------------+------+-----+---------+-------+
    98  ```