projects/org/pirotehnika/app/pim/TABLE_STRUCTURES.md

PIM Database Table Structures

Database: nocodb
Schema: pt7k98pv0fwi1el
Generated: 2025-12-27


Summary

Total tables: 28

Table Groups


1C Integration

1c_pim

Rows: 4785
Columns: 14

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el."1c_pim_id_seq"'::regclass)
ref_key character varying YES
code character varying YES
article character varying YES
name text YES
brand character varying YES
category character varying YES
type character varying YES
is_bundle boolean YES false
deletion_mark boolean YES false
status character varying YES 'active'::character varying
sync_status character varying YES 'synced'::character varying
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
video_rutube text YES

Purpose: Mirror of 1C products metadata with sync tracking


1c_piro

Rows: 3282
Columns: 11

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el."1c_piro_id_seq"'::regclass)
pim_id integer YES
caliber numeric YES
shots integer YES
duration integer YES
height integer YES
effects text YES
pack_qty integer YES
weight numeric YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Pyrotechnic-specific attributes from 1C


PIM Core

pim_article_mappings

Rows: 0
Columns: 14

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_article_mappings_id_seq'::regclass)
supplier character varying NO
supplier_article character varying NO
code_1c character varying YES
article_1c character varying YES
name_1c character varying YES
match_type character varying YES 'auto'::character varying
confidence integer YES 0
is_verified boolean YES false
verified_at timestamp without time zone YES
verified_by character varying YES
reject_reason character varying YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Maps supplier articles to 1C products


pim_brands

Rows: 34
Columns: 19

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_brands_id_seq'::regclass)
brand_name character varying NO
display_name character varying YES
website_url text YES
catalog_url text YES
scraper_type character varying YES
scraper_status character varying YES 'pending'::character varying
last_scraped_at timestamp without time zone YES
products_count integer YES 0
products_in_stock integer YES 0
priority integer YES 50
notes text YES
data_quality integer YES 0
is_active boolean YES true
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
wholesale_discount numeric YES 0.00
retail_markup numeric YES 30.00
brand_synonyms jsonb YES '[]'::jsonb

Purpose: Brand master data with pricing rules


pim_bundle_items

Rows: 0
Columns: 6

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_bundle_items_id_seq'::regclass)
bundle_id integer NO
product_id integer NO
quantity integer NO 1
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Items inside product bundles (composition)


pim_bundles

Rows: 0
Columns: 5

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_bundles_id_seq'::regclass)
bundle_article character varying NO
component_article character varying NO
quantity integer NO 1
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Bundle definitions by articles


pim_cross_prefixes

Rows: 3
Columns: 9

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_cross_prefixes_id_seq'::regclass)
brand character varying NO
prefix character varying NO
supplier character varying YES
description text YES
strip_from_article boolean YES true
priority integer YES 100
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Article prefix rules for brand/supplier combinations


pim_field_mappings

Rows: 36
Columns: 18

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_field_mappings_id_seq'::regclass)
field_name character varying NO
field_name_ru character varying YES
pim_table character varying YES 'pim_products'::character varying
pim_column character varying YES
c1_field character varying YES
c1_entity character varying YES 'Catalog_Номенклатура'::character varying
data_type character varying YES
field_format character varying YES
field_category character varying YES
product_type character varying YES
description text YES
example_value text YES
is_required boolean YES false
sync_to_1c boolean YES false
sync_from_1c boolean YES false
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Mapping between PIM and 1C field structures


pim_import_logs

Rows: 2
Columns: 16

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_import_logs_id_seq'::regclass)
supplier character varying NO
file_name character varying YES
price_date date YES
status character varying YES 'pending'::character varying
total_rows integer YES 0
imported integer YES 0
updated integer YES 0
skipped integer YES 0
errors integer YES 0
error_details json YES
started_at timestamp without time zone YES
finished_at timestamp without time zone YES
duration_sec integer YES
created_at timestamp without time zone YES now()
created_by character varying YES

