The data

This archive started as a database course project at TalTech: 21 tables designed in Oracle to document wearable art from first sketch to sale. Here it runs on PostgreSQL, with the schema cleaned up and the search built in.

Entity–relationship diagram

The original design from the course project.

Entity–relationship diagram of the 21 tables

From Estonian to English

Course project (Oracle)This archive (PostgreSQL)Holds
KUNSTNIKartistArtists and studios
TEOSartworkThe wearable pieces
TEOSE_TYYPartwork_typeStandard types (dress, brooch…)
UUS_TEOSE_TYYPcustom_artwork_typeTypes added by artists
MATERJALmaterialMaterials, origin, sustainability
TEHNIKAtechniqueTechniques
TEOSE_MATERJALartwork_materialWhich materials, how much
TEOSE_TEHNIKAartwork_techniqueWhich techniques, in what order
LOOMISE_ETAPPcreation_stageMaking stages and hours
MEEDIAmediaPhotos and their credits
SUNDMUSeventExhibitions, galleries, runway shows
TEOSE_SUNDMUSartwork_eventWhere a piece was shown
KOLLEKTSIONAARcollectorBuyers and collectors
TELLIMUScommissionCommission requests
PAKKUMINEofferThe artist's offers
TEHINGtransactionPayments; traces ownership
TEHINGU_TYYPtransaction_typeDeposit, sale, fee
KINNITUSendorsementProfessional endorsements
KINNITUSE_TYYPendorsement_typeEducation, exhibition, curator
HINNANGreviewCommunity reviews
USALDUSSKOORtrust_scoreTrust score over time

What changed in the port

  • Every foreign key and NOT NULL rule now holds: the original inserts referenced columns that didn't exist and put NULL into required keys.
  • A review is about an artist or an artwork, enforced with a CHECK, instead of requiring both.
  • Join tables use the (artwork, material) pair as the key instead of a surrogate id plus a composite key.
  • Countries are ISO codes, statuses and event types are checked against fixed lists, dates can't end before they start.
  • Ownership history is traced through commissions and transactions, as the final version of the course project decided, so the earlier OMANDILUGU table is gone.

The course queries, running live

Exclusive, labour-intensive pieces

“Show me only pieces that took real time to make”: more than 100 hours of handwork.

SELECT a.title, sum(cs.hours) AS total_hours
FROM creation_stage cs
JOIN artwork a ON a.id = cs.artwork_id
GROUP BY a.id
HAVING sum(cs.hours) > 100;

One artist's work

“I like Halcyon Knit Lab's work. Show me all their pieces.”

SELECT ar.name, a.title, t.name AS type, a.description
FROM artist ar
JOIN artwork a ON a.artist_id = ar.id
JOIN artwork_type t ON t.id = a.artwork_type_id
WHERE ar.name = 'Halcyon Knit Lab';
  • Cloud rib sweater Jacket
  • Oxblood cable pullover Jacket
  • Moss lace cardigan (in progress) Jacket

Luxury materials

“Which pieces use silk, cashmere or merino, and how much?”

SELECT a.title, ar.name AS artist, m.name AS material, am.quantity
FROM artwork a
JOIN artwork_material am ON am.artwork_id = a.id
JOIN material m ON m.id = am.material_id
JOIN artist ar ON ar.id = a.artist_id
WHERE m.name IN ('Silk', 'Cashmere', 'Merino wool');

How search works

A materialized view joins each piece with its maker, type, materials and techniques into one weighted full-text document (title and maker count most, descriptions least). A query matches by full-text search in both a plain and an English dictionary, so “dresses” finds “dress”, and falls back to trigram similarity on accent-free text, so a typo like “embroidry” still finds embroidery. Both are backed by GIN indexes.