Knot ERD

Tables (44)

assets

  • id — BIGINT — Primary key — NOT NULL
  • workspace_id — BIGINT — NOT NULL
  • notion_file_id — VARCHAR(100)
  • asset_type — VARCHAR(30) — NOT NULL
  • source_type — VARCHAR(30) — NOT NULL
  • original_name — VARCHAR(500)
  • mime_type — VARCHAR(255)
  • file_size — BIGINT
  • storage_key — VARCHAR(2048)
  • external_url — VARCHAR(2048)
  • expiry_time — DATETIME(6)
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

block_assets

  • asset_role — VARCHAR(30) — Primary key — NOT NULL
  • position_index — INT — Primary key — NOT NULL
  • block_object_id — BIGINT — Foreign key → blocks.object_id — NOT NULL
  • asset_id — BIGINT — Foreign key → assets.id — NOT NULL
  • caption_rich_text_id — BIGINT

block_rich_text_fields

  • field_name — VARCHAR(50) — Primary key — NOT NULL
  • block_object_id — BIGINT — Foreign key → blocks.object_id — NOT NULL
  • rich_text_content_id — BIGINT — NOT NULL

blocks

  • object_id — BIGINT — Foreign key → objects.id — NOT NULL
  • synced_from_block_object_id — BIGINT
  • block_type — VARCHAR(50) — NOT NULL
  • has_children — BOOLEAN — NOT NULL
  • is_in_trash — BOOLEAN — NOT NULL
  • block_payload — JSON

comments

  • id — BIGINT — Primary key — NOT NULL
  • workspace_id — BIGINT — NOT NULL
  • notion_comment_id — VARCHAR(100)
  • parent_object_id — BIGINT — NOT NULL
  • discussion_id — VARCHAR(100)
  • created_by_user_id — BIGINT
  • rich_text_content_id — BIGINT — NOT NULL
  • notion_created_at — DATETIME(6)
  • notion_updated_at — DATETIME(6)
  • is_resolved — BOOLEAN — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

data_source_rows

  • data_source_object_id — BIGINT — Foreign key → data_sources.object_id — NOT NULL
  • page_object_id — BIGINT — Foreign key → pages.object_id — NOT NULL
  • position_index — INT — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

data_source_templates

  • id — BIGINT — Primary key — NOT NULL
  • data_source_object_id — BIGINT — NOT NULL
  • template_page_object_id — BIGINT — NOT NULL
  • template_name — VARCHAR(255) — NOT NULL
  • description — TEXT
  • is_default — BOOLEAN — NOT NULL
  • position_index — INT — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

data_source_view_filter_nodes

  • id — BIGINT — Primary key — NOT NULL
  • view_id — BIGINT — NOT NULL
  • parent_filter_node_id — BIGINT
  • node_type — VARCHAR(20) — NOT NULL
  • logical_operator — VARCHAR(10)
  • property_definition_id — BIGINT
  • filter_operator — VARCHAR(40)
  • value_type — VARCHAR(20)
  • string_value — LONGTEXT
  • number_value — DECIMAL(38,10)
  • boolean_value — BOOLEAN
  • date_start — DATETIME(6)
  • date_end — DATETIME(6)
  • timezone — VARCHAR(100)
  • position_index — INT — NOT NULL

data_source_view_filter_options

  • filter_node_id — BIGINT — Foreign key → data_source_view_filter_nodes.id — NOT NULL
  • option_id — BIGINT — Foreign key → property_select_options.id — NOT NULL

data_source_view_filter_pages

  • filter_node_id — BIGINT — Foreign key → data_source_view_filter_nodes.id — NOT NULL
  • page_object_id — BIGINT — Foreign key → pages.object_id — NOT NULL

data_source_view_filter_users

  • filter_node_id — BIGINT — Foreign key → data_source_view_filter_nodes.id — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL

data_source_view_groups

  • id — BIGINT — Primary key — NOT NULL
  • view_id — BIGINT — NOT NULL
  • property_definition_id — BIGINT — NOT NULL
  • position_index — INT — NOT NULL
  • direction — VARCHAR(10) — NOT NULL
  • hide_empty_groups — BOOLEAN — NOT NULL

data_source_view_properties

  • view_id — BIGINT — Foreign key → data_source_views.id — NOT NULL
  • property_definition_id — BIGINT — Foreign key → property_definitions.id — NOT NULL
  • position_index — INT — NOT NULL
  • is_visible — BOOLEAN — NOT NULL
  • width — INT

