1.Diagrams ············································································································ 4 1.1.All Items ········································································································ 4 2.Tables ················································································································ 5 2.1.Table: appointments ························································································· 5 2.1.1.Columns ·································································································· 5 2.1.2.Keys ······································································································· 6 2.1.3.Indexes···································································································· 6 2.1.4.Columns Details ························································································ 6 2.2.Table: corporate_customers ··············································································· 8 2.2.1.Columns ·································································································· 8 2.2.2.Keys ······································································································· 8 2.2.3.Indexes···································································································· 8 2.2.4.Columns Details ························································································ 8 2.3.Table: customers ····························································································· 9 2.3.1.Columns ·································································································· 9 2.3.2.Keys ······································································································· 9 2.3.3.Indexes·································································································· 10 2.3.4.Columns Details ······················································································ 10 2.4.Table: exchanges ·························································································· 10 2.4.1.Columns ································································································ 10 2.4.2.Keys ····································································································· 10 2.4.3.Indexes·································································································· 10 2.4.4.Columns Details ······················································································ 11 2.5.Table: invoices ······························································································ 12 2.5.1.Columns ································································································ 12 2.5.2.Keys ····································································································· 12 2.5.3.Columns Details ······················································································ 12 2.6.Table: messages ··························································································· 13 2.6.1.Columns ································································································ 13 2.6.2.Keys ····································································································· 13 2.6.3.Indexes·································································································· 13 2.6.4.Columns Details ······················································································ 14 2.7.Table: notifications ························································································· 15 2.7.1.Columns ································································································ 15 2.7.2.Keys ····································································································· 15 1 2.7.3.Indexes·································································································· 15 2.7.4.Columns Details ······················································································ 15 2.8.Table: providers ···························································································· 17 2.8.1.Columns ································································································ 17 2.8.2.Keys ····································································································· 17 2.8.3.Indexes·································································································· 17 2.8.4.Columns Details ······················································································ 17 2.9.Table: retail_customers ··················································································· 18 2.9.1.Columns ································································································ 18 2.9.2.Keys ····································································································· 18 2.9.3.Indexes·································································································· 18 2.9.4.Columns Details ······················································································ 18 2.10.Table: roles ································································································ 18 2.10.1.Columns······························································································· 18 2.10.2.Keys ···································································································· 18 2.10.3.Columns Details ····················································································· 19 2.11.Table: users ································································································ 19 2.11.1.Columns ······························································································· 19 2.11.2.Keys ···································································································· 20 2.11.3.Columns Details ····················································································· 20 2.12.Table: users_roles························································································ 22 2.12.1.Columns······························································································· 22 2.12.2.Keys ···································································································· 22 2.12.3.Indexes ································································································ 22 2.12.4.Columns Details ····················································································· 23 2.13.Table: working_plans ···················································································· 23 2.13.1.Columns······························································································· 23 2.13.2.Keys ···································································································· 24 2.13.3.Indexes ································································································ 24 2.13.4.Columns Details ····················································································· 24 2.14.Table: works ······························································································· 26 2.14.1.Columns······························································································· 26 2.14.2.Keys ···································································································· 26 2.14.3.Columns Details ····················································································· 26 2.15.Table: works_providers ················································································· 28 2 2.15.1.Columns······························································································· 28 2.15.2.Keys ···································································································· 28 2.15.3.Indexes ································································································ 28 2.15.4.Columns Details ····················································································· 28 3.Relationships ····································································································· 30 3 1.Diagrams 1.1.All Items 4 2.Tables Name Caption appointments appointments Description corporate_customers corporate_customers customers customers exchanges exchanges invoices invoices messages messages notifications notifications providers providers retail_customers retail_customers roles roles users users users_roles users_roles working_plans working_plans works works works_providers works_providers 2.1.Table: appointments 2.1.1.Columns Name Caption Type id id INT start start DATETIME end end DATETIME Description canceled_at canceled_at DATETIME status status VARCHAR(20) id_canceler id_canceler INT 5 id_provider id_provider INT id_customer id_customer INT id_work id_work INT id_invoice id_invoice INT 2.1.2.Keys Name Type Columns Description PK_appointments Primary id 2.1.3.Indexes Name Caption Unique Columns id_canceler id_canceler No id_canceler id_customer id_customer No id_customer id_invoice id_invoice id_invoice No id_provider id_provider No id_provider id_work id_work id_work No Description 2.1.4.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes Name start Caption start Type DATETIME 6 Name end Caption end Type DATETIME Name canceled_at Caption canceled_at Type DATETIME Name status Caption status Type VARCHAR(20) Charset utf8mb3 Collate utf8mb3_general_ci Name id_canceler Caption id_canceler Type INT Foreign key Yes Name id_provider Caption id_provider Type INT Foreign key Yes Name id_customer Caption id_customer 7 Type INT Foreign key Yes Name id_work Caption id_work Type INT Foreign key Yes Name id_invoice Caption id_invoice Type INT Foreign key Yes 2.2.Table: corporate_customers 2.2.1.Columns Name Caption Type Description id_customer id_customer INT vat_number vat_number VARCHAR(256) company_name company_name VARCHAR(256) 2.2.2.Keys Name Type Columns Description PK_corporate_customers Primary id_customer 2.2.3.Indexes Name Caption Unique Columns id_customer id_customer No Description id_customer 2.2.4.Columns Details 8 Name id_customer Caption id_customer Type INT Primary key Yes Foreign key Yes Not null Yes Name vat_number Caption vat_number Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name company_name Caption company_name Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci 2.3.Table: customers 2.3.1.Columns Name Caption Type Description id_customer id_customer INT 2.3.2.Keys Name Type Columns Description PK_customers Primary id_customer 9 2.3.3.Indexes Name Caption Unique Columns id_customer id_customer No Description id_customer 2.3.4.Columns Details Name id_customer Caption id_customer Type INT Primary key Yes Foreign key Yes Not null Yes 2.4.Table: exchanges 2.4.1.Columns Name Caption Type id id INT exchange_status exchange_status VARCHAR(256) Description id_appointment_requestor id_appointment_requestor INT id_appointment_requested id_appointment_requested INT 2.4.2.Keys Name Type Columns Description PK_exchanges Primary id 2.4.3.Indexes Name Uniqu Columns e Caption id_appointment_request id_appointment_request No ed ed 10 id_appointment_request ed Descriptio n id_appointment_request id_appointment_request No or or 2.4.4.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes Name exchange_status Caption exchange_status Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name id_appointment_requestor Caption id_appointment_requestor Type INT Foreign key Yes Name id_appointment_requested Caption id_appointment_requested Type INT Foreign key Yes 11 id_appointment_request or 2.5.Table: invoices 2.5.1.Columns Name Caption Type id id INT number number VARCHAR(256) status status VARCHAR(256) Description total_amount total_amount DECIMAL(10,2) issued issued DATETIME 2.5.2.Keys Name Type Columns Description PK_invoices Primary id 2.5.3.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes Name number Caption number Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci 12 Name status Caption status Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name total_amount Caption total_amount Type DECIMAL(10,2) Name issued Caption issued Type DATETIME 2.6.Table: messages 2.6.1.Columns Name Caption Type id id INT created_at created_at DATETIME message message TEXT id_author id_author INT Description id_appointment id_appointment INT 2.6.2.Keys Name Type Columns Description PK_messages Primary id 2.6.3.Indexes Name Caption Unique Columns 13 Description id_appointment id_appointment No id_appointment id_author id_author id_author No 2.6.4.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes Name created_at Caption created_at Type DATETIME Name message Caption message Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name id_author Caption id_author Type INT Foreign key Yes Name id_appointment 14 Caption id_appointment Type INT Foreign key Yes 2.7.Table: notifications 2.7.1.Columns Name Caption Type id id INT title title VARCHAR(256) Description message message TEXT created_at created_at DATETIME url url VARCHAR(256) is_read is_read TINYINT(1) id_user id_user INT 2.7.2.Keys Name Type Columns Description PK_notifications Primary id 2.7.3.Indexes Name Caption Unique Columns Description id_user id_user No id_user 2.7.4.Columns Details Name id Caption id Type INT Primary key Yes 15 Not null Yes Auto Increment Yes Name title Caption title Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name message Caption message Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name created_at Caption created_at Type DATETIME Name url Caption url Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name is_read Caption is_read 16 Type TINYINT(1) Name id_user Caption id_user Type INT Foreign key Yes 2.8.Table: providers 2.8.1.Columns Name Caption Type Description id_provider id_provider INT 2.8.2.Keys Name Type Columns Description PK_providers Primary id_provider 2.8.3.Indexes Name Caption Unique Columns Description id_provider id_provider No id_provider 2.8.4.Columns Details Name id_provider Caption id_provider Type INT Primary key Yes Foreign key Yes Not null Yes 17 2.9.Table: retail_customers 2.9.1.Columns Name Caption Type Description id_customer id_customer INT 2.9.2.Keys Name Type Columns Description PK_retail_customers Primary id_customer 2.9.3.Indexes Name Caption Unique Columns id_customer id_customer No Description id_customer 2.9.4.Columns Details Name id_customer Caption id_customer Type INT Primary key Yes Foreign key Yes Not null Yes 2.10.Table: roles 2.10.1.Columns Name Caption Type id id Description INT name name VARCHAR(50) 2.10.2.Keys Name Type Columns Description 18 PK_roles Primary id 2.10.3.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes Name name Caption name Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci 2.11.Table: users 2.11.1.Columns Name Caption Type id id INT Description username username VARCHAR(50) password password CHAR(80) first_name first_name VARCHAR(50) last_name last_name VARCHAR(50) email email VARCHAR(50) mobile mobile VARCHAR(50) street street VARCHAR(50) 19 city city VARCHAR(50) postcode postcode VARCHAR(50) 2.11.2.Keys Name Type Columns Description PK_users Primary id 2.11.3.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes Name username Caption username Type VARCHAR(50) Not null Yes Charset utf8mb3 Collate utf8mb3_general_ci Name password Caption password Type CHAR(80) Not null Yes Charset utf8mb3 20 Collate utf8mb3_general_ci Name first_name Caption first_name Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci Name last_name Caption last_name Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci Name email Caption email Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci Name mobile Caption mobile Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci Name street 21 Caption street Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci Name city Caption city Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci Name postcode Caption postcode Type VARCHAR(50) Charset utf8mb3 Collate utf8mb3_general_ci 2.12.Table: users_roles 2.12.1.Columns Name Caption Type Description user_id user_id INT role_id role_id INT 2.12.2.Keys Name Type Columns Description PK_users_roles Primary user_id role_id 2.12.3.Indexes Name Caption Unique Columns Description 22 FK_ROLE_idx FK_ROLE_idx No role_id 2.12.4.Columns Details Name user_id Caption user_id Type INT Primary key Yes Foreign key Yes Not null Yes Name role_id Caption role_id Type INT Primary key Yes Foreign key Yes Not null Yes 2.13.Table: working_plans 2.13.1.Columns Name Caption Type Description id_provider id_provider INT monday monday TEXT tuesday tuesday TEXT wednesday wednesday TEXT thursday thursday TEXT friday friday TEXT saturday saturday TEXT 23 sunday sunday TEXT 2.13.2.Keys Name Type Columns Description PK_working_plans Primary id_provider 2.13.3.Indexes Name Caption Unique Columns Description id_provider id_provider No id_provider 2.13.4.Columns Details Name id_provider Caption id_provider Type INT Primary key Yes Foreign key Yes Not null Yes Name monday Caption monday Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name tuesday Caption tuesday Type TEXT Charset utf8mb3 24 Collate utf8mb3_general_ci Name wednesday Caption wednesday Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name thursday Caption thursday Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name friday Caption friday Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name saturday Caption saturday Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci Name sunday 25 Caption sunday Type TEXT Charset utf8mb3 Collate utf8mb3_general_ci 2.14.Table: works 2.14.1.Columns Name Caption Type id id INT name name VARCHAR(256) duration duration INT price price DECIMAL(10,2) editable editable TINYINT(1) target target VARCHAR(256) Description description description TEXT 2.14.2.Keys Name Type Columns Description PK_works Primary id 2.14.3.Columns Details Name id Caption id Type INT Primary key Yes Not null Yes Auto Increment Yes 26 Name name Caption name Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name duration Caption duration Type INT Name price Caption price Type DECIMAL(10,2) Name editable Caption editable Type TINYINT(1) Name target Caption target Type VARCHAR(256) Charset utf8mb3 Collate utf8mb3_general_ci Name description Caption description Type TEXT 27 Charset utf8mb3 Collate utf8mb3_general_ci 2.15.Table: works_providers 2.15.1.Columns Name Caption Type Description id_user id_user INT id_work id_work INT 2.15.2.Keys Name Type Columns Description PK_works_providers Primary id_user id_work 2.15.3.Indexes Name Caption Unique Columns Description id_work id_work No id_work 2.15.4.Columns Details Name id_user Caption id_user Type INT Primary key Yes Foreign key Yes Not null Yes Name id_work Caption id_work Type INT Primary key Yes 28 Foreign key Yes Not null Yes 29 3.Relationships Name Parent table Child table Paren t table Child table column colum n appointments_invoices invoices appointments id id_invoice appointments_users_canceler users appointments id id_canceler appointments_users_customer users appointments id id_customer appointments_users_provider users appointments id id_provider appointments_works works appointments id id_work FK_appointments_provider users working_plans id id_provider FK_corporate_customer_user users corporate_custom id ers id_customer FK_customer_user users customers id id_customer FK_exchange_appointment_requ appointme exchanges ested nts id id_appointment_reque sted FK_exchange_appointment_requ appointme exchanges estor nts id id_appointment_reque stor FK_notes_appointment appointme messages nts id id_appointment FK_notes_author users messages id id_author FK_notification_user users notifications id id_user FK_provider_user users providers id id_provider FK_retail_customer_user users retail_customers id id_customer FK_roles_role roles users_roles id role_id FK_users_user users users_roles id user_id works_providers_users_provider users works_providers id id_user works_providers_works works_providers id id_work works 30 31