forked from boos/BoosAPI
refactor: purge Node.js, Rust is the one true backend
- Moved boosapi-rs/* to repo root - Deleted all Node.js source (src/server/, src/web/, scripts/) - Deleted node_modules, package.json, tsconfig, vite.config - Updated .gitignore and AGENTS.md for Rust-only stack - Fixed static file path for frontend dist/web/ - Dockerfile stays the same (already Rust-only) - Kept dist/web/ for Rust static serving
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
-- Organizations, members, and invitations for multi-tenant support
|
||||
|
||||
CREATE TABLE IF NOT EXISTS organizations (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
slug TEXT NOT NULL UNIQUE,
|
||||
plan TEXT NOT NULL DEFAULT 'free',
|
||||
status TEXT NOT NULL DEFAULT 'active',
|
||||
created_at TEXT DEFAULT (datetime('now')),
|
||||
updated_at TEXT DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS org_slug_idx
|
||||
ON organizations (slug);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS org_plan_idx
|
||||
ON organizations (plan);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS organization_members (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
org_id INTEGER NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
role TEXT NOT NULL DEFAULT 'member',
|
||||
status TEXT NOT NULL DEFAULT 'active',
|
||||
joined_at TEXT DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS org_member_unique
|
||||
ON organization_members (org_id, user_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS org_members_org_id_idx
|
||||
ON organization_members (org_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS org_members_user_id_idx
|
||||
ON organization_members (user_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS invitations (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
org_id INTEGER NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
|
||||
email TEXT NOT NULL,
|
||||
token TEXT NOT NULL UNIQUE,
|
||||
role TEXT NOT NULL DEFAULT 'member',
|
||||
invited_by INTEGER REFERENCES users(id),
|
||||
status TEXT NOT NULL DEFAULT 'pending',
|
||||
expires_at TEXT NOT NULL,
|
||||
created_at TEXT DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS invitations_token_unique
|
||||
ON invitations (token);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS invitations_status_idx
|
||||
ON invitations (status);
|
||||
Reference in New Issue
Block a user