Changes between Version 6 and Version 7 of ЕРДијаграм


Ignore:
Timestamp:
01/08/25 22:03:25 (6 days ago)
Author:
221550
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ЕРДијаграм

    v6 v7  
    88=== **Ентитети**
    99
     10= 1. Client =
     11Telephone number – varchar (Primary Key)
     12Name – varchar (Mandatory attribute)
     13Last name – varchar (Mandatory attribute)
    1014
    11 === 1. Client
    12 * telephone_number - varchar (Primary key)
    13 * name - varchar (Mandatory attribute)
    14 * last_name - varchar (Mandatory attribute)
     15= 2. Motorcycle =
     16Registration – varchar (Primary Key)
     17Chassis number – varchar (Mandatory attribute)
     18Year – date (Mandatory attribute)
     19Model – varchar (Mandatory attribute)
     20Client telephone number – varchar (Foreign Key to Client)
    1521
    16 === 2. Motorcycle
    17 * registration - varchar (Primary key)
    18 * chassis_number - varchar (Mandatory attribute)
    19 * year - date (Mandatory attribute)
    20 * model - varchar (Mandatory attribute)
     22= 3. Service =
     23Service ID – serial (Primary Key)
     24Client telephone number – varchar (Foreign Key to Client)
     25Motorcycle registration – varchar (Foreign Key to Motorcycle)
     26Service date – date (Mandatory attribute)
     27Total price – numeric (Mandatory attribute)
    2128
    22 === 3. Mechanic
    23 * embg - numeric (Primary key)
    24 * name - varchar (Mandatory attribute)
    25 * last_name - varchar (Mandatory attribute)
     29= 4. Mechanic =
     30EMBG – numeric (Primary Key)
     31Name – varchar (Mandatory attribute)
     32Last name – varchar (Mandatory attribute)
    2633
    27 === 4. Service
    28 * service_id - serial (Primary key)
    29 * client_id - varchar (Foreign key referencing Client.telephone_number, Mandatory attribute)
    30 * motorcycle_registration - varchar (Foreign key referencing Motorcycle.registration, Mandatory attribute)
    31 * service_date - date (Mandatory attribute)
    32 * total_price - numeric (Mandatory attribute)
     34= 5. Service Mechanic (Junction Table for M:N Relationship between Service and Mechanic) =
     35Service ID – serial (Foreign Key to Service)
     36Mechanic EMBG – numeric (Foreign Key to Mechanic)
    3337
    34 === 5. Item
    35 * item_id - serial (Primary key)
    36 * description - varchar (Optional attribute)
    37 * unit_of_measurement - varchar (Mandatory attribute)
    38 * price_per_unit - numeric (Mandatory attribute)
    39 * tax - numeric (Mandatory attribute)
     38= 6. ServiceInvoice =
     39Invoice number – serial (Primary Key)
     40Date – date (Mandatory attribute)
     41Recipient – varchar (Foreign Key to Client)
     42Photo copy – varchar (Mandatory attribute)
    4043
    41 === 6. ServiceInvoice
    42 * invoice_number - serial (Primary key)
    43 * date - date (Mandatory attribute)
    44 * recipient - varchar (Foreign key referencing Client.telephone_number, Mandatory attribute)
    45 * photo_copy - varchar (Mandatory attribute)
     44= 7. FiscalBill =
     45Fiscal ID – serial (Primary Key)
     46DateTime – timestamp (Mandatory attribute)
     47Issuer – varchar (Foreign Key to Client)
     48Description – varchar
     49Total price – numeric (Mandatory attribute)
     50DDV – numeric (Mandatory attribute)
     51EDB – varchar (Mandatory attribute)
    4652
    47 === 7. FiscalBill
    48 * fiscal_id - serial (Primary key)
    49 * datetime - timestamp (Mandatory attribute)
    50 * issuer - varchar (Foreign key referencing Client.telephone_number, Mandatory attribute)
    51 * description - varchar (Optional attribute)
    52 * total_price - numeric (Mandatory attribute)
    53 * ddv - numeric (Mandatory attribute)
    54 * edb - varchar (Mandatory attribute)
     53== Relationships ==
    5554
    56 == Relations
     55Client to Motorcycle: A Client can have multiple Motorcycles, but each Motorcycle belongs to one Client (1:N).
     56* Foreign Key: client_telephone_number in Motorcycle references telephone_number in Client.
    5757
    58 1. **Owns** - 1:N relation where each Client can have multiple Motorcycles.
    59 2. **Has** - 1:N relation where each Motorcycle can have multiple Services.
    60 3. **ServicedBy** - M:N relation where each Service can be performed by multiple Mechanics, and each Mechanic can work on multiple Services.
    61 4. **HasInvoice** - 1:1 relation where each Service has only one Invoice and one Invoice can be linked to one Service.
    62 5. **Contains** - M:N relation where each Service contains multiple Items, and each Item can be part of multiple Services.
    63 6. **FiscalRelationship** - 1:1 relation where each ServiceInvoice can be associated with one FiscalBill and vice versa.
     58Client to Service: A Service is associated with one Client, but a Client can have many Services (1:N).
     59* Foreign Key: client_telephone_number in Service references telephone_number in Client.
     60
     61Motorcycle to Service: A Motorcycle can have many Services, but each Service is associated with one Motorcycle (1:N).
     62* Foreign Key: motorcycle_registration in Service references registration in Motorcycle.
     63
     64Service to Mechanic: A Service can be performed by many Mechanics, and each Mechanic can work on many Services (M:N).
     65* The service_mechanics table handles this many-to-many relationship, with service_id referencing Service and mechanic_embg referencing Mechanic.
     66
     67Client to ServiceInvoice: A Client can have many ServiceInvoices, but each ServiceInvoice belongs to one Client (1:N).
     68* Foreign Key: recipient in ServiceInvoice references telephone_number in Client.
     69
     70Client to FiscalBill: A Client can have many FiscalBills, but each FiscalBill is issued by one Client (1:N).
     71* Foreign Key: issuer in FiscalBill references telephone_number in Client.