The "Partner" logo row on the homepage was a hard-coded array of ten audio brand names in Home.jsx, not editable through the dashboard. Adds a partners table (name, optional logo, sort order), a PartnerController CRUD under the existing content.manage permission (same one already used for FAQ-style homepage content), and an admin page modeled on Brands.jsx. Home.jsx now fetches /partners and shows each entry's logo if set, falling back to the name as text otherwise. Schema migration now supports one-time seed data (Schema::SEED_DATA, applied by SchemaController::runMigration() only at the moment a table is first created, never again afterwards) so that clicking "Datenbankstruktur aktualisieren" on an existing site populates the new partners table with the previous ten names instead of leaving the homepage strip empty. Verified locally: first migration run creates + seeds the table, a second run neither re-seeds nor errors. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1.4 KiB
SQL
32 lines
1.4 KiB
SQL
USE hifi_shop;
|
|
|
|
-- Ersetzt die bisher hart codierte Partner-Markenliste auf der Startseite durch eine
|
|
-- editierbare Tabelle (Name + optionales Logo + Sortierung). Additiv, nichts wird geloescht.
|
|
-- Hinweis: Auf der Live-Seite reicht stattdessen ein Klick auf "Datenbankstruktur aktualisieren"
|
|
-- unter Admin-Panel -> Einstellungen -> Datenbank - das legt die Tabelle inkl. der bisherigen
|
|
-- zehn Markennamen als Startdaten automatisch an (siehe Schema::SEED_DATA).
|
|
|
|
CREATE TABLE IF NOT EXISTS partners (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
name VARCHAR(100) NOT NULL,
|
|
logo_path VARCHAR(255) NULL,
|
|
sort_order INT NOT NULL DEFAULT 0,
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB;
|
|
|
|
-- Nur beim allerersten Anlegen befuellen, nicht bei jedem erneuten Ausfuehren dieses Skripts.
|
|
INSERT INTO partners (name, sort_order)
|
|
SELECT name, sort_order FROM (
|
|
SELECT 'Ground Zero Audio' AS name, 0 AS sort_order UNION ALL
|
|
SELECT 'Audison', 1 UNION ALL
|
|
SELECT 'Hertz', 2 UNION ALL
|
|
SELECT 'Helix', 3 UNION ALL
|
|
SELECT 'Brax', 4 UNION ALL
|
|
SELECT 'Gladen', 5 UNION ALL
|
|
SELECT 'Alpine', 6 UNION ALL
|
|
SELECT 'Pioneer', 7 UNION ALL
|
|
SELECT 'Kenwood', 8 UNION ALL
|
|
SELECT 'JVC', 9
|
|
) AS defaults
|
|
WHERE NOT EXISTS (SELECT 1 FROM partners);
|