# Pipedrive schema ERD

Table and field reference for the Fivetran Pipedrive connector.

## Table & Field Reference

### lead_lead_label

| Column | Type | Keys |
| --- | --- | --- |
| label_id | String | PK, FK |
| lead_id | String | PK, FK |

### goal_result

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| owner_id | Long | FK |
| assignee_id | Long |  |
| assignee_type | String |  |
| duration_end | LocalDate |  |
| duration_start | LocalDate |  |
| expected_target | Long |  |
| expected_tracking_metric | String |  |
| interval | String |  |
| is_active | Boolean |  |
| progress | Double |  |
| report_ids | Json |  |
| title | String |  |
| type | String |  |

### person

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| org_id | Long | FK |
| owner_id | Long | FK |
| add_time | Instant |  |
| birthday | LocalDate |  |
| email | String |  |
| im | Json |  |
| job_title | String |  |
| label_ids | String |  |
| name | String |  |
| notes | String |  |
| phone | String |  |
| picture_id | Long |  |
| postal_address | String |  |
| postal_address_admin_area_level_1 | String |  |
| postal_address_admin_area_level_2 | String |  |
| postal_address_country | String |  |
| postal_address_formatted_address | String |  |
| postal_address_locality | String |  |
| postal_address_postal_code | String |  |
| postal_address_route | String |  |
| postal_address_street_number | String |  |
| postal_address_sublocality | String |  |
| smart_bcc_email | String |  |
| update_time | Instant |  |
| updated_time | Instant |  |
| visible_to | Long |  |
| custom_** |  |  |

### deal_history

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| creator_user_id | Long | FK |
| currency | String | FK |
| org_id | Long | FK |
| owner_id | Long | FK |
| person_id | Long | FK |
| pipeline_id | Long | FK |
| stage_id | Long | FK |
| acv | Long |  |
| add_time | Instant |  |
| archive_time | Instant |  |
| arr | Long |  |
| channel | String |  |
| channel_id | String |  |
| close_time | Instant |  |
| expected_close_date | LocalDate |  |
| first_won_time | Instant |  |
| is_archived | Boolean |  |
| is_deleted | Boolean |  |
| label_ids | String |  |
| last_incoming_mail_time | Instant |  |
| last_outgoing_mail_time | Instant |  |
| lost_reason | String |  |
| lost_time | Instant |  |
| mrr | Long |  |
| origin | String |  |
| origin_id | String |  |
| probability | Int |  |
| stage_change_time | Instant |  |
| status | String |  |
| title | String |  |
| update_time | Instant |  |
| value | Double |  |
| visible_to | Long |  |
| won_time | Instant |  |
| custom_** |  |  |

### role

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| active_flag | Boolean |  |
| name | String |  |
| parent_role_id | String |  |

### person_phone

| Column | Type | Keys |
| --- | --- | --- |
| index | Int | PK |
| person_id | Long | PK, FK |
| label | String |  |
| phone | String |  |
| primary | Boolean |  |

### lead_history

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| creator_id | Long | FK |
| next_activity_id | Long | FK |
| organization_id | Long | FK |
| owner_id | Long | FK |
| person_id | Long | FK |
| add_time | Instant |  |
| amount | Double |  |
| cc_email | String |  |
| currency | String |  |
| expected_close_date | Instant |  |
| is_archived | Boolean |  |
| source_name | String |  |
| title | String |  |
| update_time | Instant |  |
| visible_to | String |  |
| was_seen | Boolean |  |
| custom_** |  |  |

### deal_field_subfield

| Column | Type | Keys |
| --- | --- | --- |
| key | String | PK |
| parent_id | Long | PK, FK |
| active_flag | Boolean |  |
| edit_flag | Boolean |  |
| field_type | String |  |
| id_suffix | String |  |
| mandatory_flag | Json |  |
| name | String |  |

### team

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| created_by_user_id | Long | FK |
| active_flag | Int |  |
| created_at | Instant |  |
| deleted_flag | Int |  |
| description | String |  |
| manager_id | Long |  |
| name | String |  |

### email_cc

