0% found this document useful (0 votes)
8 views2 pages

Swellenfleurs Database Schema Guide

sql example

Uploaded by

lhay0501
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Swellenfleurs Database Schema Guide

sql example

Uploaded by

lhay0501
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- =============================================

-- Swellenfleurs Database Schema


-- Database: swellenfleurs
-- =============================================

-- Create database if it doesn't exist


CREATE DATABASE IF NOT EXISTS swellenfleurs
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;

-- Use the database


USE swellenfleurs;

-- =============================================
-- Users Table
-- =============================================
CREATE TABLE IF NOT EXISTS users (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
surname VARCHAR(100) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
cellphone VARCHAR(20) DEFAULT NULL,
street VARCHAR(255) DEFAULT NULL,
city VARCHAR(100) DEFAULT NULL,
postal VARCHAR(10) DEFAULT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_active TINYINT(1) DEFAULT 1,
INDEX idx_email (email),
INDEX idx_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- =============================================
-- Insert Sample Test User (Only if not exists)
-- Email: test@[Link]
-- Password: password123
-- =============================================
INSERT INTO users (name, surname, email, password, cellphone, street, city, postal)
SELECT 'Test', 'User', 'test@[Link]',
'$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/[Link]/igi',
'0821234567', '22 Berg Street', 'Swellendam', '6749'
WHERE NOT EXISTS (
SELECT 1 FROM users WHERE email = 'test@[Link]'
);

bouquets_table.sql - Bouquets Database Schema


Code
Now let's create the main bouquets page:

Step 2: Bouquets Main Page (bouquets/[Link])


bouquets/[Link] - Bouquets Listing Page
Code
Now let's create the CSS for the bouquets page:

Step 3: Bouquets CSS (bouquets/[Link])


bouquets/[Link] - Bouquets Page Styles
Code
Perfect! Now I've created the main bouquets listing page. Next, let me create the
individual bouquet view page ([Link]):

Would you like me to continue with:

bouquets/[Link] - Individual bouquet detail page (like your second image)


Create a placeholder image system for the bouquets
Let me know and I'll continue! 🌸

-- =============================================
-- Bouquets Table for Swellenfleurs
-- =============================================

USE swellenfleurs;

-- Create bouquets table


CREATE TABLE IF NOT EXISTS bouquets (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
price DECIMAL(10, 2) NOT NULL,
photo VARCHAR(255) NOT NULL,
quantity_available INT(11) DEFAULT 0,
is_special TINYINT(1) DEFAULT 0,
is_seasonal TINYINT(1) DEFAULT 0,
is_new TINYINT(1) DEFAULT 0,
is_popular TINYINT(1) DEFAULT 0,
is_limited TINYINT(1) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_active TINYINT(1) DEFAULT 1,
INDEX idx_is_active (is_active),
INDEX idx_is_special (is_special),
INDEX idx_quantity (quantity_available)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

You might also like