data_source_view_sorts

  • id — BIGINT — Primary key — NOT NULL
  • view_id — BIGINT — NOT NULL
  • property_definition_id — BIGINT — NOT NULL
  • sort_order — INT — NOT NULL
  • direction — VARCHAR(10) — NOT NULL
  • nulls_order — VARCHAR(10) — NOT NULL

data_source_views

  • id — BIGINT — Primary key — NOT NULL
  • data_source_object_id — BIGINT — NOT NULL
  • view_name — VARCHAR(255) — NOT NULL
  • view_type — VARCHAR(30) — NOT NULL
  • position_index — INT — NOT NULL
  • layout_configuration — JSON
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

data_sources

  • object_id — BIGINT — Foreign key → objects.id — NOT NULL
  • database_object_id — BIGINT — NOT NULL
  • title_rich_text_id — BIGINT
  • description — TEXT
  • is_in_trash — BOOLEAN — NOT NULL

databases

  • object_id — BIGINT — Foreign key → objects.id — NOT NULL
  • title_rich_text_id — BIGINT
  • description — TEXT
  • is_inline — BOOLEAN — NOT NULL
  • is_in_trash — BOOLEAN — NOT NULL
  • icon_type — VARCHAR(30)
  • icon_value — VARCHAR(2048)
  • cover_type — VARCHAR(30)
  • cover_value — VARCHAR(2048)

formula_property_configs

  • property_definition_id — BIGINT — Foreign key → property_definitions.id — NOT NULL
  • formula_expression — LONGTEXT — NOT NULL
  • result_type — VARCHAR(30)

objects

  • id — BIGINT — Primary key — NOT NULL
  • workspace_id — BIGINT — NOT NULL
  • parent_object_id — BIGINT
  • notion_object_id — VARCHAR(100)
  • object_type — VARCHAR(30) — NOT NULL
  • position_index — INT — NOT NULL
  • created_by_user_id — BIGINT
  • updated_by_user_id — BIGINT
  • notion_created_at — DATETIME(6)
  • notion_updated_at — DATETIME(6)
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

page_assets

  • asset_role — VARCHAR(30) — Primary key — NOT NULL
  • page_object_id — BIGINT — Foreign key → pages.object_id — NOT NULL
  • asset_id — BIGINT — Foreign key → assets.id — NOT NULL

page_links

  • id — BIGINT — Primary key — NOT NULL
  • workspace_id — BIGINT — NOT NULL
  • source_page_id — BIGINT — NOT NULL
  • target_page_id — BIGINT — NOT NULL
  • source_block_id — BIGINT
  • source_segment_id — BIGINT
  • link_type — VARCHAR(30) — NOT NULL
  • created_at — DATETIME(6) — NOT NULL

page_property_values

  • id — BIGINT — Primary key — NOT NULL
  • page_object_id — BIGINT — NOT NULL
  • property_definition_id — BIGINT — NOT NULL
  • notion_value_id — VARCHAR(100)
  • value_type — VARCHAR(30) — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

pages

  • object_id — BIGINT — Foreign key → objects.id — NOT NULL
  • title_rich_text_id — BIGINT
  • page_kind — VARCHAR(30) — NOT NULL
  • url — VARCHAR(2048)
  • public_url — VARCHAR(2048)
  • icon_type — VARCHAR(30)
  • icon_value — VARCHAR(2048)
  • cover_type — VARCHAR(30)
  • cover_value — VARCHAR(2048)
  • is_archived — BOOLEAN — NOT NULL
  • is_in_trash — BOOLEAN — NOT NULL
  • is_locked — BOOLEAN — NOT NULL

property_definitions

  • id — BIGINT — Primary key — NOT NULL
  • data_source_object_id — BIGINT — NOT NULL
  • notion_property_id — VARCHAR(100)
  • property_name — VARCHAR(255) — NOT NULL
  • property_type — VARCHAR(50) — NOT NULL
  • position_index — INT — NOT NULL
  • is_required — BOOLEAN — NOT NULL
  • configuration — JSON
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

property_option_groups

  • id — BIGINT — Primary key — NOT NULL
  • property_definition_id — BIGINT — NOT NULL
  • group_name — VARCHAR(255) — NOT NULL
  • group_color — VARCHAR(30) — NOT NULL
  • position_index — INT — NOT NULL