| Column | Type | Keys |
| --- | --- | --- |
| recipient_id | Long | PK |
| mail_message_id | Long | PK, FK |
| linked_person_id | Long | FK |
| email_address | String |  |

### permission_assignment

| Column | Type | Keys |
| --- | --- | --- |
| permission_set_id | String | PK, FK |
| user_id | Long | PK, FK |

### mail_message

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| from_linked_person_id | Long | FK |
| mail_thread_id | Long | FK |
| user_id | Long | FK |
| body_url | String |  |
| created_at | Instant |  |
| deleted_flag | Int |  |
| draft_flag | Int |  |
| from_email_address | String |  |
| has_attachments_flag | Int |  |
| has_body_flag | Int |  |
| has_inline_attachments_flag | Int |  |
| has_real_attachments_flag | Int |  |
| mail_link_tracking_enabled_flag | Int |  |
| mail_tracking_status | String |  |
| message_time | Instant |  |
| read_flag | Int |  |
| sent_flag | Int |  |
| sent_from_pipedrive_flag | Int |  |
| smart_bcc_flag | Int |  |
| snippet | String |  |
| subject | String |  |
| synced_flag | Int |  |
| update_time | Instant |  |
| write_flag | Boolean |  |

### activity_participant

| Column | Type | Keys |
| --- | --- | --- |
| activity_id | Long | PK, FK |
| person_id | Long | PK, FK |
| is_primary | Boolean |  |

### product_deal

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| deal_id | Long | PK, FK |
| product_id | Long | FK |
| add_time | Instant |  |
| billing_frequency | String |  |
| billing_frequency_cycles | Int |  |
| billing_start_date | LocalDate |  |
| comments | String |  |
| currency | String |  |
| discount | Double |  |
| discount_type | String |  |
| is_enabled | Boolean |  |
| item_price | Double |  |
| name | String |  |
| order_nr | Long |  |
| product_variation_id | Long |  |
| quantity | Double |  |
| sum | Double |  |
| tax | Long |  |
| tax_method | String |  |
| update_time | Instant |  |

### filter_helper

| Column | Type | Keys |
| --- | --- | --- |
| id | Int | PK |
| operators | Json |  |
| relative_dates | Json |  |
| address_field_** |  |  |

### goal

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| owner_id | Long | FK |
| assignee_id | Long |  |
| assignee_type | String |  |
| duration_end | LocalDate |  |
| duration_start | LocalDate |  |
| expected_target | Long |  |
| expected_tracking_metric | String |  |
| interval | String |  |
| is_active | Boolean |  |
| progress | Double |  |
| report_ids | Json |  |
| title | String |  |
| type | String |  |

### activity_type

| Column | Type | Keys |
| --- | --- | --- |
| id | Int | PK |
| activity_type | String | FK |
| active_flag | Boolean |  |
| color | String |  |
| created_at | Instant |  |
| icon_key | String |  |
| is_custom_flag | Boolean |  |
| name | String |  |
| update_time | Instant |  |

### activity_attendees

| Column | Type | Keys |
| --- | --- | --- |
| _fivetran_id | String | PK |
| activity_id | Long | PK, FK |
| person_id | Long | FK |
| user_id | Long | FK |
| email | String |  |
| is_organizer | Boolean |  |
| name | String |  |
| status | String |  |

### product

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| owner_id | Long | FK |
| add_time | Instant |  |
| billing_frequency | String |  |
| billing_frequency_cycles | Long |  |
| category | String |  |
| code | String |  |
| description | String |  |
| name | String |  |
| tax | Double |  |
| unit | String |  |
| update_time | Instant |  |
| updated_time | Instant |  |
| custom_** |  |  |

### deal_field_option

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| deal_field_id | Long | PK, FK |
| label | String |  |

### file

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| activity_id | Long | FK |
| deal_id | Long | FK |
| mail_message_id | Long | FK |
| product_id | Long | FK |
| active_flag | Boolean |  |
| created_at | Instant |  |
| description | String |  |
| file_name | String |  |
| file_size | Long |  |
| inline_flag | Boolean |  |
| log_id | Long |  |
| name | String |  |
| remote_id | String |  |
| remote_location | String |  |
| s_3_bucket | String |  |
| update_time | Instant |  |
| url | String |  |

