mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-06-04 20:43:01 +00:00
cleanup
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- +goose Up
|
||||
-- Create customers table for customer management
|
||||
CREATE TABLE IF NOT EXISTS customers (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
||||
name text NOT NULL,
|
||||
email text NOT NULL,
|
||||
phone text,
|
||||
status text NOT NULL DEFAULT 'active',
|
||||
notes text,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_customers_tenant ON customers (tenant_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_customers_email ON customers (tenant_id, email);
|
||||
CREATE INDEX IF NOT EXISTS idx_customers_status ON customers (tenant_id, status);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS customers;
|
||||
Reference in New Issue
Block a user