-- Migration 006: property amenities. MySQL syntax (not MariaDB).
-- Each row is one amenity for one property (e.g. "Central AC"). Amenities are
-- edited as a checklist in the admin and listed on the public property page.

CREATE TABLE amenities (
    id          INT UNSIGNED NOT NULL AUTO_INCREMENT,
    property_id INT UNSIGNED NOT NULL,
    name        VARCHAR(80) NOT NULL,
    PRIMARY KEY (id),
    KEY idx_amenities_property (property_id),
    CONSTRAINT fk_amenities_property FOREIGN KEY (property_id)
        REFERENCES properties (id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