### goal_pipeline

| Column | Type | Keys |
| --- | --- | --- |
| goal_id | String | PK, FK |
| pipeline_id | Long | PK, FK |

### filter

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| user_id | Long | FK |
| active_flag | Boolean |  |
| created_at | Instant |  |
| custom_view_id | Long |  |
| name | String |  |
| temporary_flag | Boolean |  |
| type | String |  |
| update_time | Instant |  |
| visible_to | Int |  |

### organization

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| owner_id | Long | FK |
| add_time | Instant |  |
| address | String |  |
| address_admin_area_level_1 | String |  |
| address_admin_area_level_2 | String |  |
| address_country | String |  |
| address_formatted_address | String |  |
| address_locality | String |  |
| address_postal_code | String |  |
| address_route | String |  |
| address_street_number | String |  |
| address_sublocality | String |  |
| address_subpremise | String |  |
| annual_revenue | String |  |
| employee_count | Long |  |
| industry | String |  |
| label_ids | String |  |
| linkedin | String |  |
| name | String |  |
| smart_bcc_email | String |  |
| update_time | Instant |  |
| updated_time | Instant |  |
| visible_to | Int |  |
| website | String |  |
| custom_** |  |  |

### note

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| deal_id | Long | FK |
| last_updated_user_id | Long | FK |
| lead_id | String | FK |
| org_id | Long | FK |
| person_id | Long | FK |
| user_id | Long | FK |
| active_flag | Boolean |  |
| content | String |  |
| created_at | Instant |  |
| pinned_to_deal_flag | Boolean |  |
| pinned_to_organization_flag | Boolean |  |
| update_time | Instant |  |

### activity_field

| Column | Type | Keys |
| --- | --- | --- |
| field_code | String | PK |
| field_name | String |  |
| field_type | String |  |

### project

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| org_id | Long | FK |
| owner_id | Long | FK |
| person_id | Long | FK |
| add_time | Instant |  |
| archive_time | Instant |  |
| description | String |  |
| end_date | LocalDate |  |
| start_date | LocalDate |  |
| status | String |  |
| status_change_time | Instant |  |
| title | String |  |
| update_time | Instant |  |

### activity_field_subfield

| Column | Type | Keys |
| --- | --- | --- |
| field_code | String | PK |
| activity_field_code | String | PK, FK |
| field_name | String |  |
| field_type | String |  |

### lead_source

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| name | String |  |

### email_bcc

| Column | Type | Keys |
| --- | --- | --- |
| recipient_id | Long | PK |
| mail_message_id | Long | PK, FK |
| linked_person_id | Long | FK |
| email_address | String |  |

### mail_thread

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| deal_id | Long | FK |

### permission_set

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| name | String |  |

### installment

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| deal_id | Long | PK, FK |
| amount | Double |  |
| billing_date | LocalDate |  |
| description | String |  |

### currency

| Column | Type | Keys |
| --- | --- | --- |
| code | String | PK |
| active_flag | Boolean |  |
| decimal_points | Int |  |
| is_custom_flag | Boolean |  |
| name | String |  |
| symbol | String |  |

### deal_field

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| created_by_user_id | Long | FK |
| last_updated_by_user_id | Long | FK |
| active_flag | Boolean |  |
| add_time | Instant |  |
| add_visible_flag | Boolean |  |
| bulk_edit_allowed | Boolean |  |
| description | String |  |
| details_visible_flag | Boolean |  |
| edit_flag | Boolean |  |
| field_type | String |  |
| filtering_allowed | Boolean |  |
| important_flag | Boolean |  |
| index_visible_flag | Boolean |  |
| json_column_flag | Boolean |  |
| key | String |  |
| mandatory_flag | Json |  |
| name | String |  |
| order_nr | Long |  |
| searchable_flag | Boolean |  |
| sortable_flag | Boolean |  |
| update_time | Instant |  |

### product_price