Purpose: Import audit trail and statistics


pim_name_templates

Rows: 8
Columns: 9

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_name_templates_id_seq'::regclass)
category_code character varying NO
category_name character varying NO
name_short character varying NO
name_full character varying NO
example_short character varying YES
example_full character varying YES
is_active boolean YES true
created_at timestamp without time zone YES now()

Purpose: Product naming patterns by category


pim_pirotehnika

Rows: 5623
Columns: 37

Column Type Nullable Default
article character varying NO
calibers jsonb YES
effects_count integer YES
effects text YES
duration_sec integer YES
height_mm integer YES
salute_type character varying YES
packing character varying YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
video_youtube character varying YES
shots integer YES
pyro_category character varying YES
pyro_subcategory character varying YES
certificate_number character varying YES
pack_qty integer YES
pack_in_box integer YES
box_qty integer YES
size character varying YES
video_rutube character varying YES
calibers_text character varying YES
name_price character varying YES
is_combo boolean YES false
is_fan boolean YES false
is_with_fountain boolean YES false
is_gender boolean YES false
is_daytime boolean YES false
is_dual_box boolean YES false
is_modul boolean YES false
caliber_inch numeric YES
caliber_mm integer YES
product_type character varying YES
subtype character varying YES
is_service boolean YES false
item_type_1c character varying YES 'Запас'::character varying
video_s3 text YES
brand text YES

Purpose: Pyrotechnic products extended attributes


pim_products

Rows: 5922
Columns: 64

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_products_id_seq'::regclass)
article character varying NO
code_1c character varying YES
ref_key_1c character varying YES
barcode character varying YES
name character varying NO
name_short character varying YES
brand character varying YES
supplier character varying YES
category character varying YES
product_type character varying YES 'product'::character varying
cost_price numeric YES
base_price numeric YES
weight_grams integer YES
length_mm integer YES
width_mm integer YES
height_mm integer YES
is_active boolean YES true
is_available boolean YES true
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
synced_at timestamp without time zone YES
subcategory character varying YES
description text YES
photo_url text YES
card_url text YES
photo_local character varying YES
supplier_article character varying YES
image_url character varying YES
image_urls json YES
description_full text YES
description_short character varying YES
search_tags text YES
data_source character varying YES 'supplier'::character varying
data_source_id character varying YES
price_date date YES
data_quality integer YES 0
needs_review boolean YES false
review_comment text YES
stock_qty integer YES
imported_at timestamp without time zone YES
fixed_cost_price numeric YES
certificate_number character varying YES
certificate_valid_to date YES
photo_hub character varying YES
name_generated text YES
name_full text YES
video_rutube text YES
custom_wholesale_discount numeric YES
custom_retail_markup numeric YES
is_premium boolean YES false
premium_reason character varying YES
season integer YES
fixed_price numeric YES
target_cost numeric YES
cross_articles jsonb YES '[]'::jsonb
video_url character varying YES
country character varying YES
tier character varying YES 'standard'::character varying
product_status character varying YES 'active'::character varying
certificate_expiry date YES
hazard_class character varying YES
un_code character varying YES
safety_distance_m integer YES

Purpose: Master product catalog with all attributes


pim_products_with_cost

Rows: 5922
Columns: 57

