wersja 5 db schema

dodalem wersjonowanie specyfikacji
This commit is contained in:
2026-04-22 22:34:40 +02:00
parent 32f126161e
commit 2acdb09bfa

View File

@@ -48,11 +48,27 @@ Table products {
} }
Table detail_products { Table detail_products {
id int [pk] product_id int [pk, ref: - products.id, not null]
product_id int [ref: - products.id, not null] spec jsonb [not null, note: "aktualny snapshot specyfikacji pobranej ze starego systemu"]
spec jsonb [note: "specyfikacja pobrana ze starego systemu w formie json"] source_url varchar [note: "adres url strony ze specyfikacja ze starego systemu"]
url varchar [note: "adres url strony ze specyfikacja ze starego systemu" ] source_hash varchar [not null, note: "hash aktualnego jsona specyfikacji do wykrywania zmian"]
last_fetched_at timestamp [not null, note: "czas ostatniego pobrania specyfikacji ze starego systemu"]
initial_spec_diff jsonb [note: "roznice miedzy aktualna specyfikacja a pierwsza pobrana wersja; null gdy brak zmian lub istnieje tylko pierwsza wersja"]
}
Table detail_product_versions {
id int [pk]
product_id int [ref: > products.id, not null]
version_no int [not null, note: "kolejny numer wersji specyfikacji dla danego produktu; 1 oznacza pierwsza pobrana wersje"]
spec jsonb [not null, note: "archiwalny snapshot specyfikacji ze starego systemu"]
source_hash varchar [not null, note: "hash archiwalnej wersji jsona"]
fetched_at timestamp [not null, note: "czas pobrania tej wersji"]
indexes {
(product_id, fetched_at)
(product_id, version_no) [unique]
(product_id, source_hash) [unique]
}
} }
Table clients { Table clients {