| Column | Type | Keys |
| --- | --- | --- |
| currency | String | PK, FK |
| product_id | Long | PK, FK |
| cost | Double |  |
| direct_cost | Double |  |
| notes | String |  |
| price | Double |  |

### activity

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| creator_user_id | Long | FK |
| deal_id | Long | FK |
| org_id | Long | FK |
| owner_id | Long | FK |
| add_time | Instant |  |
| busy | Boolean |  |
| done | Boolean |  |
| due_date | LocalDate |  |
| due_time | String |  |
| duration | String |  |
| location | String |  |
| location_admin_area_level_1 | String |  |
| location_admin_area_level_2 | String |  |
| location_country | String |  |
| location_formatted_address | String |  |
| location_locality | String |  |
| location_postal_code | String |  |
| location_route | String |  |
| location_street_number | String |  |
| location_sublocality | String |  |
| location_subpremise | String |  |
| marked_as_done_time | Instant |  |
| note | String |  |
| priority | Long |  |
| project_id | Long |  |
| public_description | String |  |
| subject | String |  |
| type | String |  |
| update_time | Instant |  |

### person_email

| Column | Type | Keys |
| --- | --- | --- |
| index | Int | PK |
| person_id | Long | PK, FK |
| email | String |  |
| label | String |  |
| primary | Boolean |  |

### stage

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| pipeline_id | Long | FK |
| active_flag | Boolean |  |
| add_time | Instant |  |
| created_at | Instant |  |
| days_to_rotten | Long |  |
| deal_probability | Int |  |
| is_deal_rot_enabled | Boolean |  |
| name | String |  |
| order_nr | Long |  |
| rotten_days | Long |  |
| rotten_flag | Boolean |  |
| update_time | Instant |  |

### pipeline

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| add_time | Instant |  |
| deal_probability | Boolean |  |
| is_deal_probability_enabled | Boolean |  |
| name | String |  |
| order_nr | Long |  |
| update_time | Instant |  |

### project_deal

| Column | Type | Keys |
| --- | --- | --- |
| deal_id | Long | PK, FK |
| project_id | Long | PK, FK |

### task

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| creator_id | Long | FK |
| parent_task_id | Long | FK |
| project_id | Long | FK |
| add_time | Instant |  |
| assignee_id | Long |  |
| description | String |  |
| done | Int |  |
| due_date | LocalDate |  |
| marked_as_done_time | Instant |  |
| title | String |  |
| update_time | Instant |  |

### lead_label_history

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| add_time | Instant |  |
| color | String |  |
| name | String |  |
| update_time | Instant |  |

### permission

| Column | Type | Keys |
| --- | --- | --- |
| index | Int | PK |
| permission_set_id | String | PK, FK |
| content | String |  |

### user

| Column | Type | Keys |
| --- | --- | --- |
| id | Long | PK |
| default_currency | String | FK |
| role_id | Long | FK |
| activated | Boolean |  |
| active_flag | Boolean |  |
| created_at | Instant |  |
| email | String |  |
| has_created_company | Boolean |  |
| icon_url | String |  |
| is_admin | Int |  |
| last_login | Instant |  |
| locale | String |  |
| modified_time | Instant |  |
| name | String |  |
| phone | String |  |
| timezone_name | String |  |
| timezone_offset | String |  |

### team_user

| Column | Type | Keys |
| --- | --- | --- |
| team_id | Long | PK, FK |
| user_id | Long | PK, FK |

### call_log

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| activity_id | Long | FK |
| deal_id | Long | FK |
| lead_id | String | FK |
| org_id | Long | FK |
| person_id | Long | FK |
| user_id | Long | FK |
| company_id | Long |  |
| duration | String |  |
| end_time | Instant |  |
| from_phone_number | String |  |
| has_recording | Boolean |  |
| note | String |  |
| outcome | String |  |
| start_time | Instant |  |
| subject | String |  |
| to_phone_number | String |  |

### activity_field_option

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| activity_field_code | String | PK, FK |
| label | String |  |

### email_to

| Column | Type | Keys |
| --- | --- | --- |
| recipient_id | Long | PK |
| mail_message_id | Long | PK, FK |
| linked_person_id | Long | FK |
| email_address | String |  |

