Foreign keys at the database level cause issues with deployment flexibility. Keep only indexes for query performance; enforce referential integrity at the application level.
10 lines
421 B
SQL
10 lines
421 B
SQL
CREATE TABLE IF NOT EXISTS workspace_billing (
|
|
workspace_id UUID PRIMARY KEY,
|
|
balance DECIMAL(20, 4) NOT NULL DEFAULT 0,
|
|
currency VARCHAR(10) NOT NULL DEFAULT 'USD',
|
|
monthly_quota DECIMAL(20, 4) NOT NULL DEFAULT 0,
|
|
total_spent DECIMAL(20, 4) NOT NULL DEFAULT 0,
|
|
updated_at TIMESTAMPTZ NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL
|
|
);
|