Column Type Nullable Default
id integer YES
article character varying YES
code_1c character varying YES
ref_key_1c character varying YES
barcode character varying YES
name character varying YES
name_short character varying YES
brand character varying YES
supplier character varying YES
category character varying YES
product_type character varying YES
cost_price numeric YES
base_price numeric YES
weight_grams integer YES
length_mm integer YES
width_mm integer YES
height_mm integer YES
is_active boolean YES
is_available boolean YES
created_at timestamp without time zone YES
updated_at timestamp without time zone YES
synced_at timestamp without time zone YES
subcategory character varying YES
description text YES
photo_url text YES
card_url text YES
photo_local character varying YES
supplier_article character varying YES
image_url character varying YES
image_urls json YES
description_full text YES
description_short character varying YES
search_tags text YES
data_source character varying YES
data_source_id character varying YES
price_date date YES
data_quality integer YES
needs_review boolean YES
review_comment text YES
stock_qty integer YES
imported_at timestamp without time zone YES
fixed_cost_price numeric YES
certificate_number character varying YES
certificate_valid_to date YES
photo_hub character varying YES
name_generated text YES
name_full text YES
video_rutube text YES
custom_wholesale_discount numeric YES
custom_retail_markup numeric YES
is_premium boolean YES
premium_reason character varying YES
season integer YES
fixed_price numeric YES
target_cost numeric YES
real_cost_price numeric YES
cost_supplier_code text YES

Purpose: View: Products with real cost prices from suppliers


pim_site_products

Rows: 0
Columns: 17

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_site_products_id_seq'::regclass)
site_id integer NO
product_id integer NO
is_published boolean YES true
published_at timestamp without time zone YES
price_markup numeric YES
custom_price numeric YES
seo_title character varying YES
seo_description text YES
seo_keywords character varying YES
custom_data jsonb YES
sort_order integer YES 0
notes text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
adjustment_type character varying YES 'percent'::character varying
adjustment_value numeric YES 0.00

Purpose: Site-specific product customizations (pricing, SEO, publishing)


pim_sites

Rows: 5
Columns: 20

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_sites_id_seq'::regclass)
site_code character varying NO
name character varying NO
domain character varying NO
platform character varying YES
platform_version character varying YES
admin_url text YES
ftp_host character varying YES
ftp_path character varying YES
allowed_suppliers jsonb YES
default_markup numeric YES 30.00
min_price numeric YES 0
auto_publish boolean YES false
config jsonb YES
status character varying YES 'active'::character varying
is_production boolean YES false
description text YES
notes text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Website configurations (feyerverk.spb.ru, shop, etc.)


pim_sku_mappings

Rows: 2050
Columns: 19

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_sku_mappings_id_seq'::regclass)
pim_product_id integer YES
pim_article character varying NO
marketplace character varying NO 'ozon'::character varying
account_id character varying NO
marketplace_sku character varying NO
marketplace_product_id bigint YES
marketplace_offer_id character varying YES
marketplace_name character varying YES
marketplace_price numeric YES
marketplace_status character varying YES
is_active boolean YES true
is_verified boolean YES false
verified_at timestamp without time zone YES
verified_by character varying YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
bundle_quantity integer YES 1
is_bundle boolean YES false

Purpose: PIM to marketplace product mappings (Ozon, Yandex, etc.)


pim_stock

Rows: 5937
Columns: 7

Column Type Nullable Default
article character varying YES
name character varying YES
brand character varying YES
supplier_code character varying YES
supplier_quantity integer YES
warehouse_id integer YES
warehouse_quantity integer YES

Purpose: Stock levels from suppliers and warehouses


Pricing

price_channel_rules

Rows: 3
Columns: 15

Column Type Nullable Default
created_at timestamp without time zone YES
updated_at timestamp without time zone YES
created_by character varying YES
updated_by character varying YES
nc_order numeric YES
channel_code text YES
name text YES
platform_takes_pct numeric YES
target_margin_pct numeric YES
delivery_cost numeric YES
min_price_floor numeric YES
price_floor numeric YES
divisor numeric YES
is_default boolean YES false
is_active boolean YES false

Purpose: Pricing rules by sales channel (Ozon, shop, wholesale)


price_cost_rules

Rows: 5
Columns: 12

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_cost_rules_id_seq'::regclass)
rule_type character varying NO
rule_value character varying NO
discount_percent numeric YES
fixed_price numeric YES
priority integer YES
valid_from timestamp without time zone YES
valid_to timestamp without time zone YES
is_active boolean YES
comment text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Cost price override rules (seasonal, brand-based)