## Relationships

- lead_lead_label(lead_id) → lead_history(id)
- lead_lead_label(label_id) → lead_label_history(id)
- goal_result(owner_id) → user(id)
- person(owner_id) → user(id)
- person(org_id) → organization(id)
- deal_history(creator_user_id) → user(id)
- deal_history(person_id) → person(id)
- deal_history(pipeline_id) → pipeline(id)
- deal_history(stage_id) → stage(id)
- deal_history(currency) → currency(code)
- deal_history(org_id) → organization(id)
- deal_history(owner_id) → user(id)
- person_phone(person_id) → person(id)
- lead_history(owner_id) → user(id)
- lead_history(creator_id) → user(id)
- lead_history(next_activity_id) → activity(id)
- lead_history(organization_id) → organization(id)
- lead_history(person_id) → person(id)
- deal_field_subfield(parent_id) → deal_field(id)
- team(created_by_user_id) → user(id)
- email_cc(mail_message_id) → mail_message(id)
- email_cc(linked_person_id) → person(id)
- permission_assignment(permission_set_id) → permission_set(id)
- permission_assignment(user_id) → user(id)
- mail_message(mail_thread_id) → mail_thread(id)
- mail_message(user_id) → user(id)
- mail_message(from_linked_person_id) → person(id)
- activity_participant(activity_id) → activity(id)
- activity_participant(person_id) → person(id)
- product_deal(deal_id) → deal_history(id)
- product_deal(product_id) → product(id)
- goal(owner_id) → user(id)
- activity_type(activity_type) → activity(id)
- activity_attendees(activity_id) → activity(id)
- activity_attendees(person_id) → person(id)
- activity_attendees(user_id) → user(id)
- product(owner_id) → user(id)
- deal_field_option(deal_field_id) → deal_field(id)
- file(deal_id) → deal_history(id)
- file(product_id) → product(id)
- file(activity_id) → activity(id)
- file(mail_message_id) → mail_message(id)
- goal_pipeline(goal_id) → goal(id)
- goal_pipeline(pipeline_id) → pipeline(id)
- filter(user_id) → user(id)
- organization(owner_id) → user(id)
- note(user_id) → user(id)
- note(deal_id) → deal_history(id)
- note(person_id) → person(id)
- note(last_updated_user_id) → user(id)
- note(org_id) → organization(id)
- note(lead_id) → lead_history(id)
- project(person_id) → person(id)
- project(org_id) → organization(id)
- project(owner_id) → user(id)
- activity_field_subfield(activity_field_code) → activity_field(field_code)
- email_bcc(mail_message_id) → mail_message(id)
- email_bcc(linked_person_id) → person(id)
- mail_thread(deal_id) → deal_history(id)
- installment(deal_id) → deal_history(id)
- deal_field(last_updated_by_user_id) → user(id)
- deal_field(created_by_user_id) → user(id)
- product_price(product_id) → product(id)
- product_price(currency) → currency(code)
- activity(creator_user_id) → user(id)
- activity(owner_id) → user(id)
- activity(deal_id) → deal_history(id)
- activity(org_id) → organization(id)
- person_email(person_id) → person(id)
- stage(pipeline_id) → pipeline(id)
- project_deal(project_id) → project(id)
- project_deal(deal_id) → deal_history(id)
- task(parent_task_id) → task(id)
- task(project_id) → project(id)
- task(creator_id) → user(id)
- permission(permission_set_id) → permission_set(id)
- user(role_id) → role(id)
- user(default_currency) → currency(code)
- team_user(team_id) → team(id)
- team_user(user_id) → user(id)
- call_log(activity_id) → activity(id)
- call_log(person_id) → person(id)
- call_log(org_id) → organization(id)
- call_log(deal_id) → deal_history(id)
- call_log(user_id) → user(id)
- call_log(lead_id) → lead_history(id)
- activity_field_option(activity_field_code) → activity_field(field_code)
- email_to(mail_message_id) → mail_message(id)
- email_to(linked_person_id) → person(id)
