| | 1 | = Logical and Physical Design, DB Creation (DDL) |
| | 2 | |
| | 3 | == Notation |
| | 4 | |
| | 5 | * Primary Key - '''bold''' and __underline__ |
| | 6 | * Required/`NOT NULL` - '''bold''' |
| | 7 | * Foreign Key - Asterisk ( * ) |
| | 8 | * Optional (nullable) attributes - regular characters |
| | 9 | |
| | 10 | == Tables |
| | 11 | USERS (__'''user_id'''__, '''username''', '''first_name''', '''last_name''', '''password''', '''email''') |
| | 12 | |
| | 13 | ADMINS (__'''user_id'''__*) |
| | 14 | |
| | 15 | PET_OWNERS (__'''user_id'''__*) |
| | 16 | |
| | 17 | PET_SITTERS (__'''user_id'''__*) |
| | 18 | |
| | 19 | PET_TYPES (__'''pettype_id'''__, '''species''', average_lifespan, '''needs_outdoor_walk''') |
| | 20 | |
| | 21 | PETS (__'''pet_id'''__, '''name''', photo, '''age''', special_needs, description, '''owner_id'''*, '''pettype_id'''*) |
| | 22 | |
| | 23 | SERVICES (__'''service_id'''__, '''type''', description) |
| | 24 | |
| | 25 | BOOKINGS (__'''booking_id'''__, '''status''', '''date_from''', '''date_to''', '''address''', '''owner_id'''*, '''sitter_id'''*) |
| | 26 | |
| | 27 | REVIEWS (__'''review_id'''__, '''rating''', comment, '''booking_id'''*) |
| | 28 | |
| | 29 | PAYMENTS (__'''payment_id'''__, '''amount''', '''payment_type''', '''booking_id'''*) |
| | 30 | |
| | 31 | ADMIN_MANAGEMENT (__'''admin_id'''__*, __'''user_id'''__*) |
| | 32 | |
| | 33 | BOOKING_PETS (__'''booking_id'''__*, __'''pet_id'''__*) |
| | 34 | |
| | 35 | SITTER_SERVICES (__'''sitter_id'''__*, __'''service_id'''__*) |
| | 36 | |
| | 37 | BOOKING_SERVICES (__'''booking_id'''__*, __'''service_id'''__*) |
| | 38 | |
| | 39 | == DDL script for creating the database schema and objects: |
| | 40 | [attachment:schema_creation.sql] |
| | 41 | |
| | 42 | == DML script for filling tables with data: |
| | 43 | [attachment:data_load.sql] |
| | 44 | |
| | 45 | == Relational diagram |
| | 46 | [[Image(relational_schema.png)]] |