nxtgauge-backend-rust/crates/db/migrations/20260317000004_init_company_schema.up.sql

17 lines
544 B
SQL

CREATE TABLE IF NOT EXISTS company_profiles (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
-- Company Specific Fields
company_name VARCHAR(255) NOT NULL,
registration_number VARCHAR(100),
industry VARCHAR(150),
website_url VARCHAR(255),
employee_count INT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
-- Ensure a user can only have one company profile
UNIQUE(user_id)
);