property_select_options

  • id — BIGINT — Primary key — NOT NULL
  • property_definition_id — BIGINT — NOT NULL
  • option_group_id — BIGINT
  • notion_option_id — VARCHAR(100)
  • option_name — VARCHAR(255) — NOT NULL
  • option_color — VARCHAR(30) — NOT NULL
  • position_index — INT — NOT NULL

property_value_booleans

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • boolean_value — BOOLEAN

property_value_dates

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • start_at — DATETIME(6)
  • end_at — DATETIME(6)
  • timezone — VARCHAR(100)
  • has_time — BOOLEAN — NOT NULL

property_value_files

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • asset_id — BIGINT — Foreign key → assets.id — NOT NULL
  • position_index — INT — NOT NULL
  • display_name — VARCHAR(500)

property_value_jsons

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • json_value — JSON

property_value_numbers

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • number_value — DECIMAL(38,10)

property_value_options

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • option_id — BIGINT — Foreign key → property_select_options.id — NOT NULL
  • position_index — INT — NOT NULL

property_value_relations

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • target_page_object_id — BIGINT — Foreign key → pages.object_id — NOT NULL
  • position_index — INT — NOT NULL

property_value_rich_texts

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • rich_text_content_id — BIGINT — NOT NULL

property_value_strings

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • string_value — LONGTEXT

property_value_users

  • property_value_id — BIGINT — Foreign key → page_property_values.id — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • position_index — INT — NOT NULL

relation_property_configs

  • property_definition_id — BIGINT — Foreign key → property_definitions.id — NOT NULL
  • target_data_source_object_id — BIGINT — NOT NULL
  • synced_property_definition_id — BIGINT
  • relation_type — VARCHAR(30) — NOT NULL

rich_text_contents

  • id — BIGINT — Primary key — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

rich_text_mentions

  • rich_text_segment_id — BIGINT — Foreign key → rich_text_segments.id — NOT NULL
  • mention_type — VARCHAR(30) — NOT NULL
  • target_user_id — BIGINT
  • target_page_object_id — BIGINT
  • target_database_object_id — BIGINT
  • target_data_source_object_id — BIGINT
  • mention_date_start — DATETIME(6)
  • mention_date_end — DATETIME(6)
  • mention_timezone — VARCHAR(100)
  • link_preview_url — VARCHAR(2048)

rich_text_segments

  • id — BIGINT — Primary key — NOT NULL
  • rich_text_content_id — BIGINT — NOT NULL
  • position_index — INT — NOT NULL
  • segment_type — VARCHAR(30) — NOT NULL
  • plain_text — LONGTEXT
  • href — VARCHAR(2048)
  • text_content — LONGTEXT
  • link_url — VARCHAR(2048)
  • is_bold — BOOLEAN — NOT NULL
  • is_italic — BOOLEAN — NOT NULL
  • is_strikethrough — BOOLEAN — NOT NULL
  • is_underline — BOOLEAN — NOT NULL
  • is_code — BOOLEAN — NOT NULL
  • text_color — VARCHAR(30) — NOT NULL

rollup_property_configs

  • property_definition_id — BIGINT — Foreign key → property_definitions.id — NOT NULL
  • relation_property_definition_id — BIGINT — NOT NULL
  • target_property_definition_id — BIGINT — NOT NULL
  • aggregation_function — VARCHAR(50) — NOT NULL
  • result_type — VARCHAR(30)

users

  • id — BIGINT — Primary key — NOT NULL
  • notion_user_id — VARCHAR(100)
  • user_type — VARCHAR(30) — NOT NULL
  • name — VARCHAR(255)
  • email — VARCHAR(320)
  • avatar_url — VARCHAR(2048)
  • is_active — BOOLEAN — NOT NULL
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL

workspace_members

  • workspace_id — BIGINT — Foreign key → workspaces.id — NOT NULL
  • user_id — BIGINT — Foreign key → users.id — NOT NULL
  • member_role — VARCHAR(30) — NOT NULL
  • joined_at — DATETIME(6)

workspaces

  • id — BIGINT — Primary key — NOT NULL
  • notion_workspace_id — VARCHAR(100)
  • name — VARCHAR(255) — NOT NULL
  • icon_url — VARCHAR(2048)
  • created_at — DATETIME(6) — NOT NULL
  • updated_at — DATETIME(6) — NOT NULL