bmc_hub/migrations/076_nextcloud_instances.sql

23 lines
743 B
MySQL
Raw Normal View History

-- Migration: 076_nextcloud_instances
-- Created: 2026-02-01
CREATE TABLE IF NOT EXISTS nextcloud_instances (
id SERIAL PRIMARY KEY,
customer_id INTEGER NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
base_url TEXT NOT NULL,
auth_type VARCHAR(20) NOT NULL DEFAULT 'basic',
username TEXT NOT NULL,
password_encrypted TEXT NOT NULL,
is_enabled BOOLEAN NOT NULL DEFAULT true,
disabled_at TIMESTAMP,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_nextcloud_instances_customer
ON nextcloud_instances(customer_id);
CREATE INDEX IF NOT EXISTS idx_nextcloud_instances_enabled
ON nextcloud_instances(is_enabled);