price_erp_supplier_discounts

Rows: 11
Columns: 8

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el."ERP_Supplier_Discounts_id_seq"'::regclass)
supplier text NO
brand text NO
discount_percent numeric NO 0
is_active boolean YES true
notes text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Supplier discounts by brand (from ERP)


price_history

Rows: 4126
Columns: 12

Column Type Nullable Default
created_at timestamp without time zone YES
updated_at timestamp without time zone YES
created_by character varying YES
updated_by character varying YES
nc_order numeric YES
article text YES
supplier text YES
price_date date YES
purchase_price numeric YES
min_order_qty bigint YES
in_stock boolean YES false
source_file text YES

Purpose: Historical supplier price records


price_list

Rows: 3
Columns: 16

Column Type Nullable Default
created_at timestamp without time zone YES
updated_at timestamp without time zone YES
created_by character varying YES
updated_by character varying YES
nc_order numeric YES
name text YES
supplier_code text YES
source_file text YES
column_mapping text YES
columns_hash text YES
is_configured boolean YES false
base_discount numeric YES
valid_from date YES
loaded_at timestamp without time zone YES
items_count bigint YES
is_active boolean YES false

Purpose: Supplier price list metadata


price_list_item

Rows: 1716
Columns: 18

Column Type Nullable Default
created_at timestamp without time zone YES
updated_at1 timestamp without time zone YES
created_by character varying YES
updated_by character varying YES
nc_order numeric YES
pricelist_id bigint YES
article text YES
name text YES
brand_code text YES
category_code text YES
base_price numeric YES
cost_price numeric YES
weight numeric YES
shots bigint YES
caliber text YES
is_new boolean YES false
updated_at timestamp without time zone YES
code_1c text YES

Purpose: Individual items in supplier price lists


price_sale

Rows: 8
Columns: 8

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.sale_price_id_seq'::regclass)
article character varying NO
channel character varying NO
price numeric NO
is_fixed boolean YES false
rule_id integer YES
formula_applied character varying YES
calculated_at timestamp without time zone YES now()

Purpose: Calculated sale prices for channels


price_sale_rules

Rows: 14
Columns: 12

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.sale_price_rules_id_seq'::regclass)
brand_pattern character varying NO
category_pattern character varying NO
priority integer NO 1
price_type character varying NO
formula character varying NO
base_value_source character varying YES 'base_price'::character varying
is_active boolean YES true
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()
rounding_mode integer YES 1
price_adjustment numeric YES 0

Purpose: Rules for price calculation by category/brand


price_supplier_cost

Rows: 3268
Columns: 11

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.supplier_cost_id_seq'::regclass)
article text NO
supplier_code text NO
real_cost_price numeric NO
currency text YES 'RUB'::text
valid_from timestamp without time zone YES now()
valid_to timestamp without time zone YES
source_file text YES
notes text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Real supplier cost prices by article


price_suppliers

Rows: 6
Columns: 8

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.prices_suppliers_id_seq'::regclass)
supplier_code character varying NO
supplier_name character varying NO
discount_percent numeric NO
is_active boolean YES true
notes text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Master supplier list with global discounts


price_volume_discounts

Rows: 0
Columns: 11

Column Type Nullable Default
id integer NO nextval('pt7k98pv0fwi1el.pim_volume_discounts_id_seq'::regclass)
brand_id integer YES
category character varying YES
min_quantity integer NO
max_quantity integer YES
discount_percent numeric NO
is_active boolean YES true
priority integer YES 50
notes text YES
created_at timestamp without time zone YES now()
updated_at timestamp without time zone YES now()

Purpose: Volume-based discounts for bulk orders


Key Relationships

Data Flow

1c_pim (1C source)
    
pim_products (Master catalog)
    
price_supplier_cost (Real costs)
    
price_sale (Calculated prices)
    
pim_site_products (Site-specific)
    
pim_sku_mappings (Marketplace sync)

Critical Tables

Data Quality Notes